|
Nil RTOS
|
Classes | |
| struct | port_extctx |
| Interrupt saved context. More... | |
| struct | port_intctx |
| System saved context. More... | |
Macros | |
| #define | NIL_WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)] |
| Static working area allocation. More... | |
| #define | port_disable() asm volatile ("cli" : : : "memory") |
| Disables all the interrupt sources. | |
| #define | port_enable() asm volatile ("sei" : : : "memory") |
| Enables all the interrupt sources. | |
| #define | port_init() |
| Port-related initialization code. More... | |
| #define | PORT_INT_REQUIRED_STACK 32 |
| Per-thread stack overhead for interrupts servicing. More... | |
| #define | PORT_IRQ_EPILOGUE() |
| IRQ epilogue code. More... | |
| #define | PORT_IRQ_HANDLER(id) ISR(id) |
| IRQ handler function declaration. More... | |
| #define | PORT_IRQ_PROLOGUE() |
| IRQ prologue code. More... | |
| #define | port_lock() asm volatile ("cli" : : : "memory") |
| Kernel-lock action. More... | |
| #define | port_lock_from_isr() |
| Kernel-lock action from an interrupt handler. More... | |
| #define | port_suspend() asm volatile ("cli" : : : "memory") |
| Disables the interrupt sources below kernel-level priority. | |
| #define | port_switch(ntp, otp) _port_switch(ntp, otp) |
| Performs a context switch between two threads. More... | |
| #define | PORT_THREAD(tname, arg) __attribute__((noreturn)) void tname(void *arg) |
| Thread declaration macro optimized for GCC. | |
| #define | port_unlock() asm volatile ("sei" : : : "memory") |
| Kernel-unlock action. More... | |
| #define | port_unlock_from_isr() |
| Kernel-unlock action from an interrupt handler. More... | |
| #define | port_wait_for_interrupt() asm volatile ("sleep" : : : "memory") |
| Enters an architecture-dependent IRQ-waiting mode. More... | |
| #define | SETUP_CONTEXT(tp, workspace, wsize, pf, arg) |
| Platform dependent context creation for new threads. More... | |
| #define | STACK_ALIGN(n) ((((n) - 1) | (sizeof(stkalign_t) - 1)) + 1) |
| Enforces a correct alignment for a stack area size value. | |
| #define | THD_WA_SIZE(n) |
| Computes the thread working area global size. | |
Typedefs | |
| typedef uint8_t | stkalign_t |
| Stack and memory alignment enforcement. | |
Functions | |
| void | _port_switch (thread_t *ntp, thread_t *otp) |
| Performs a context switch between two threads. More... | |
| void | _port_thread_start (void) |
| Start a thread by invoking its work function. More... | |
| void | boardInit (void) |
| NIL_IRQ_HANDLER (TIMER0_COMPA_vect) | |
| void | port_halt (void) |
| Halts the system. More... | |
| #define NIL_WORKING_AREA | ( | s, | |
| n | |||
| ) | stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)] |
Static working area allocation.
This macro is used to allocate a static thread working area aligned as both position and size.
| #define port_init | ( | ) |
Port-related initialization code.
| #define PORT_INT_REQUIRED_STACK 32 |
Per-thread stack overhead for interrupts servicing.
This constant is used in the calculation of the correct working area size.
| #define PORT_IRQ_EPILOGUE | ( | ) |
IRQ epilogue code.
This macro must be inserted at the end of all IRQ handlers enabled to invoke system APIs.
| #define PORT_IRQ_HANDLER | ( | id | ) | ISR(id) |
IRQ handler function declaration.
id can be a function name or a vector number depending on the port implementation. | #define PORT_IRQ_PROLOGUE | ( | ) |
IRQ prologue code.
This macro must be inserted at the start of all IRQ handlers enabled to invoke system APIs.
| #define port_lock | ( | ) | asm volatile ("cli" : : : "memory") |
Kernel-lock action.
Usually this function just disables interrupts but may perform more actions.
| #define port_lock_from_isr | ( | ) |
Kernel-lock action from an interrupt handler.
This function is invoked before invoking I-class APIs from interrupt handlers. The implementation is architecture dependent, in its simplest form it is void.
port_lock() in this port. | #define port_switch | ( | ntp, | |
| otp | |||
| ) | _port_switch(ntp, otp) |
Performs a context switch between two threads.
This is the most critical code in any port, this function is responsible for the context switch between 2 threads.
| [in] | ntp | the thread to be switched in |
| [in] | otp | the thread to be switched out |
| #define port_unlock | ( | ) | asm volatile ("sei" : : : "memory") |
Kernel-unlock action.
Usually this function just enables interrupts but may perform more actions.
| #define port_unlock_from_isr | ( | ) |
Kernel-unlock action from an interrupt handler.
This function is invoked after invoking I-class APIs from interrupt handlers. The implementation is architecture dependent, in its simplest form it is void.
port_lock() in this port. | #define port_wait_for_interrupt | ( | ) | asm volatile ("sleep" : : : "memory") |
Enters an architecture-dependent IRQ-waiting mode.
The function is meant to return when an interrupt becomes pending. The simplest implementation is an empty function or macro but this would not take advantage of architecture-specific power saving modes.
WFI instruction. | #define SETUP_CONTEXT | ( | tp, | |
| workspace, | |||
| wsize, | |||
| pf, | |||
| arg | |||
| ) |
Platform dependent context creation for new threads.
This code usually setup the context switching frame represented by an intctx structure.
Performs a context switch between two threads.
This is the most critical code in any port, this function is responsible for the context switch between 2 threads.
| [in] | ntp | the thread to be switched in |
| [in] | otp | the thread to be switched out |
| void _port_thread_start | ( | void | ) |
Start a thread by invoking its work function.
If the work function returns chThdExit() is automatically invoked.
| void boardInit | ( | void | ) |
Board-specific initialization code for Arduino. Use timer 0 compare A to geneate an interrupt every 1024 usec.
| NIL_IRQ_HANDLER | ( | TIMER0_COMPA_vect | ) |
System time ISR.
| void port_halt | ( | void | ) |
Halts the system.
This function is invoked by the operating system when an unrecoverable error is detected (for example because a programming error in the application code that triggers an assertion while in debug mode).
1.8.6