54 #ifndef FOXBMS__GENERAL_H_
55 #define FOXBMS__GENERAL_H_
58 #include "HL_sys_common.h"
73 #define LARGEST_PIN_NUMBER (31u)
80 #define SETBIT(register, bit) ((register) |= (uint32)((uint32)1U << (bit)))
86 #define CLEARBIT(register, bit) ((register) &= ~(uint32)((uint32)1U << (bit)))
95 #define must_check_return __attribute__((warn_unused_result))
98 #define always_inline __attribute__((always_inline))
101 #ifdef UNITY_UNIT_TEST
102 #define UNIT_TEST_WEAK_IMPL __attribute__((weak))
104 #define UNIT_TEST_WEAK_IMPL
109 static_assert(
false == 0,
"false seems to have been modified.");
110 static_assert(
true !=
false,
"true seems to have been modified.");
111 static_assert(
true == 1,
"true seems to have been modified.");
125 #define REPEAT_U1u(x) (x)
126 #define REPEAT_U2u(x) REPEAT_U1u(x), (x)
127 #define REPEAT_U3u(x) REPEAT_U2u(x), (x)
128 #define REPEAT_U4u(x) REPEAT_U3u(x), (x)
129 #define REPEAT_U5u(x) REPEAT_U4u(x), (x)
130 #define REPEAT_U6u(x) REPEAT_U5u(x), (x)
131 #define REPEAT_U7u(x) REPEAT_U6u(x), (x)
132 #define REPEAT_U8u(x) REPEAT_U7u(x), (x)
133 #define REPEAT_U9u(x) REPEAT_U8u(x), (x)
134 #define REPEAT_U10u(x) REPEAT_U9u(x), (x)
135 #define REPEAT_U11u(x) REPEAT_U10u(x), (x)
136 #define REPEAT_U12u(x) REPEAT_U11u(x), (x)
137 #define REPEAT_U13u(x) REPEAT_U12u(x), (x)
138 #define REPEAT_U14u(x) REPEAT_U13u(x), (x)
139 #define REPEAT_U15u(x) REPEAT_U14u(x), (x)
140 #define REPEAT_U16u(x) REPEAT_U15u(x), (x)
141 #define REPEAT_U17u(x) REPEAT_U16u(x), (x)
142 #define REPEAT_U18u(x) REPEAT_U17u(x), (x)
143 #define REPEAT_U19u(x) REPEAT_U18u(x), (x)
144 #define REPEAT_U20u(x) REPEAT_U19u(x), (x)
145 #define REPEAT_U21u(x) REPEAT_U20u(x), (x)
146 #define REPEAT_U22u(x) REPEAT_U21u(x), (x)
147 #define REPEAT_U23u(x) REPEAT_U22u(x), (x)
148 #define REPEAT_U24u(x) REPEAT_U23u(x), (x)
149 #define REPEAT_U25u(x) REPEAT_U24u(x), (x)
150 #define REPEAT_U26u(x) REPEAT_U25u(x), (x)
151 #define REPEAT_U27u(x) REPEAT_U26u(x), (x)
152 #define REPEAT_U28u(x) REPEAT_U27u(x), (x)
153 #define REPEAT_U29u(x) REPEAT_U28u(x), (x)
154 #define REPEAT_U30u(x) REPEAT_U29u(x), (x)
155 #define REPEAT_U31u(x) REPEAT_U30u(x), (x)
156 #define REPEAT_U32u(x) REPEAT_U31u(x), (x)
157 #define REPEAT_U33u(x) REPEAT_U32u(x), (x)
158 #define REPEAT_U34u(x) REPEAT_U33u(x), (x)
159 #define REPEAT_U35u(x) REPEAT_U34u(x), (x)
160 #define REPEAT_U36u(x) REPEAT_U35u(x), (x)
161 #define REPEAT_U37u(x) REPEAT_U36u(x), (x)
162 #define REPEAT_U38u(x) REPEAT_U37u(x), (x)
163 #define REPEAT_U39u(x) REPEAT_U38u(x), (x)
164 #define REPEAT_U40u(x) REPEAT_U39u(x), (x)
165 #define REPEAT_U41u(x) REPEAT_U40u(x), (x)
166 #define REPEAT_U42u(x) REPEAT_U41u(x), (x)
167 #define REPEAT_U43u(x) REPEAT_U42u(x), (x)
168 #define REPEAT_U44u(x) REPEAT_U43u(x), (x)
169 #define REPEAT_U45u(x) REPEAT_U44u(x), (x)
170 #define REPEAT_U46u(x) REPEAT_U45u(x), (x)
171 #define REPEAT_U47u(x) REPEAT_U46u(x), (x)
172 #define REPEAT_U48u(x) REPEAT_U47u(x), (x)
173 #define REPEAT_U49u(x) REPEAT_U48u(x), (x)
174 #define REPEAT_U50u(x) REPEAT_U49u(x), (x)
175 #define REPEAT_U51u(x) REPEAT_U50u(x), (x)
176 #define REPEAT_U52u(x) REPEAT_U51u(x), (x)
177 #define REPEAT_U53u(x) REPEAT_U52u(x), (x)
178 #define REPEAT_U54u(x) REPEAT_U53u(x), (x)
179 #define REPEAT_U55u(x) REPEAT_U54u(x), (x)
180 #define REPEAT_U56u(x) REPEAT_U55u(x), (x)
181 #define REPEAT_U57u(x) REPEAT_U56u(x), (x)
182 #define REPEAT_U58u(x) REPEAT_U57u(x), (x)
183 #define REPEAT_U59u(x) REPEAT_U58u(x), (x)
184 #define REPEAT_U60u(x) REPEAT_U59u(x), (x)
185 #define REPEAT_U61u(x) REPEAT_U60u(x), (x)
186 #define REPEAT_U62u(x) REPEAT_U61u(x), (x)
187 #define REPEAT_U63u(x) REPEAT_U62u(x), (x)
188 #define REPEAT_U64u(x) REPEAT_U63u(x), (x)
189 #define REPEAT_U65u(x) REPEAT_U64u(x), (x)
190 #define REPEAT_U66u(x) REPEAT_U65u(x), (x)
191 #define REPEAT_U67u(x) REPEAT_U66u(x), (x)
192 #define REPEAT_U68u(x) REPEAT_U67u(x), (x)
193 #define REPEAT_U69u(x) REPEAT_U68u(x), (x)
194 #define REPEAT_U70u(x) REPEAT_U69u(x), (x)
195 #define REPEAT_U71u(x) REPEAT_U70u(x), (x)
196 #define REPEAT_U72u(x) REPEAT_U71u(x), (x)
197 #define REPEAT_U73u(x) REPEAT_U72u(x), (x)
198 #define REPEAT_U74u(x) REPEAT_U73u(x), (x)
199 #define REPEAT_U75u(x) REPEAT_U74u(x), (x)
200 #define REPEAT_U76u(x) REPEAT_U75u(x), (x)
201 #define REPEAT_U77u(x) REPEAT_U76u(x), (x)
202 #define REPEAT_U78u(x) REPEAT_U77u(x), (x)
203 #define REPEAT_U79u(x) REPEAT_U78u(x), (x)
204 #define REPEAT_U80u(x) REPEAT_U79u(x), (x)
205 #define REPEAT_U81u(x) REPEAT_U80u(x), (x)
206 #define REPEAT_U82u(x) REPEAT_U81u(x), (x)
207 #define REPEAT_U83u(x) REPEAT_U82u(x), (x)
208 #define REPEAT_U84u(x) REPEAT_U83u(x), (x)
209 #define REPEAT_U85u(x) REPEAT_U84u(x), (x)
210 #define REPEAT_U86u(x) REPEAT_U85u(x), (x)
211 #define REPEAT_U87u(x) REPEAT_U86u(x), (x)
212 #define REPEAT_U88u(x) REPEAT_U87u(x), (x)
213 #define REPEAT_U89u(x) REPEAT_U88u(x), (x)
214 #define REPEAT_U90u(x) REPEAT_U89u(x), (x)
215 #define REPEAT_U91u(x) REPEAT_U90u(x), (x)
216 #define REPEAT_U92u(x) REPEAT_U91u(x), (x)
217 #define REPEAT_U93u(x) REPEAT_U92u(x), (x)
218 #define REPEAT_U94u(x) REPEAT_U93u(x), (x)
219 #define REPEAT_U95u(x) REPEAT_U94u(x), (x)
220 #define REPEAT_U96u(x) REPEAT_U95u(x), (x)
221 #define REPEAT_U97u(x) REPEAT_U96u(x), (x)
222 #define REPEAT_U98u(x) REPEAT_U97u(x), (x)
223 #define REPEAT_U99u(x) REPEAT_U98u(x), (x)
226 #define REPEAT_Ux(x, n) REPEAT_U##n(x)
231 #define REPEAT_MAXIMUM_REPETITIONS (99u)
256 #define REPEAT_U(x, n) REPEAT_Ux(x, n)
264 #define GET_ARGS(...) __VA_ARGS__
265 #define STRIP_PARENS(x) x
268 #define STRIP(x) STRIP_PARENS(GET_ARGS x)
Assert macro implementation.
#define static_assert(cond, msg)
static assertion macro
Definition of foxBMS standard types.