ChibiOS 21.11.5
hal_safety.c
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
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 http://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
17/**
18 * @file hal_safety.c
19 * @brief Safety manager code.
20 *
21 * @addtogroup HAL_SAFETY
22 * @{
23 */
24
25#include "hal.h"
26
27/*===========================================================================*/
28/* Driver local definitions. */
29/*===========================================================================*/
30
31#define HAL_US2RTC(freq, usec) (halcnt_t)((((freq) + 999999UL) / 1000000UL) * (usec))
32
33/*===========================================================================*/
34/* Driver exported variables. */
35/*===========================================================================*/
36
37/*===========================================================================*/
38/* Driver local variables. */
39/*===========================================================================*/
40
41/*===========================================================================*/
42/* Driver local functions. */
43/*===========================================================================*/
44
45#if !defined(HAL_LLD_GET_CNT_VALUE)
46/* Stub type if the LLD does not implement the timeout functionality.*/
47typedef unsigned halcnt_t;
48#endif
49
50static inline uint32_t get_frequency(void) {
51
52#if defined(HAL_LLD_GET_CNT_FREQUENCY)
53 return HAL_LLD_GET_CNT_FREQUENCY();
54#else
55 return 1000000U;
56#endif
57}
58
59static inline halcnt_t get_counter(void) {
60
61#if defined(HAL_LLD_GET_CNT_VALUE)
62 return HAL_LLD_GET_CNT_VALUE();
63#else
64 return (halcnt_t)0;
65#endif
66}
67
68static inline bool is_counter_within(halcnt_t start, halcnt_t end) {
69 halcnt_t cnt = get_counter();
70
71 return (bool)(((halcnt_t)cnt - (halcnt_t)start) <
72 ((halcnt_t)end - (halcnt_t)start));
73}
74
75/*===========================================================================*/
76/* Driver exported functions. */
77/*===========================================================================*/
78
79/**
80 * @brief Common safety fault handler.
81 * @brief This function does not return, any recovery strategy, at this
82 * level, is meant to be destructive.
83 *
84 * @param[in] message fault reason string
85 *
86 * @api
87 */
89void halSftFail(const char *message) {
90
91#if defined(HAL_SAFETY_HANDLER)
92 HAL_SAFETY_HANDLER(message);
93#else
94 osalSysHalt(message);
95 while (true) {} /* TODO: Temporary, suppresses a warning.*/
96#endif
97}
98
99/**
100 * @brief Waits for masked bits to match or a timeout.
101 * @note The timeout feature only works if the HAL LLD implements the
102 * required counter functionality.
103 *
104 * @param[in] p address of the register
105 * @param[in] mask mask of bits to be checked
106 * @param[in] match value to be matched
107 * @param[in] tmo timeout in microseconds
108 * @param[in] valp pointer to where to store the last read value
109 * or @p NULL
110 * @return The final result.
111 * @retval false if the condition has been verified.
112 * @retval true if a timeout occurred.
113 *
114 * @xclass
115 */
116bool halRegWaitMatch8X(volatile uint8_t *p, uint8_t mask,
117 uint8_t match, uint32_t tmo, uint8_t *valp) {
118 halcnt_t start, end;
119
120 /* Time window for the operation to complete.*/
121 start = get_counter();
122 end = start + HAL_US2RTC(get_frequency(), tmo);
123
124 /* Testing the condition continuously until it becomes true or the
125 timeout expires, it is done at least once.*/
126 do {
127 /* Getting register value and storing it outside if required.*/
128 uint8_t v = *p;
129 if (valp != NULL) {
130 *valp = v;
131 }
132
133 /* Condition check and end of the loop if met.*/
134 if ((v & mask) == match) {
135 return false;
136 }
137 } while (is_counter_within(start, end));
138
139 return true;
140}
141
142/**
143 * @brief Waits for masked bits to match or a timeout.
144 * @note The timeout feature only works if the HAL LLD implements the
145 * required counter functionality.
146 *
147 * @param[in] p address of the register
148 * @param[in] mask mask of bits to be checked
149 * @param[in] match value to be matched
150 * @param[in] tmo timeout in microseconds
151 * @param[in] valp pointer to where to store the last read value
152 * or @p NULL
153 * @return The final result.
154 * @retval false if the condition has been verified.
155 * @retval true if a timeout occurred.
156 *
157 * @xclass
158 */
159bool halRegWaitMatch16X(volatile uint16_t *p, uint16_t mask,
160 uint16_t match, uint32_t tmo, uint16_t *valp) {
161 halcnt_t start, end;
162
163 /* Time window for the operation to complete.*/
164 start = get_counter();
165 end = start + HAL_US2RTC(get_frequency(), tmo);
166
167 /* Testing the condition continuously until it becomes true or the
168 timeout expires, it is done at least once.*/
169 do {
170 /* Getting register value and storing it outside if required.*/
171 uint16_t v = *p;
172 if (valp != NULL) {
173 *valp = v;
174 }
175
176 /* Condition check and end of the loop if met.*/
177 if ((v & mask) == match) {
178 return false;
179 }
180 } while (is_counter_within(start, end));
181
182 return true;
183}
184
185/**
186 * @brief Waits for masked bits to match or a timeout.
187 * @note The timeout feature only works if the HAL LLD implements the
188 * required counter functionality.
189 *
190 * @param[in] p address of the register
191 * @param[in] mask mask of bits to be checked
192 * @param[in] match value to be matched
193 * @param[in] tmo timeout in microseconds
194 * @param[in] valp pointer to where to store the last read value
195 * or @p NULL
196 * @return The final result.
197 * @retval false if the condition has been verified.
198 * @retval true if a timeout occurred.
199 *
200 * @xclass
201 */
202bool halRegWaitMatch32X(volatile uint32_t *p, uint32_t mask,
203 uint32_t match, uint32_t tmo, uint32_t *valp) {
204 halcnt_t start, end;
205
206 /* Time window for the operation to complete.*/
207 start = get_counter();
208 end = start + HAL_US2RTC(get_frequency(), tmo);
209
210 /* Testing the condition continuously until it becomes true or the
211 timeout expires, it is done at least once.*/
212 do {
213 /* Getting register value and storing it outside if required.*/
214 uint32_t v = *p;
215 if (valp != NULL) {
216 *valp = v;
217 }
218
219 /* Condition check and end of the loop if met.*/
220 if ((v & mask) == match) {
221 return false;
222 }
223 } while (is_counter_within(start, end));
224
225 return true;
226}
227
228/**
229 * @brief Waits for all specified bits to be set or a timeout.
230 * @note The timeout feature only works if the HAL LLD implements the
231 * required counter functionality.
232 *
233 * @param[in] p address of the register
234 * @param[in] mask mask of bits to be checked
235 * @param[in] tmo timeout in microseconds
236 * @param[in] valp pointer to where to store the last read value
237 * or @p NULL
238 * @return The final result.
239 * @retval false if the condition has been verified.
240 * @retval true if a timeout occurred.
241 *
242 * @xclass
243 */
244bool halRegWaitAllSet8X(volatile uint8_t *p, uint8_t mask,
245 uint32_t tmo, uint8_t *valp) {
246 halcnt_t start, end;
247
248 /* Time window for the operation to complete.*/
249 start = get_counter();
250 end = start + HAL_US2RTC(get_frequency(), tmo);
251
252 /* Testing the condition continuously until it becomes true or the
253 timeout expires, it is done at least once.*/
254 do {
255 /* Getting register value and storing it outside if required.*/
256 uint8_t v = *p;
257 if (valp != NULL) {
258 *valp = v;
259 }
260
261 /* Condition check and end of the loop if met.*/
262 if ((v & mask) == mask) {
263 return false;
264 }
265 } while (is_counter_within(start, end));
266
267 return true;
268}
269
270/**
271 * @brief Waits for all specified bits to be set or a timeout.
272 * @note The timeout feature only works if the HAL LLD implements the
273 * required counter functionality.
274 *
275 * @param[in] p address of the register
276 * @param[in] mask mask of bits to be checked
277 * @param[in] tmo timeout in microseconds
278 * @param[in] valp pointer to where to store the last read value
279 * or @p NULL
280 * @return The final result.
281 * @retval false if the condition has been verified.
282 * @retval true if a timeout occurred.
283 *
284 * @xclass
285 */
286bool halRegWaitAllSet16X(volatile uint16_t *p, uint16_t mask,
287 uint32_t tmo, uint16_t *valp) {
288 halcnt_t start, end;
289
290 /* Time window for the operation to complete.*/
291 start = get_counter();
292 end = start + HAL_US2RTC(get_frequency(), tmo);
293
294 /* Testing the condition continuously until it becomes true or the
295 timeout expires, it is done at least once.*/
296 do {
297 /* Getting register value and storing it outside if required.*/
298 uint16_t v = *p;
299 if (valp != NULL) {
300 *valp = v;
301 }
302
303 /* Condition check and end of the loop if met.*/
304 if ((v & mask) == mask) {
305 return false;
306 }
307 } while (is_counter_within(start, end));
308
309 return true;
310}
311
312/**
313 * @brief Waits for all specified bits to be set or a timeout.
314 * @note The timeout feature only works if the HAL LLD implements the
315 * required counter functionality.
316 *
317 * @param[in] p address of the register
318 * @param[in] mask mask of bits to be checked
319 * @param[in] tmo timeout in microseconds
320 * @param[in] valp pointer to where to store the last read value
321 * or @p NULL
322 * @return The final result.
323 * @retval false if the condition has been verified.
324 * @retval true if a timeout occurred.
325 *
326 * @xclass
327 */
328bool halRegWaitAllSet32X(volatile uint32_t *p, uint32_t mask,
329 uint32_t tmo, uint32_t *valp) {
330 halcnt_t start, end;
331
332 /* Time window for the operation to complete.*/
333 start = get_counter();
334 end = start + HAL_US2RTC(get_frequency(), tmo);
335
336 /* Testing the condition continuously until it becomes true or the
337 timeout expires, it is done at least once.*/
338 do {
339 /* Getting register value and storing it outside if required.*/
340 uint32_t v = *p;
341 if (valp != NULL) {
342 *valp = v;
343 }
344
345 /* Condition check and end of the loop if met.*/
346 if ((v & mask) == mask) {
347 return false;
348 }
349 } while (is_counter_within(start, end));
350
351 return true;
352}
353
354/**
355 * @brief Waits for any of specified bits to be set or a timeout.
356 * @note The timeout feature only works if the HAL LLD implements the
357 * required counter functionality.
358 *
359 * @param[in] p address of the register
360 * @param[in] mask mask of bits to be checked
361 * @param[in] tmo timeout in microseconds
362 * @param[in] valp pointer to where to store the last read value
363 * or @p NULL
364 * @return The final result.
365 * @retval false if the condition has been verified.
366 * @retval true if a timeout occurred.
367 *
368 * @xclass
369 */
370bool halRegWaitAnySet8X(volatile uint8_t *p, uint8_t mask,
371 uint32_t tmo, uint8_t *valp) {
372 halcnt_t start, end;
373
374 /* Time window for the operation to complete.*/
375 start = get_counter();
376 end = start + HAL_US2RTC(get_frequency(), tmo);
377
378 /* Testing the condition continuously until it becomes true or the
379 timeout expires, it is done at least once.*/
380 do {
381 /* Getting register value and storing it outside if required.*/
382 uint8_t v = *p;
383 if (valp != NULL) {
384 *valp = v;
385 }
386
387 /* Condition check and end of the loop if met.*/
388 if ((v & mask) != (uint8_t)0) {
389 return false;
390 }
391 } while (is_counter_within(start, end));
392
393 return true;
394}
395
396/**
397 * @brief Waits for any of specified bits to be set or a timeout.
398 * @note The timeout feature only works if the HAL LLD implements the
399 * required counter functionality.
400 *
401 * @param[in] p address of the register
402 * @param[in] mask mask of bits to be checked
403 * @param[in] tmo timeout in microseconds
404 * @param[in] valp pointer to where to store the last read value
405 * or @p NULL
406 * @return The final result.
407 * @retval false if the condition has been verified.
408 * @retval true if a timeout occurred.
409 *
410 * @xclass
411 */
412bool halRegWaitAnySet16X(volatile uint16_t *p, uint16_t mask,
413 uint32_t tmo, uint16_t *valp) {
414 halcnt_t start, end;
415
416 /* Time window for the operation to complete.*/
417 start = get_counter();
418 end = start + HAL_US2RTC(get_frequency(), tmo);
419
420 /* Testing the condition continuously until it becomes true or the
421 timeout expires, it is done at least once.*/
422 do {
423 /* Getting register value and storing it outside if required.*/
424 uint16_t v = *p;
425 if (valp != NULL) {
426 *valp = v;
427 }
428
429 /* Condition check and end of the loop if met.*/
430 if ((v & mask) != (uint16_t)0) {
431 return false;
432 }
433 } while (is_counter_within(start, end));
434
435 return true;
436}
437
438/**
439 * @brief Waits for any of specified bits to be set or a timeout.
440 * @note The timeout feature only works if the HAL LLD implements the
441 * required counter functionality.
442 *
443 * @param[in] p address of the register
444 * @param[in] mask mask of bits to be checked
445 * @param[in] tmo timeout in microseconds
446 * @param[in] valp pointer to where to store the last read value
447 * or @p NULL
448 * @return The final result.
449 * @retval false if the condition has been verified.
450 * @retval true if a timeout occurred.
451 *
452 * @xclass
453 */
454bool halRegWaitAnySet32X(volatile uint32_t *p, uint32_t mask,
455 uint32_t tmo, uint32_t *valp) {
456 halcnt_t start, end;
457
458 /* Time window for the operation to complete.*/
459 start = get_counter();
460 end = start + HAL_US2RTC(get_frequency(), tmo);
461
462 /* Testing the condition continuously until it becomes true or the
463 timeout expires, it is done at least once.*/
464 do {
465 /* Getting register value and storing it outside if required.*/
466 uint32_t v = *p;
467 if (valp != NULL) {
468 *valp = v;
469 }
470
471 /* Condition check and end of the loop if met.*/
472 if ((v & mask) != (uint32_t)0) {
473 return false;
474 }
475 } while (is_counter_within(start, end));
476
477 return true;
478}
479
480/**
481 * @brief Waits for all specified bits to be cleared or a timeout.
482 * @note The timeout feature only works if the HAL LLD implements the
483 * required counter functionality.
484 *
485 * @param[in] p address of the register
486 * @param[in] mask mask of bits to be checked
487 * @param[in] tmo timeout in microseconds
488 * @param[in] valp pointer to where to store the last read value
489 * or @p NULL
490 * @return The final result.
491 * @retval false if the condition has been verified.
492 * @retval true if a timeout occurred.
493 *
494 * @xclass
495 */
496bool halRegWaitAllClear8X(volatile uint8_t *p, uint8_t mask,
497 uint32_t tmo, uint8_t *valp) {
498 halcnt_t start, end;
499
500 /* Time window for the operation to complete.*/
501 start = get_counter();
502 end = start + HAL_US2RTC(get_frequency(), tmo);
503
504 /* Testing the condition continuously until it becomes true or the
505 timeout expires, it is done at least once.*/
506 do {
507 /* Getting register value and storing it outside if required.*/
508 uint8_t v = *p;
509 if (valp != NULL) {
510 *valp = v;
511 }
512
513 /* Condition check and end of the loop if met.*/
514 if ((v & mask) == (uint8_t)0) {
515 return false;
516 }
517 } while (is_counter_within(start, end));
518
519 return true;
520}
521
522/**
523 * @brief Waits for all specified bits to be cleared or a timeout.
524 * @note The timeout feature only works if the HAL LLD implements the
525 * required counter functionality.
526 *
527 * @param[in] p address of the register
528 * @param[in] mask mask of bits to be checked
529 * @param[in] tmo timeout in microseconds
530 * @param[in] valp pointer to where to store the last read value
531 * or @p NULL
532 * @return The final result.
533 * @retval false if the condition has been verified.
534 * @retval true if a timeout occurred.
535 *
536 * @xclass
537 */
538bool halRegWaitAllClear16X(volatile uint16_t *p, uint16_t mask,
539 uint32_t tmo, uint16_t *valp) {
540 halcnt_t start, end;
541
542 /* Time window for the operation to complete.*/
543 start = get_counter();
544 end = start + HAL_US2RTC(get_frequency(), tmo);
545
546 /* Testing the condition continuously until it becomes true or the
547 timeout expires, it is done at least once.*/
548 do {
549 /* Getting register value and storing it outside if required.*/
550 uint16_t v = *p;
551 if (valp != NULL) {
552 *valp = v;
553 }
554
555 /* Condition check and end of the loop if met.*/
556 if ((v & mask) == (uint16_t)0) {
557 return false;
558 }
559 } while (is_counter_within(start, end));
560
561 return true;
562}
563
564/**
565 * @brief Waits for all specified bits to be cleared or a timeout.
566 * @note The timeout feature only works if the HAL LLD implements the
567 * required counter functionality.
568 *
569 * @param[in] p address of the register
570 * @param[in] mask mask of bits to be checked
571 * @param[in] tmo timeout in microseconds
572 * @param[in] valp pointer to where to store the last read value
573 * or @p NULL
574 * @return The final result.
575 * @retval false if the condition has been verified.
576 * @retval true if a timeout occurred.
577 *
578 * @xclass
579 */
580bool halRegWaitAllClear32X(volatile uint32_t *p, uint32_t mask,
581 uint32_t tmo, uint32_t *valp) {
582 halcnt_t start, end;
583
584 /* Time window for the operation to complete.*/
585 start = get_counter();
586 end = start + HAL_US2RTC(get_frequency(), tmo);
587
588 /* Testing the condition continuously until it becomes true or the
589 timeout expires, it is done at least once.*/
590 do {
591 /* Getting register value and storing it outside if required.*/
592 uint32_t v = *p;
593 if (valp != NULL) {
594 *valp = v;
595 }
596
597 /* Condition check and end of the loop if met.*/
598 if ((v & mask) == (uint32_t)0) {
599 return false;
600 }
601 } while (is_counter_within(start, end));
602
603 return true;
604}
605
606/**
607 * @brief Waits for any of specified bits to be cleared or a timeout.
608 * @note The timeout feature only works if the HAL LLD implements the
609 * required counter functionality.
610 *
611 * @param[in] p address of the register
612 * @param[in] mask mask of bits to be checked
613 * @param[in] tmo timeout in microseconds
614 * @param[in] valp pointer to where to store the last read value
615 * or @p NULL
616 * @return The final result.
617 * @retval false if the condition has been verified.
618 * @retval true if a timeout occurred.
619 *
620 * @xclass
621 */
622bool halRegWaitAnyClear8X(volatile uint8_t *p, uint8_t mask,
623 uint32_t tmo, uint8_t *valp) {
624 halcnt_t start, end;
625
626 /* Time window for the operation to complete.*/
627 start = get_counter();
628 end = start + HAL_US2RTC(get_frequency(), tmo);
629
630 /* Testing the condition continuously until it becomes true or the
631 timeout expires, it is done at least once.*/
632 do {
633 /* Getting register value and storing it outside if required.*/
634 uint8_t v = *p;
635 if (valp != NULL) {
636 *valp = v;
637 }
638
639 /* Condition check and end of the loop if met.*/
640 if ((v & mask) != mask) {
641 return false;
642 }
643 } while (is_counter_within(start, end));
644
645 return true;
646}
647
648/**
649 * @brief Waits for any of specified bits to be cleared or a timeout.
650 * @note The timeout feature only works if the HAL LLD implements the
651 * required counter functionality.
652 *
653 * @param[in] p address of the register
654 * @param[in] mask mask of bits to be checked
655 * @param[in] tmo timeout in microseconds
656 * @param[in] valp pointer to where to store the last read value
657 * or @p NULL
658 * @return The final result.
659 * @retval false if the condition has been verified.
660 * @retval true if a timeout occurred.
661 *
662 * @xclass
663 */
664bool halRegWaitAnyClear16X(volatile uint16_t *p, uint16_t mask,
665 uint32_t tmo, uint16_t *valp) {
666 halcnt_t start, end;
667
668 /* Time window for the operation to complete.*/
669 start = get_counter();
670 end = start + HAL_US2RTC(get_frequency(), tmo);
671
672 /* Testing the condition continuously until it becomes true or the
673 timeout expires, it is done at least once.*/
674 do {
675 /* Getting register value and storing it outside if required.*/
676 uint16_t v = *p;
677 if (valp != NULL) {
678 *valp = v;
679 }
680
681 /* Condition check and end of the loop if met.*/
682 if ((v & mask) != mask) {
683 return false;
684 }
685 } while (is_counter_within(start, end));
686
687 return true;
688}
689
690/**
691 * @brief Waits for any of specified bits to be cleared or a timeout.
692 * @note The timeout feature only works if the HAL LLD implements the
693 * required counter functionality.
694 *
695 * @param[in] p address of the register
696 * @param[in] mask mask of bits to be checked
697 * @param[in] tmo timeout in microseconds
698 * @param[in] valp pointer to where to store the last read value
699 * or @p NULL
700 * @return The final result.
701 * @retval false if the condition has been verified.
702 * @retval true if a timeout occurred.
703 *
704 * @xclass
705 */
706bool halRegWaitAnyClear32X(volatile uint32_t *p, uint32_t mask,
707 uint32_t tmo, uint32_t *valp) {
708 halcnt_t start, end;
709
710 /* Time window for the operation to complete.*/
711 start = get_counter();
712 end = start + HAL_US2RTC(get_frequency(), tmo);
713
714 /* Testing the condition continuously until it becomes true or the
715 timeout expires, it is done at least once.*/
716 do {
717 /* Getting register value and storing it outside if required.*/
718 uint32_t v = *p;
719 if (valp != NULL) {
720 *valp = v;
721 }
722
723 /* Condition check and end of the loop if met.*/
724 if ((v & mask) != mask) {
725 return false;
726 }
727 } while (is_counter_within(start, end));
728
729 return true;
730}
731
732/** @} */
#define CC_NO_RETURN
Marks a function as non-returning.
Definition ccportab.h:115
static bool is_counter_within(halcnt_t start, halcnt_t end)
Definition hal_safety.c:68
bool halRegWaitAnyClear32X(volatile uint32_t *p, uint32_t mask, uint32_t tmo, uint32_t *valp)
Waits for any of specified bits to be cleared or a timeout.
Definition hal_safety.c:706
bool halRegWaitAnyClear8X(volatile uint8_t *p, uint8_t mask, uint32_t tmo, uint8_t *valp)
Waits for any of specified bits to be cleared or a timeout.
Definition hal_safety.c:622
unsigned halcnt_t
Definition hal_safety.c:47
bool halRegWaitMatch8X(volatile uint8_t *p, uint8_t mask, uint8_t match, uint32_t tmo, uint8_t *valp)
Waits for masked bits to match or a timeout.
Definition hal_safety.c:116
bool halRegWaitMatch32X(volatile uint32_t *p, uint32_t mask, uint32_t match, uint32_t tmo, uint32_t *valp)
Waits for masked bits to match or a timeout.
Definition hal_safety.c:202
bool halRegWaitAllClear32X(volatile uint32_t *p, uint32_t mask, uint32_t tmo, uint32_t *valp)
Waits for all specified bits to be cleared or a timeout.
Definition hal_safety.c:580
static halcnt_t get_counter(void)
Definition hal_safety.c:59
static uint32_t get_frequency(void)
Definition hal_safety.c:50
bool halRegWaitAnyClear16X(volatile uint16_t *p, uint16_t mask, uint32_t tmo, uint16_t *valp)
Waits for any of specified bits to be cleared or a timeout.
Definition hal_safety.c:664
bool halRegWaitAllSet32X(volatile uint32_t *p, uint32_t mask, uint32_t tmo, uint32_t *valp)
Waits for all specified bits to be set or a timeout.
Definition hal_safety.c:328
bool halRegWaitAllClear8X(volatile uint8_t *p, uint8_t mask, uint32_t tmo, uint8_t *valp)
Waits for all specified bits to be cleared or a timeout.
Definition hal_safety.c:496
#define HAL_US2RTC(freq, usec)
Definition hal_safety.c:31
bool halRegWaitAllSet16X(volatile uint16_t *p, uint16_t mask, uint32_t tmo, uint16_t *valp)
Waits for all specified bits to be set or a timeout.
Definition hal_safety.c:286
bool halRegWaitAnySet16X(volatile uint16_t *p, uint16_t mask, uint32_t tmo, uint16_t *valp)
Waits for any of specified bits to be set or a timeout.
Definition hal_safety.c:412
bool halRegWaitAllClear16X(volatile uint16_t *p, uint16_t mask, uint32_t tmo, uint16_t *valp)
Waits for all specified bits to be cleared or a timeout.
Definition hal_safety.c:538
bool halRegWaitMatch16X(volatile uint16_t *p, uint16_t mask, uint16_t match, uint32_t tmo, uint16_t *valp)
Waits for masked bits to match or a timeout.
Definition hal_safety.c:159
bool halRegWaitAnySet32X(volatile uint32_t *p, uint32_t mask, uint32_t tmo, uint32_t *valp)
Waits for any of specified bits to be set or a timeout.
Definition hal_safety.c:454
bool halRegWaitAnySet8X(volatile uint8_t *p, uint8_t mask, uint32_t tmo, uint8_t *valp)
Waits for any of specified bits to be set or a timeout.
Definition hal_safety.c:370
CC_NO_RETURN void halSftFail(const char *message)
Common safety fault handler.
Definition hal_safety.c:89
bool halRegWaitAllSet8X(volatile uint8_t *p, uint8_t mask, uint32_t tmo, uint8_t *valp)
Waits for all specified bits to be set or a timeout.
Definition hal_safety.c:244
void osalSysHalt(const char *reason)
System halt with error message.
Definition osal.c:77
HAL subsystem header.