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
340#if PORT_SUPPORTS_RT == TRUE
431 (
currcore->rlist.current->hdr.pqueue.prio >=
currcore->rlist.pqueue.next->prio),
432 "priority order violation");
480#if (CH_PORT_SUPPORTS_RECURSIVE_LOCKS == TRUE) || defined(__DOXYGEN__)
514#if (CH_CFG_SMP_MODE == TRUE) || defined(__DOXYGEN__)
524 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.