Nil RTOS
Macros | Functions
Arduino

Macros

#define NIL_RTOS_VERSION   20140816
 
#define nilIsIdleThread()   (nil.current == nil.idlep)
 Returns true if current thread is the idle thread.
 
#define nilSemFastSignalI(sp)   ((sp)->cnt++)
 Increases the semaphore counter. More...
 
#define nilSemFastWaitI(sp)   ((sp)->cnt--)
 Decreases the semaphore counter. More...
 
#define nilSemGetCounterI(sp)   ((sp)->cnt)
 Returns the semaphore counter current value. More...
 
#define nilThdDelayMilliseconds(msec)   nilThdDelay(MS2ST(msec))
 Delays the invoking thread for the specified number of milliseconds. More...
 
#define SEMAPHORE_DECL(name, n)   semaphore_t name = {n}
 Static semaphore initializer. More...
 

Functions

void boardInit ()
 
static void fill8 (uint8_t *bgn, uint8_t *end)
 
static void nilFillStacks ()
 
void nilPrintStackSizes (Print *pr)
 
void nilPrintUnusedStack (Print *pr)
 
cnt_t nilSemGetCounter (semaphore_t *sp)
 Returns the semaphore counter current value. More...
 
bool nilSysBegin ()
 
bool nilSysBeginNoFill ()
 
void nilThdDelay (systime_t time)
 Delay the invoking thread for the specified time. More...
 
void nilThdDelayUntil (systime_t time)
 Delay the invoking thread until the system time reaches to the specified value. More...
 
size_t nilUnusedHeapIdle ()
 
size_t nilUnusedStack (uint8_t nt)
 

Detailed Description

Arduino Nil RTOS library.

Macro Definition Documentation

#define NIL_RTOS_VERSION   20140816

NilRTOS version YYYYMMDD

#define nilSemFastSignalI (   sp)    ((sp)->cnt++)

Increases the semaphore counter.

This macro can be used when the counter is known to be not negative.

#define nilSemFastWaitI (   sp)    ((sp)->cnt--)

Decreases the semaphore counter.

This macro can be used when the counter is known to be positive.

#define nilSemGetCounterI (   sp)    ((sp)->cnt)

Returns the semaphore counter current value.

#define nilThdDelayMilliseconds (   msec)    nilThdDelay(MS2ST(msec))

Delays the invoking thread for the specified number of milliseconds.

Note
This function does not sleep and will block all lower priority threads. This function should only be used in the idle thread.
The specified time is rounded up to a value allowed by the real system clock.
The maximum specified value is implementation dependent.
Parameters
[in]msectime in milliseconds, must be different from zero
#define SEMAPHORE_DECL (   name,
 
)    semaphore_t name = {n}

Static semaphore initializer.

Statically initialized semaphores require no explicit initialization using nilSemInit().

Parameters
[in]namethe name of the semaphore variable
[in]nthe counter initial value, this value must be non-negative

Function Documentation

void boardInit ( void  )

Board-specific initialization code for Arduino. Use timer 0 compare A to geneate an interrupt every 1024 usec.

static void nilFillStacks ( )
static

Fill stacks with 0X55.

void nilPrintStackSizes ( Print *  pr)

Print size of all all stacks.

Parameters
[in]prPrint stream for output.
void nilPrintUnusedStack ( Print *  pr)

Print unused byte count for all stacks.

Parameters
[in]prPrint stream for output.
cnt_t nilSemGetCounter ( semaphore_t sp)

Returns the semaphore counter current value.

Parameters
[in]sppointer to a Semaphore structure.
Returns
the value of the semaphore counter.
bool nilSysBegin ( )

Start Nil RTOS with all stack memory initialized to a known value.

Returns
TRUE for success else FALSE.
bool nilSysBeginNoFill ( )

Start Nil RTOS with raw uninitialized stack memory. This call saves a little flash compared to nilSysBegin().

Returns
TRUE for success else FALSE.
void nilThdDelay ( systime_t  time)

Delay the invoking thread for the specified time.

Parameters
[in]timethe delay in system ticks.
Note
This function does not sleep and will block all lower priority threads. This function should only be used in the idle thread.
void nilThdDelayUntil ( systime_t  time)

Delay the invoking thread until the system time reaches to the specified value.

Parameters
[in]timeabsolute system time
Note
This function does not sleep and will block all lower priority threads. This function should only be used in the idle thread.
size_t nilUnusedHeapIdle ( )

Determine unused bytes in the heap and idle yhread stack area.

Returns
Number of unused bytes.
size_t nilUnusedStack ( uint8_t  nt)

Determine unused stack for a thread.

Parameters
[in]ntTask index.
Returns
Number of unused stack bytes.