Go to the documentation of this file.
41 #define CH_INTEGRITY_RLIST 1U
42 #define CH_INTEGRITY_VTLIST 2U
43 #define CH_INTEGRITY_REGISTRY 4U
44 #define CH_INTEGRITY_PORT 8U
78 #if defined(PORT_IRQ_IS_VALID_PRIORITY) || defined(__DOXYGEN__)
79 #define CH_IRQ_IS_VALID_PRIORITY(prio) \
80 PORT_IRQ_IS_VALID_PRIORITY(prio)
82 #define CH_IRQ_IS_VALID_PRIORITY(prio) false
96 #if defined(PORT_IRQ_IS_VALID_KERNEL_PRIORITY) || defined(__DOXYGEN__)
97 #define CH_IRQ_IS_VALID_KERNEL_PRIORITY(prio) \
98 PORT_IRQ_IS_VALID_KERNEL_PRIORITY(prio)
100 #define CH_IRQ_IS_VALID_KERNEL_PRIORITY(prio) false
110 #define CH_IRQ_PROLOGUE() \
111 PORT_IRQ_PROLOGUE(); \
112 CH_CFG_IRQ_PROLOGUE_HOOK(); \
113 _stats_increase_irq(); \
114 _trace_isr_enter(__func__); \
115 _dbg_check_enter_isr()
125 #define CH_IRQ_EPILOGUE() \
126 _dbg_check_leave_isr(); \
127 _trace_isr_leave(__func__); \
128 CH_CFG_IRQ_EPILOGUE_HOOK(); \
138 #define CH_IRQ_HANDLER(id) PORT_IRQ_HANDLER(id)
153 #define CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id)
171 #define S2RTC(freq, sec) ((freq) * (sec))
185 #define MS2RTC(freq, msec) (rtcnt_t)((((freq) + 999UL) / 1000UL) * (msec))
199 #define US2RTC(freq, usec) (rtcnt_t)((((freq) + 999999UL) / 1000000UL) * (usec))
213 #define RTC2S(freq, n) ((((n) - 1UL) / (freq)) + 1UL)
227 #define RTC2MS(freq, n) ((((n) - 1UL) / ((freq) / 1000UL)) + 1UL)
241 #define RTC2US(freq, n) ((((n) - 1UL) / ((freq) / 1000000UL)) + 1UL)
254 #if (PORT_SUPPORTS_RT == TRUE) || defined(__DOXYGEN__)
255 #define chSysGetRealtimeCounterX() (rtcnt_t)port_rt_get_counter_value()
268 #define chSysSwitch(ntp, otp) { \
270 _trace_switch(ntp, otp); \
271 _stats_ctxswc(ntp, otp); \
272 CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp); \
273 port_switch(ntp, otp); \
280 #if !defined(__DOXYGEN__)
281 extern stkalign_t ch_idle_thread_wa[];
292 #if PORT_SUPPORTS_RT == TRUE
377 (
ch.
rlist.current->hdr.pqueue.prio >=
ch.
rlist.pqueue.next->prio),
378 "priority order violation");
397 port_lock_from_isr();
419 port_unlock_from_isr();
431 if (port_irq_enabled(port_get_irq_status())) {
445 if (!port_irq_enabled(port_get_irq_status())) {
450 #if (CH_CFG_NO_IDLE_THREAD == FALSE) || defined(__DOXYGEN__)
void chSysRestoreStatusX(syssts_t sts)
Restores the specified execution status and leaves a critical zone.
bool chSysIsCounterWithinX(rtcnt_t cnt, rtcnt_t start, rtcnt_t end)
Realtime window test.
static void chSysLock(void)
Enters the kernel lock state.
static void chSysUnconditionalLock(void)
Unconditionally enters the kernel lock state.
#define chDbgAssert(c, r)
Condition assertion.
void chSysTimerHandlerI(void)
Handles time ticks for round robin preemption and timer increments.
bool chSysIntegrityCheckI(unsigned testmask)
System integrity check.
static void chSysEnable(void)
Lowers the system interrupt priority mask to user level.
void _dbg_check_lock(void)
Guard code for chSysLock().
void _dbg_check_disable(void)
Guard code for chSysDisable().
static void chSysDisable(void)
Raises the system interrupt priority mask to the maximum level.
void _stats_stop_measure_crit_isr(void)
Stops the measurement of an ISR critical zone.
void _stats_start_measure_crit_thd(void)
Starts the measurement of a thread critical zone.
void _dbg_check_suspend(void)
Guard code for chSysSuspend().
Structure representing a thread.
void chSysPolledDelayX(rtcnt_t cycles)
Polled delay.
void _stats_start_measure_crit_isr(void)
Starts the measurement of an ISR critical zone.
void _dbg_check_lock_from_isr(void)
Guard code for chSysLockFromIsr().
static void chSysLockFromISR(void)
Enters the kernel lock state from within an interrupt handler.
syssts_t chSysGetStatusAndLockX(void)
Returns the execution status and enters a critical zone.
ch_system_t ch
System data structures.
void chSysInit(void)
ChibiOS/RT initialization.
static void chSysSuspend(void)
Raises the system interrupt priority mask to system level.
static void chSysUnlock(void)
Leaves the kernel lock state.
ready_list_t rlist
Ready list header.
void _stats_stop_measure_crit_thd(void)
Stops the measurement of a thread critical zone.
void _dbg_check_unlock(void)
Guard code for chSysUnlock().
void _dbg_check_unlock_from_isr(void)
Guard code for chSysUnlockFromIsr().
static void chSysUnlockFromISR(void)
Leaves the kernel lock state from within an interrupt handler.
static void chSysUnconditionalUnlock(void)
Unconditionally leaves the kernel lock state.
static thread_t * chSysGetIdleThreadX(void)
Returns a pointer to the idle thread.
void _dbg_check_enable(void)
Guard code for chSysEnable().