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__)
292 #if PORT_SUPPORTS_RT == TRUE
315 _dbg_check_disable();
332 _dbg_check_suspend();
377 (
ch.
rlist.current->hdr.pqueue.prio >=
ch.
rlist.pqueue.next->prio),
378 "priority order violation");
399 _dbg_check_lock_from_isr();
417 _dbg_check_unlock_from_isr();
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 bool port_irq_enabled(syssts_t sts)
Checks the interrupt status.
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 port_unlock_from_isr(void)
Kernel-unlock action from an interrupt handler.
static void chSysEnable(void)
Lowers the system interrupt priority mask to user level.
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.
uint64_t stkalign_t
Type of stack and memory alignment enforcement.
void _stats_start_measure_crit_thd(void)
Starts the measurement of a thread critical zone.
Structure representing a thread.
void chSysPolledDelayX(rtcnt_t cycles)
Polled delay.
static void port_suspend(void)
Disables the interrupt sources below kernel-level priority.
static void port_unlock(void)
Kernel-unlock action.
void _stats_start_measure_crit_isr(void)
Starts the measurement of an ISR critical zone.
static syssts_t port_get_irq_status(void)
Returns a word encoding the current interrupts status.
static void chSysLockFromISR(void)
Enters the kernel lock state from within an interrupt handler.
static void port_lock(void)
Kernel-lock action.
static void port_enable(void)
Enables all the interrupt sources.
syssts_t chSysGetStatusAndLockX(void)
Returns the execution status and enters a critical zone.
static void port_lock_from_isr(void)
Kernel-lock action from an interrupt handler.
ch_system_t ch
System data structures.
static void port_disable(void)
Disables all the interrupt sources.
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.
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.