ChibiOS/RT Architecture - Reference Manual - Guides |
System related APIs and services:
Defines | |
#define | chSysHalt() port_halt() |
Halts the system. | |
#define | chSysSwitchI(ntp, otp) port_switch(ntp, otp) |
Performs a context switch. | |
#define | chSysDisable() port_disable() |
Raises the system interrupt priority mask to the maximum level. | |
#define | chSysSuspend() port_suspend() |
Raises the system interrupt priority mask to system level. | |
#define | chSysEnable() port_enable() |
Lowers the system interrupt priority mask to user level. | |
#define | chSysLock() |
Enters the kernel lock mode. | |
#define | chSysUnlock() |
Leaves the kernel lock mode. | |
#define | chSysLockFromIsr() port_lock_from_isr() |
Enters the kernel lock mode from within an interrupt handler. | |
#define | chSysUnlockFromIsr() port_unlock_from_isr() |
Leaves the kernel lock mode from within an interrupt handler. | |
#define | CH_IRQ_PROLOGUE() PORT_IRQ_PROLOGUE() |
IRQ handler enter code. | |
#define | CH_IRQ_EPILOGUE() PORT_IRQ_EPILOGUE() |
IRQ handler exit code. | |
#define | CH_IRQ_HANDLER(id) PORT_IRQ_HANDLER(id) |
Standard normal IRQ handler declaration. | |
#define | CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id) |
Standard fast IRQ handler declaration. | |
Functions | |
void | chSysInit (void) |
ChibiOS/RT initialization. | |
void | chSysTimerHandlerI (void) |
Handles time ticks for round robin preemption and timer increments. |
#define chSysHalt | ( | ) | port_halt() |
Halts the system.
This function is invoked by the operating system when an unrecoverable error is detected, as example because a programming error in the application code that triggers an assertion while in debug mode.
Definition at line 45 of file chsys.h.
Referenced by chDbgPanic().
#define chSysSwitchI | ( | ntp, | ||
otp | ||||
) | port_switch(ntp, otp) |
Performs a context switch.
[in] | ntp | the thread to be switched in |
[in] | otp | the thread to be switched out |
Definition at line 53 of file chsys.h.
Referenced by chSchDoRescheduleI(), chSchGoSleepS(), and chSchWakeupS().
#define chSysDisable | ( | ) | port_disable() |
Raises the system interrupt priority mask to the maximum level.
All the maskable interrupt sources are disabled regardless their hardware priority.
chSysDisable()
. #define chSysSuspend | ( | ) | port_suspend() |
Raises the system interrupt priority mask to system level.
The interrupt sources that should not be able to preempt the kernel are disabled, interrupt sources with higher priority are still enabled.
chSysLock()
, the chSysLock()
could do more than just disable the interrupts. #define chSysEnable | ( | ) | port_enable() |
Lowers the system interrupt priority mask to user level.
All the interrupt sources are enabled.
chSysUnlock()
, the chSysUnlock()
could do more than just enable the interrupts. Definition at line 87 of file chsys.h.
Referenced by chSysInit().
#define chSysLock | ( | ) |
Enters the kernel lock mode.
Definition at line 97 of file chsys.h.
Referenced by adcStart(), adcStartConversion(), adcStop(), adcStopConversion(), adcWaitConversion(), canGetAndClearFlags(), canReceive(), canSleep(), canStart(), canStop(), canTransmit(), canWakeup(), chCondBroadcast(), chCondSignal(), chCondWait(), chCondWaitTimeout(), chCoreAlloc(), chEvtBroadcast(), chEvtClear(), chEvtPend(), chEvtRegisterMask(), chEvtSignal(), chEvtUnregister(), chEvtWaitAll(), chEvtWaitAllTimeout(), chEvtWaitAny(), chEvtWaitAnyTimeout(), chEvtWaitOne(), chEvtWaitOneTimeout(), chIQGetTimeout(), chIQReadTimeout(), chMBFetch(), chMBPost(), chMBPostAhead(), chMBReset(), chMsgGet(), chMsgRelease(), chMsgSend(), chMsgWait(), chMtxLock(), chMtxTryLock(), chMtxUnlock(), chMtxUnlockAll(), chOQPutTimeout(), chOQWriteTimeout(), chPoolAlloc(), chPoolFree(), chRegFirstThread(), chRegNextThread(), chSemReset(), chSemSignal(), chSemSignalWait(), chSemWait(), chSemWaitTimeout(), chThdAddRef(), chThdCreateFromHeap(), chThdCreateFromMemoryPool(), chThdCreateStatic(), chThdExit(), chThdRelease(), chThdResume(), chThdSetPriority(), chThdSleep(), chThdSleepUntil(), chThdTerminate(), chThdWait(), chThdYield(), chibios_rt::System::Lock(), macWaitReceiveDescriptor(), macWaitTransmitDescriptor(), mmcConnect(), mmcDisconnect(), mmcSequentialRead(), mmcSequentialWrite(), mmcStart(), mmcStartSequentialRead(), mmcStartSequentialWrite(), mmcStop(), mmcStopSequentialRead(), mmcStopSequentialWrite(), pwmDisableChannel(), pwmEnableChannel(), pwmStart(), pwmStop(), sdGetAndClearFlags(), sdStart(), sdStop(), spiSelect(), spiStart(), spiStop(), and spiUnselect().
#define chSysUnlock | ( | ) |
{ \ if (--currp->p_locks == 0) \ port_unlock(); \ }
Leaves the kernel lock mode.
Definition at line 114 of file chsys.h.
Referenced by adcStart(), adcStartConversion(), adcStop(), adcStopConversion(), adcWaitConversion(), canGetAndClearFlags(), canReceive(), canSleep(), canStart(), canStop(), canTransmit(), canWakeup(), chCondBroadcast(), chCondSignal(), chCondWait(), chCondWaitTimeout(), chCoreAlloc(), chEvtBroadcast(), chEvtClear(), chEvtPend(), chEvtRegisterMask(), chEvtSignal(), chEvtUnregister(), chEvtWaitAll(), chEvtWaitAllTimeout(), chEvtWaitAny(), chEvtWaitAnyTimeout(), chEvtWaitOne(), chEvtWaitOneTimeout(), chIQGetTimeout(), chIQReadTimeout(), chMBFetch(), chMBPost(), chMBPostAhead(), chMBReset(), chMsgGet(), chMsgRelease(), chMsgSend(), chMsgWait(), chMtxLock(), chMtxTryLock(), chMtxUnlock(), chMtxUnlockAll(), chOQPutTimeout(), chOQWriteTimeout(), chPoolAlloc(), chPoolFree(), chRegFirstThread(), chRegNextThread(), chSemReset(), chSemSignal(), chSemSignalWait(), chSemWait(), chSemWaitTimeout(), chThdAddRef(), chThdCreateFromHeap(), chThdCreateFromMemoryPool(), chThdCreateStatic(), chThdRelease(), chThdResume(), chThdSetPriority(), chThdSleep(), chThdSleepUntil(), chThdTerminate(), chThdWait(), chThdYield(), macWaitReceiveDescriptor(), macWaitTransmitDescriptor(), mmcConnect(), mmcDisconnect(), mmcSequentialRead(), mmcSequentialWrite(), mmcStart(), mmcStartSequentialRead(), mmcStartSequentialWrite(), mmcStop(), mmcStopSequentialRead(), mmcStopSequentialWrite(), pwmDisableChannel(), pwmEnableChannel(), pwmStart(), pwmStop(), sdGetAndClearFlags(), sdStart(), sdStop(), spiSelect(), spiStart(), spiStop(), spiUnselect(), and chibios_rt::System::Unlock().
#define chSysLockFromIsr | ( | ) | port_lock_from_isr() |
Enters the kernel lock mode from within an interrupt handler.
Definition at line 133 of file chsys.h.
Referenced by CH_IRQ_HANDLER().
#define chSysUnlockFromIsr | ( | ) | port_unlock_from_isr() |
Leaves the kernel lock mode from within an interrupt handler.
Definition at line 146 of file chsys.h.
Referenced by CH_IRQ_HANDLER().
#define CH_IRQ_PROLOGUE | ( | ) | PORT_IRQ_PROLOGUE() |
IRQ handler enter code.
Definition at line 153 of file chsys.h.
Referenced by CH_IRQ_HANDLER().
#define CH_IRQ_EPILOGUE | ( | ) | PORT_IRQ_EPILOGUE() |
IRQ handler exit code.
chSchRescRequiredI()
and chSchDoRescheduleI()
. Definition at line 161 of file chsys.h.
Referenced by CH_IRQ_HANDLER().
#define CH_IRQ_HANDLER | ( | id | ) | PORT_IRQ_HANDLER(id) |
#define CH_FAST_IRQ_HANDLER | ( | id | ) | PORT_FAST_IRQ_HANDLER(id) |
void chSysInit | ( | void | ) |
ChibiOS/RT initialization.
After executing this function the current instructions stream becomes the main thread.
chSysInit()
is invoked and are internally enabled. NORMALPRIO
. Definition at line 73 of file chsys.c.
References chSysEnable, chThdCreateStatic(), core_init(), currp, heap_init(), IDLEPRIO, init_thread(), NORMALPRIO, port_init(), scheduler_init(), setcurrp, trace_init(), and vt_init().
Referenced by chibios_rt::System::Init().
void chSysTimerHandlerI | ( | void | ) |
Handles time ticks for round robin preemption and timer increments.
Decrements the remaining time quantum of the running thread and preempts it when the quantum is used up. Increments system time and manages the timers.
CH_TIME_QUANTUM
macro, the round robin interval. Definition at line 111 of file chsys.c.
References chVTDoTickI, currp, and rlist.
Referenced by CH_IRQ_HANDLER().