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
61 #if defined(PORT_CORE0_BSS_SECTION) || defined(__DOXYGEN__)
62 #define CH_SYS_CORE0_MEMORY PORT_CORE0_BSS_SECTION
64 #define CH_SYS_CORE0_MEMORY
73 #if defined(PORT_CORE1_BSS_SECTION) || defined(__DOXYGEN__)
74 #define CH_SYS_CORE1_MEMORY PORT_CORE1_BSS_SECTION
76 #define CH_SYS_CORE1_MEMORY
86 #if defined(PORT_INSTANCE_ACCESS)
87 #define currcore PORT_INSTANCE_ACCESS
89 #if (PORT_CORES_NUMBER > 1) || defined(__DOXYGEN__)
90 #define currcore ch_system.instances[port_get_core_id()]
92 #define currcore (&ch0)
115 #if defined(PORT_IRQ_IS_VALID_PRIORITY) || defined(__DOXYGEN__)
116 #define CH_IRQ_IS_VALID_PRIORITY(prio) \
117 PORT_IRQ_IS_VALID_PRIORITY(prio)
119 #define CH_IRQ_IS_VALID_PRIORITY(prio) false
133 #if defined(PORT_IRQ_IS_VALID_KERNEL_PRIORITY) || defined(__DOXYGEN__)
134 #define CH_IRQ_IS_VALID_KERNEL_PRIORITY(prio) \
135 PORT_IRQ_IS_VALID_KERNEL_PRIORITY(prio)
137 #define CH_IRQ_IS_VALID_KERNEL_PRIORITY(prio) false
147 #define CH_IRQ_PROLOGUE() \
148 PORT_IRQ_PROLOGUE(); \
149 CH_CFG_IRQ_PROLOGUE_HOOK(); \
150 __stats_increase_irq(); \
151 __trace_isr_enter(__func__); \
152 __dbg_check_enter_isr()
162 #define CH_IRQ_EPILOGUE() \
163 __dbg_check_leave_isr(); \
164 __trace_isr_leave(__func__); \
165 CH_CFG_IRQ_EPILOGUE_HOOK(); \
175 #define CH_IRQ_HANDLER(id) PORT_IRQ_HANDLER(id)
190 #define CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id)
208 #define S2RTC(freq, sec) ((freq) * (sec))
222 #define MS2RTC(freq, msec) (rtcnt_t)((((freq) + 999UL) / 1000UL) * (msec))
236 #define US2RTC(freq, usec) (rtcnt_t)((((freq) + 999999UL) / 1000000UL) * (usec))
250 #define RTC2S(freq, n) ((((n) - 1UL) / (freq)) + 1UL)
264 #define RTC2MS(freq, n) ((((n) - 1UL) / ((freq) / 1000UL)) + 1UL)
278 #define RTC2US(freq, n) ((((n) - 1UL) / ((freq) / 1000000UL)) + 1UL)
291 #if (PORT_SUPPORTS_RT == TRUE) || defined(__DOXYGEN__)
292 #define chSysGetRealtimeCounterX() (rtcnt_t)port_rt_get_counter_value()
305 #define chSysSwitch(ntp, otp) { \
307 __trace_switch(ntp, otp); \
308 __stats_ctxswc(ntp, otp); \
309 CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp); \
310 port_switch(ntp, otp); \
317 #if !defined(__DOXYGEN__)
323 #if PORT_CORES_NUMBER > 1
339 #if PORT_SUPPORTS_RT == TRUE
364 __dbg_check_disable();
381 __dbg_check_suspend();
395 __dbg_check_enable();
422 __dbg_check_unlock();
430 (
currcore->rlist.current->hdr.pqueue.prio >=
currcore->rlist.pqueue.next->prio),
431 "priority order violation");
454 __dbg_check_lock_from_isr();
474 __dbg_check_unlock_from_isr();
507 #if (CH_CFG_SMP_MODE == TRUE) || defined(__DOXYGEN__)
517 port_notify_instance(oip);
521 #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.
#define currcore
Access to current core's instance structure.
system_state_t
Global state of the operating system.
static void chSysUnconditionalLock(void)
Unconditionally enters the kernel lock state.
#define chDbgAssert(c, r)
Condition assertion.
System instance data structure.
void chSysTimerHandlerI(void)
Handles time ticks for round robin preemption and timer increments.
bool chSysIntegrityCheckI(unsigned testmask)
System integrity check.
void chSysWaitSystemState(system_state_t state)
Waits for the system state to be equal to the specified one.
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.
CH_SYS_CORE1_MEMORY os_instance_t ch1
Core 1 OS instance.
const os_instance_config_t ch_core0_cfg
Core 0 OS instance configuration.
const os_instance_config_t ch_core1_cfg
Core 1 OS instance configuration.
Type of system data structure.
Structure representing a thread.
void chSysPolledDelayX(rtcnt_t cycles)
Polled delay.
static void port_suspend(void)
Disables the interrupt sources below kernel-level priority.
ch_system_t ch_system
System root object.
static void port_unlock(void)
Kernel-unlock action.
static syssts_t port_get_irq_status(void)
Returns a word encoding the current interrupts status.
void __stats_stop_measure_crit_thd(void)
Stops the measurement of a thread critical zone.
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 chSysNotifyInstance(os_instance_t *oip)
Notifies an OS instance to check for reschedule.
static void port_lock_from_isr(void)
Kernel-lock action from an interrupt handler.
static void port_disable(void)
Disables all the interrupt sources.
void chSysInit(void)
System initialization.
static void chSysSuspend(void)
Raises the system interrupt priority mask to system level.
static void chSysUnlock(void)
Leaves the kernel lock state.
Type of an system instance configuration.
void __stats_start_measure_crit_thd(void)
Starts the measurement of a thread critical zone.
CH_SYS_CORE0_MEMORY os_instance_t ch0
Core 0 OS instance.
void __stats_start_measure_crit_isr(void)
Starts the measurement of an ISR 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.