Loading [MathJax]/extensions/tex2jax.js
spinn_common
7.3.1
Support code for SpiNNaker applications.
Toggle main menu visibility
Main Page
Related Pages
Data Structures
Data Structures
Data Structure Index
Data Fields
All
Variables
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Variables
Typedefs
b
c
i
m
p
s
u
w
Macros
_
a
c
e
f
l
m
n
p
r
s
•
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
Pages
Loading...
Searching...
No Matches
include
assert.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2013 The University of Manchester
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* https://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
90
#ifndef __ASSERT_H__
91
#define __ASSERT_H__
92
93
#include "
spin-print.h
"
94
98
#define abort(n) do { exit(n); } while (0)
99
101
#define LOG_ERROR 10
102
104
#define LOG_WARNING 20
105
107
#define LOG_INFO 30
108
110
#define LOG_DEBUG 40
111
112
// Define the log level if not already defined
113
#ifndef LOG_LEVEL
114
#if defined(PRODUCTION_CODE) || defined(NDEBUG)
115
#define LOG_LEVEL LOG_INFO
116
#else
// PRODUCTION_CODE
118
#define LOG_LEVEL LOG_DEBUG
119
#endif
// PRODUCTION_CODE
120
#endif
// LOG_LEVEL
121
122
#if !(defined(PRODUCTION_CODE) || defined(NDEBUG))
123
127
#define check(condition, message, ...) \
128
do { \
129
if (!(condition)) { \
130
io_printf(IO_BUF, "[CHECK] ", message, ##__VA_ARGS__); \
131
} \
132
} while (0)
127
#define check(condition, message, ...) \
…
133
136
#define sentinel(message, ...) \
137
do { \
138
io_printf(IO_BUF, "[SENTINEL] ", message, ##__VA_ARGS__); \
139
abort(0); \
140
} while (0)
136
#define sentinel(message, ...) \
…
141
145
#define assert(assertion) \
146
do { \
147
if (!(assertion)) { \
148
io_printf(IO_BUF, "[ASSERT] ", "assertion check fails!"); \
149
abort(0); \
150
} \
151
} while (0)
145
#define assert(assertion) \
…
152
157
#define assert_info(assertion, message, ...) \
158
do { \
159
if (!(assertion)) { \
160
io_printf(IO_BUF, "[ASSERT] ", message, ##__VA_ARGS__); \
161
abort(0); \
162
} \
163
} while (0)
157
#define assert_info(assertion, message, ...) \
…
164
165
#else
/* PRODUCTION_CODE */
166
#define check(a, s, ...) skip()
167
#define sentinel(s, ...) skip()
168
#define assert(a) skip()
169
#define assert_info(a, m, ...) skip()
170
#endif
/* PRODUCTION_CODE */
171
176
static
inline
unsigned
int
__addr__
(
void
*ptr)
177
{
178
return
(
unsigned
int
) ptr;
179
}
176
static
inline
unsigned
int
__addr__
(
void
*ptr) {
…
}
180
183
#define check_memory(a) check((a), "Out of memory")
184
185
#ifndef DEBUG_ON_HOST
188
#define check_itcm(a) \
189
check((ITCM_BASE <= __addr__(a) && __addr__(a) < ITCM_TOP), \
190
"%x is not in ITCM", (a))
188
#define check_itcm(a) \
…
191
194
#define check_dtcm(a) \
195
check((DTCM_BASE <= __addr__(a) && __addr__(a) < DTCM_TOP), \
196
"%x is not in DTCM", (a))
194
#define check_dtcm(a) \
…
197
200
#define check_sysram(a) \
201
check((SYSRAM_BASE <= __addr__(a) && __addr__(a) < SYSRAM_TOP), \
202
"%x is not in sysRAM", (a))
200
#define check_sysram(a) \
…
203
206
#define check_sdram(a) \
207
check((SDRAM_BASE <= __addr__(a) && __addr__(a) < SDRAM_TOP), \
208
"%x is not in sdram", (a))
206
#define check_sdram(a) \
…
209
210
#else
/* DEBUG_ON_HOST */
211
#define check_itcm(a) skip()
212
#define check_dtcm(a) skip()
213
#define check_sysram(a) skip()
214
#define check_sdram(a) skip()
215
#endif
/* DEBUG_ON_HOST */
216
217
#endif
/* __ASSERT_H__ */
__addr__
static unsigned int __addr__(void *ptr)
This function returns the unsigned integer associated with a pointer address.
Definition
assert.h:176
spin-print.h
For quick changing between host-side and SpiNNaker side C code printing.
Generated on Wed Oct 2 2024 07:07:28 for spinn_common by
1.9.8