40#define CH_INTEGRITY_RLIST 1U
41#define CH_INTEGRITY_VTLIST 2U
42#define CH_INTEGRITY_REGISTRY 4U
43#define CH_INTEGRITY_PORT 8U
60#if defined(PORT_CORE0_BSS_SECTION) || defined(__DOXYGEN__)
61#define CH_SYS_CORE0_MEMORY PORT_CORE0_BSS_SECTION
63#define CH_SYS_CORE0_MEMORY
72#if defined(PORT_CORE1_BSS_SECTION) || defined(__DOXYGEN__)
73#define CH_SYS_CORE1_MEMORY PORT_CORE1_BSS_SECTION
75#define CH_SYS_CORE1_MEMORY
85#if defined(PORT_INSTANCE_ACCESS)
86 #define currcore PORT_INSTANCE_ACCESS
88 #if (PORT_CORES_NUMBER > 1) || defined(__DOXYGEN__)
89 #define currcore ch_system.instances[port_get_core_id()]
91 #define currcore (&ch0)
114#if defined(PORT_IRQ_IS_VALID_PRIORITY) || defined(__DOXYGEN__)
115#define CH_IRQ_IS_VALID_PRIORITY(prio) \
116 PORT_IRQ_IS_VALID_PRIORITY(prio)
118#define CH_IRQ_IS_VALID_PRIORITY(prio) false
132#if defined(PORT_IRQ_IS_VALID_KERNEL_PRIORITY) || defined(__DOXYGEN__)
133#define CH_IRQ_IS_VALID_KERNEL_PRIORITY(prio) \
134 PORT_IRQ_IS_VALID_KERNEL_PRIORITY(prio)
136#define CH_IRQ_IS_VALID_KERNEL_PRIORITY(prio) false
146#define CH_IRQ_PROLOGUE() \
147 PORT_IRQ_PROLOGUE(); \
148 CH_CFG_IRQ_PROLOGUE_HOOK(); \
149 __stats_increase_irq(); \
150 __trace_isr_enter(__func__); \
151 __dbg_check_enter_isr()
161#define CH_IRQ_EPILOGUE() \
162 __dbg_check_leave_isr(); \
163 __trace_isr_leave(__func__); \
164 CH_CFG_IRQ_EPILOGUE_HOOK(); \
174#define CH_IRQ_HANDLER(id) PORT_IRQ_HANDLER(id)
189#define CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id)
207#define S2RTC(freq, sec) ((freq) * (sec))
221#define MS2RTC(freq, msec) (rtcnt_t)((((freq) + 999UL) / 1000UL) * (msec))
235#define US2RTC(freq, usec) (rtcnt_t)((((freq) + 999999UL) / 1000000UL) * (usec))
249#define RTC2S(freq, n) ((((n) - 1UL) / (freq)) + 1UL)
263#define RTC2MS(freq, n) ((((n) - 1UL) / ((freq) / 1000UL)) + 1UL)
277#define RTC2US(freq, n) ((((n) - 1UL) / ((freq) / 1000000UL)) + 1UL)
290#if (PORT_SUPPORTS_RT == TRUE) || defined(__DOXYGEN__)
291#define chSysGetRealtimeCounterX() (rtcnt_t)port_rt_get_counter_value()
304#define chSysSwitch(ntp, otp) { \
306 __trace_switch(ntp, otp); \
307 __stats_ctxswc(ntp, otp); \
308 CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp); \
309 port_switch(ntp, otp); \
316#if !defined(__DOXYGEN__)
322#if PORT_CORES_NUMBER > 1
339#if PORT_SUPPORTS_RT == TRUE
430 (
currcore->rlist.current->hdr.pqueue.prio >=
currcore->rlist.pqueue.next->prio),
431 "priority order violation");
479#if (CH_PORT_SUPPORTS_RECURSIVE_LOCKS == TRUE) || defined(__DOXYGEN__)
513#if (CH_CFG_SMP_MODE == TRUE) || defined(__DOXYGEN__)
523 port_notify_instance(oip);
#define chDbgAssert(c, r)
Condition assertion.
#define __dbg_check_unlock()
#define __dbg_check_suspend()
#define __dbg_check_lock()
#define __dbg_check_disable()
#define __dbg_check_enable()
#define __dbg_check_unlock_from_isr()
#define __dbg_check_lock_from_isr()
struct ch_system ch_system_t
Type of system data structure.
struct ch_os_instance os_instance_t
Type of an OS instance structure.
struct ch_os_instance_config os_instance_config_t
Type of an system instance configuration.
system_state_t
Global state of the operating system.
struct ch_thread thread_t
Type of a thread structure.
static void port_unlock_from_isr(void)
Kernel-unlock action from an interrupt handler.
static void port_disable(void)
Disables all the interrupt sources.
static void port_lock_from_isr(void)
Kernel-lock action from an interrupt handler.
static void port_enable(void)
Enables all the interrupt sources.
static void port_lock(void)
Kernel-lock action.
#define port_get_lock_status()
Returns a word representing a critical section status.
#define port_is_locked(sts)
Determines if in a critical section.
static void port_suspend(void)
Disables the interrupt sources below kernel-level priority.
static void port_unlock(void)
Kernel-unlock action.
void __stats_stop_measure_crit_isr(void)
Stops the measurement of an ISR critical zone.
void __stats_start_measure_crit_isr(void)
Starts the measurement of an ISR critical zone.
void __stats_stop_measure_crit_thd(void)
Stops the measurement of a thread critical zone.
void __stats_start_measure_crit_thd(void)
Starts the measurement of a thread critical zone.
static void chSysSuspend(void)
Raises the system interrupt priority mask to system level.
syssts_t chSysGetStatusAndLockX(void)
Returns the execution status and enters a critical zone.
CH_SYS_CORE1_MEMORY os_instance_t ch1
Core 1 OS instance.
bool chSysIsCounterWithinX(rtcnt_t cnt, rtcnt_t start, rtcnt_t end)
Realtime window test.
void chSysTimerHandlerI(void)
Handles time ticks for round robin preemption and timer increments.
CH_SYS_CORE0_MEMORY os_instance_t ch0
Core 0 OS instance.
bool chSysIntegrityCheckI(unsigned testmask)
System integrity check.
thread_t * chSysGetIdleThreadX(void)
Returns a pointer to the idle thread.
static void chSysUnlockFromISR(void)
Leaves the kernel lock state from within an interrupt handler.
static void chSysLock(void)
Enters the kernel lock state.
void chSysPolledDelayX(rtcnt_t cycles)
Polled delay.
const os_instance_config_t ch_core0_cfg
Core 0 OS instance configuration.
void chSysWaitSystemState(system_state_t state)
Waits for the system state to be equal to the specified one.
const os_instance_config_t ch_core1_cfg
Core 1 OS instance configuration.
static void chSysDisable(void)
Raises the system interrupt priority mask to the maximum level.
static void chSysUnconditionalLock(void)
Unconditionally enters the kernel lock state.
void chSysRestoreStatusX(syssts_t sts)
Restores the specified execution status and leaves a critical zone.
#define currcore
Access to current core's instance structure.
static void chSysLockFromISR(void)
Enters the kernel lock state from within an interrupt handler.
static void chSysEnable(void)
Lowers the system interrupt priority mask to user level.
static void chSysUnlock(void)
Leaves the kernel lock state.
static void chSysUnconditionalUnlock(void)
Unconditionally leaves the kernel lock state.
static void chSysNotifyInstance(os_instance_t *oip)
Notifies an OS instance to check for reschedule.
void chSysInit(void)
System initialization.
Type of system data structure.