ChibiOS/RT  5.1.0
chsys.h File Reference

System related macros and structures. More...

Go to the source code of this file.

Macros

#define chSysGetRealtimeCounterX()   (rtcnt_t)port_rt_get_counter_value()
 Returns the current value of the system real time counter. More...
 
#define chSysSwitch(ntp, otp)
 Performs a context switch. More...
 
Masks of executable integrity checks.
#define CH_INTEGRITY_RLIST   1U
 
#define CH_INTEGRITY_VTLIST   2U
 
#define CH_INTEGRITY_REGISTRY   4U
 
#define CH_INTEGRITY_PORT   8U
 
ISRs abstraction macros
#define CH_IRQ_IS_VALID_PRIORITY(prio)   PORT_IRQ_IS_VALID_PRIORITY(prio)
 Priority level validation macro. More...
 
#define CH_IRQ_IS_VALID_KERNEL_PRIORITY(prio)   PORT_IRQ_IS_VALID_KERNEL_PRIORITY(prio)
 Priority level validation macro. More...
 
#define CH_IRQ_PROLOGUE()
 IRQ handler enter code. More...
 
#define CH_IRQ_EPILOGUE()
 IRQ handler exit code. More...
 
#define CH_IRQ_HANDLER(id)   PORT_IRQ_HANDLER(id)
 Standard normal IRQ handler declaration. More...
 
Fast ISRs abstraction macros
#define CH_FAST_IRQ_HANDLER(id)   PORT_FAST_IRQ_HANDLER(id)
 Standard fast IRQ handler declaration. More...
 
Time conversion utilities for the realtime counter
#define S2RTC(freq, sec)   ((freq) * (sec))
 Seconds to realtime counter. More...
 
#define MS2RTC(freq, msec)   (rtcnt_t)((((freq) + 999UL) / 1000UL) * (msec))
 Milliseconds to realtime counter. More...
 
#define US2RTC(freq, usec)   (rtcnt_t)((((freq) + 999999UL) / 1000000UL) * (usec))
 Microseconds to realtime counter. More...
 
#define RTC2S(freq, n)   ((((n) - 1UL) / (freq)) + 1UL)
 Realtime counter cycles to seconds. More...
 
#define RTC2MS(freq, n)   ((((n) - 1UL) / ((freq) / 1000UL)) + 1UL)
 Realtime counter cycles to milliseconds. More...
 
#define RTC2US(freq, n)   ((((n) - 1UL) / ((freq) / 1000000UL)) + 1UL)
 Realtime counter cycles to microseconds. More...
 

Functions

void chSysInit (void)
 ChibiOS/RT initialization. More...
 
bool chSysIntegrityCheckI (unsigned testmask)
 System integrity check. More...
 
void chSysTimerHandlerI (void)
 Handles time ticks for round robin preemption and timer increments. More...
 
syssts_t chSysGetStatusAndLockX (void)
 Returns the execution status and enters a critical zone. More...
 
void chSysRestoreStatusX (syssts_t sts)
 Restores the specified execution status and leaves a critical zone. More...
 
bool chSysIsCounterWithinX (rtcnt_t cnt, rtcnt_t start, rtcnt_t end)
 Realtime window test. More...
 
void chSysPolledDelayX (rtcnt_t cycles)
 Polled delay. More...
 
static void chSysDisable (void)
 Raises the system interrupt priority mask to the maximum level. More...
 
static void chSysSuspend (void)
 Raises the system interrupt priority mask to system level. More...
 
static void chSysEnable (void)
 Lowers the system interrupt priority mask to user level. More...
 
static void chSysLock (void)
 Enters the kernel lock state. More...
 
static void chSysUnlock (void)
 Leaves the kernel lock state. More...
 
static void chSysLockFromISR (void)
 Enters the kernel lock state from within an interrupt handler. More...
 
static void chSysUnlockFromISR (void)
 Leaves the kernel lock state from within an interrupt handler. More...
 
static void chSysUnconditionalLock (void)
 Unconditionally enters the kernel lock state. More...
 
static void chSysUnconditionalUnlock (void)
 Unconditionally leaves the kernel lock state. More...
 
static thread_tchSysGetIdleThreadX (void)
 Returns a pointer to the idle thread. More...
 

Detailed Description

System related macros and structures.

Definition in file chsys.h.