|
Nil RTOS
|
Nil RTOS main header file. More...


Classes | |
| struct | nil_system_t |
| System data structure. More... | |
| struct | nil_thread |
| Structure representing a thread. More... | |
| struct | nil_thread_cfg |
| Structure representing a thread static configuration. More... | |
| struct | semaphore_t |
| Type of a structure representing a counting semaphore. More... | |
Macros | |
| #define | NIL_DBG_ENABLED FALSE |
| System timer resolution in Hz. More... | |
Nil RTOS identification | |
| #define | _NIL_ |
| Nil RTOS identification. | |
| #define | NIL_KERNEL_VERSION "0.0.1" |
| Kernel version string. | |
| #define | NIL_KERNEL_MAJOR 0 |
| Version major number. | |
| #define | NIL_KERNEL_MINOR 0 |
| Version minor number. | |
| #define | NIL_KERNEL_PATCH 1 |
| Version patch number. | |
Common constants | |
| #define | FALSE 0 |
| Generic 'false' boolean constant. | |
| #define | TRUE !FALSE |
| Generic 'true' boolean constant. | |
Wakeup status codes | |
| #define | NIL_MSG_OK 0 |
| Normal wakeup message. | |
| #define | NIL_MSG_TMO -1 |
| Wake-up caused by a timeout condition. | |
| #define | NIL_MSG_RST -2 |
| Wake-up caused by a reset condition. | |
Special time constants | |
| #define | TIME_IMMEDIATE ((systime_t)-1) |
| Zero time specification for some functions with a timeout specification. More... | |
| #define | TIME_INFINITE ((systime_t)0) |
| Infinite time specification for all functions with a timeout specification. | |
Thread state related macros | |
| #define | NIL_THD_READY 0 |
| Thread ready or executing. | |
| #define | NIL_THD_SLEEPING 1 |
| Thread sleeping. | |
| #define | NIL_THD_SUSP 2 |
| Thread suspended. | |
| #define | NIL_THD_WTSEM 3 |
| Thread waiting on semaphore. | |
| #define | NIL_THD_IS_READY(tr) ((tr)->state == NIL_THD_READY) |
| #define | NIL_THD_IS_SLEEPING(tr) ((tr)->state == NIL_THD_SLEEPING) |
| #define | NIL_THD_IS_SUSP(tr) ((tr)->state == NIL_THD_SUSP) |
| #define | NIL_THD_IS_WTSEM(tr) ((tr)->state == NIL_THD_WTSEM) |
Threads tables definition macros | |
| #define | NIL_THREADS_TABLE_BEGIN() const thread_config_t nil_thd_configs[] = { |
| Start of user threads table. | |
| #define | NIL_THREADS_TABLE_ENTRY(name, funcp, arg, wap, size) {name, funcp, arg, wap, size}, |
| Entry of user threads table. | |
| #define | NIL_THREADS_TABLE_END() |
| End of user threads table. | |
Macro Functions | |
| #define | nilSysHalt() port_halt() |
| System halt state. | |
| #define | nilSysDisable() port_disable() |
| Enters the kernel lock mode. More... | |
| #define | nilSysEnable() port_enable() |
| Enters the kernel lock mode. More... | |
| #define | nilSysLock() port_lock() |
| Enters the kernel lock mode. More... | |
| #define | nilSysUnlock() port_unlock() |
| Leaves the kernel lock mode. More... | |
| #define | nilSysLockFromISR() port_lock_from_isr() |
| Enters the kernel lock mode from within an interrupt handler. More... | |
| #define | nilSysUnlockFromISR() port_unlock_from_isr() |
| Leaves the kernel lock mode from within an interrupt handler. More... | |
| #define | nilThdSleepSeconds(sec) nilThdSleep(S2ST(sec)) |
| Delays the invoking thread for the specified number of seconds. More... | |
| #define | nilThdSleepMilliseconds(msec) nilThdSleep(MS2ST(msec)) |
| Delays the invoking thread for the specified number of milliseconds. More... | |
| #define | nilThdSleepMicroseconds(usec) nilThdSleep(US2ST(usec)) |
| Delays the invoking thread for the specified number of microseconds. More... | |
| #define | nilThdSleepS(timeout) nilSchGoSleepTimeoutS(NIL_THD_SLEEPING, timeout) |
| Suspends the invoking thread for the specified time. More... | |
| #define | nilThdSleepUntilS(time) nilSchGoSleepTimeoutS(NIL_THD_SLEEPING, (time) - nilTimeNowI()) |
| Suspends the invoking thread until the system time arrives to the specified value. More... | |
| #define | nilSemInit(sp, n) ((sp)->cnt = n) |
| Initializes a semaphore with the specified counter value. More... | |
| #define | nilSemWait(sp) nilSemWaitTimeout(sp, TIME_INFINITE) |
| Performs a wait operation on a semaphore. More... | |
| #define | nilSemWaitS(sp) nilSemWaitTimeoutS(sp, TIME_INFINITE) |
| Performs a wait operation on a semaphore. More... | |
| #define | nilTimeNowI() (nil.systime) |
| Current system time. More... | |
| #define | nilTimeIsWithin(time, start, end) |
| Checks if the specified time is within the specified time window. More... | |
Threads abstraction macros | |
| #define | NIL_THREAD(tname, arg) PORT_THREAD(tname, arg) |
| Thread declaration macro. More... | |
| #define | nilDbgAssert(c, m, r) {(void)(c);} |
ISRs abstraction macros | |
| #define | NIL_IRQ_PROLOGUE() PORT_IRQ_PROLOGUE() |
| IRQ handler enter code. More... | |
| #define | NIL_IRQ_EPILOGUE() PORT_IRQ_EPILOGUE() |
| IRQ handler exit code. More... | |
| #define | NIL_IRQ_HANDLER(id) PORT_IRQ_HANDLER(id) |
| Standard normal IRQ handler declaration. More... | |
Fast ISRs abstraction macros | |
| #define | NIL_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id) |
| Standard fast IRQ handler declaration. More... | |
Time conversion utilities | |
| #define | S2ST(sec) ((systime_t)((sec) * NIL_CFG_FREQUENCY)) |
| Seconds to system ticks. More... | |
| #define | MS2ST(msec) |
| Milliseconds to system ticks. More... | |
| #define | US2ST(usec) |
| Microseconds to system ticks. More... | |
Typedefs | |
| typedef struct port_intctx | intctx_t |
| Type of internal context structure. | |
| typedef void(* | tfunc_t )(void *) |
| Thread function. | |
| typedef struct nil_thread_cfg | thread_config_t |
| Type of a structure representing a thread static configuration. | |
| typedef thread_t * | thread_ref_t |
| Type of a thread reference. | |
| typedef struct nil_thread | thread_t |
| Type of a structure representing a thread. | |
Functions | |
| msg_t | nilSchGoSleepTimeoutS (tstate_t newstate, systime_t timeout) |
| Puts the current thread to sleep into the specified state with timeout specification. More... | |
| thread_ref_t | nilSchReadyI (thread_ref_t tr, msg_t msg) |
| Makes the specified thread ready for execution. More... | |
| void | nilSchRescheduleS () |
| Reschedules. More... | |
| void | nilSemReset (semaphore_t *sp, cnt_t n) |
| Performs a reset operation on the semaphore. More... | |
| void | nilSemResetI (semaphore_t *sp, cnt_t n) |
| Performs a reset operation on the semaphore. More... | |
| void | nilSemSignal (semaphore_t *sp) |
| Performs a signal operation on a semaphore. More... | |
| void | nilSemSignalI (semaphore_t *sp) |
| Performs a signal operation on a semaphore. More... | |
| msg_t | nilSemWaitTimeout (semaphore_t *sp, systime_t timeout) |
| Performs a wait operation on a semaphore with timeout specification. More... | |
| msg_t | nilSemWaitTimeoutS (semaphore_t *sp, systime_t timeout) |
| Performs a wait operation on a semaphore with timeout specification. More... | |
| void | nilSysInit (void) |
| Initializes the kernel. More... | |
| void | nilSysTimerHandlerI (void) |
| Time management handler. More... | |
| void | nilThdResumeI (thread_ref_t *trp, msg_t msg) |
| Wakes up a thread waiting on a thread reference object. More... | |
| void | nilThdSleep (systime_t time) |
| Suspends the invoking thread for the specified time. More... | |
| void | nilThdSleepUntil (systime_t time) |
| Suspends the invoking thread until the system time arrives to the specified value. More... | |
| msg_t | nilThdSuspendTimeoutS (thread_ref_t *trp, systime_t timeout) |
| Sends the current thread sleeping and sets a reference variable. More... | |
| systime_t | nilTimeNow (void) |
| Current system time. More... | |
| bool | nilTimeNowIsWithin (systime_t start, systime_t end) |
| Checks if the current system time is within the specified time window. More... | |
Variables | |
| nil_system_t | nil |
| System variables. | |
| const thread_config_t | nil_thd_configs [] |
| const uint8_t | nil_thd_count |
Nil RTOS main header file.
This header includes all the required kernel headers so it is the only header you usually need to include in your application.
1.8.6