NetBurner 3.5.0
PDF Version
 
nbrtos.h File Reference

NetBurner Real-Time Operating System (NBRTOS) API. More...

#include <predef.h>
#include <constants.h>
#include <basictypes.h>
#include <nbrtoscpu.h>

Go to the source code of this file.

Classes

class  TickTimeout
 TickTimeout objects are used to facilitate sequential function calls with timeout parameters that need to indexed from an initial start time, and to prevent TimeTick rollover errors. More...
 
struct  OS_SEM
 Semaphores are used to control access to shared resources or or to communicate between tasks in a multithreaded system or with interrupt service routines. Semaphores can be 0 or 1, or they can be counting semaphores that increment and decreement based on calls to Pend() and Post() functions. More...
 
struct  OS_MBOX
 Mailboxes single value storage locations used to communicate between tasks. More...
 
struct  OS_Q
 A message queue is an object that enables tasks and interrupt service routines to pend and post pointer sized messages. The pointer values typically point to some type of object or structure that contains the actual message or data. A queue functions as a fixed size First In First Out (FIFO) storage for 32-bit void pointers that can be used for communication between tasks. More...
 
struct  TEMPL_Q< T >
 A convenience wrapper around OS_Q. More...
 
struct  os_fifo_el
 OS_FIFO element definition. More...
 
struct  OS_FIFO
 
struct  OS_CRIT
 An OS_CRIT object is used to establish critical sections of code that can only be run by one task at a time. Tasks that try to claim a critical section which is currently claimed by another task will stop and wait for that task to release the critical section before continuing execution. More...
 
struct  OS_FLAGS
 OSFlags enables a function or task to pend on multiple flags or events. More...
 
class  OSLockObj
 A simple wrapper class that helps use OS locks effectively. More...
 
class  OSCriticalSectionObj
 A simple wrapper class that helps utilize OS_CRIT objects more effectively. More...
 
class  OSLockAndCritObj
 A simple wrapper class that helps utilize OS_CRIT objects to lock tasks and enter critical sections more effectively. More...
 
class  OSSpinCrit
 A simple wrapper class that uses an OS_CRIT object to try and claim a critical section, and will continue the attempt until it is able to do so. More...
 
class  USERCritObj
 User critial section object class. More...
 
class  NBRtosInitObj
 A simple class to derive from if you are creating tasks that are constructed at global scope and need to do RTOS initalization. More...
 

Macros

#define OS_STAT_RDY   0x00
 Ready to run.
 
#define OS_STAT_MBOX   0x01
 Pending on mailbox.
 
#define OS_STAT_SEM   0x02
 Pending on semaphore.
 
#define OS_STAT_Q   0x04
 Pending on queue.
 
#define OS_STAT_FIFO   0x08
 Pending on FIFO.
 
#define OS_STAT_CRIT   0x10
 Pending on Critical Section.
 
#define OS_STAT_DELAY   0x20
 Reserved.
 
#define OS_STAT_RES4   0x40
 Reserved.
 
#define OS_STAT_RES5   0x80
 Reserved.
 
#define OS_NO_ERR   0
 No error.
 
#define OS_TIMEOUT   10
 Timeout.
 
#define OS_MBOX_FULL   20
 Mailbox full.
 
#define OS_Q_FULL   30
 Queue full.
 
#define OS_Q_EXISTS   31
 Queue already exists.
 
#define OS_PRIO_EXIST   40
 Task priority number already exists.
 
#define OS_PRIO_INVALID   41
 Invalid task priority number.
 
#define OS_SEM_ERR   50
 Semaphore error.
 
#define OS_SEM_OVF   51
 Semaphore count overflow.
 
#define OS_CRIT_ERR   60
 Critical section error.
 
#define OS_NO_MORE_TCB   70
 No Task Control Blocks (TCB) available to create task.
 
#define WAIT_FOREVER   0
 Parameter macro used for timeout parameters that have a 0 value and wait forever.
 
#define OSSimpleTaskCreatewName(x, p, n)
 Simpler form of creating a new task. Will automatically allocate the default task stack size.
 
#define OSSimpleTaskCreatewNameSRAM(x, p, n)
 
#define OSSimpleTaskCreateLambda(p, n, f)   LambdaTask2(p,n,[]( void * pv)f,__COUNTER__)
 This macro functions the same as OSTaskCreatewName().
 

Typedefs

typedef struct os_fifo_el OS_FIFO_EL
 OS_FIFO element definition.
 

Functions

void OSFlagSet (OS_FLAGS *flags, uint32_t bits_to_set)
 This function sets the corresponding bits asserted in bits_to_set of an OS_FLAGS object pointed to by *flags.
 
void OSFlagClear (OS_FLAGS *flags, uint32_t bits_to_clr)
 This function clears the bits asserted in bits_to_clr of an OS_FLAGS object pointed to by *flags..
 
uint8_t OSFlagPendAny (OS_FLAGS *flags, uint32_t bit_mask, uint16_t timeout)
 This function waits a number of time ticks specified by timeout until any of the flags indicated by bit_mask are set.
 
uint8_t OSFlagPendAnyNoWait (OS_FLAGS *flags, uint32_t bit_mask)
 This function immediately checks to see if any of the flag bits indicated by bit_mask are set; it does not wait.
 
uint8_t OSFlagPendAll (OS_FLAGS *flags, uint32_t bit_mask, uint16_t timeout)
 This function waits a number of time ticks specified by timeout until all the flags indicated by bit_mask are set.
 
uint8_t OSFlagPendAllNoWait (OS_FLAGS *flags, uint32_t bit_mask)
 This function immediately checks to see if all the flag bits indicated by bit_mask are set; it does not wait.
 
uint32_t OSFlagState (OS_FLAGS *flags)
 This function returns the current values of the flags stored in the OS_FLAGS object structure.
 
uint8_t OSTaskCreatewName (void(*task)(void *dptr), void *data, void *pstktop, void *pstkbot, uint8_t prio, const char *name)
 Create a new task.
 
void OSTimeWaitUntil (uint32_t systemTickValue)
 Delay the task until the specified value of the system timer tick. The number of system ticks per second is defined by the constant: TICKS_PER_SECOND in <nburn_install>/nbrtos/include/constants.h. The default value is 20 ticks per second.
 
void OSTimeDly (uint32_t to_count)
 Delay the task until the specified value of the system timer ticks. The number of system ticks per second is defined by the constant: TICKS_PER_SECOND in <nburn_install>/nbrtos/include/constants.h. The default value is 20 ticks per second.
 
void OSTaskDelete (void)
 This function deletes the current calling task, but we do not recommend the use of this function because it can cause memory leaks.
 
uint8_t OSChangePrio (uint32_t newp)
 Set the priority of the calling task.
 
void OSSetName (const char *cp)
 Set the name of the calling task.
 
void OSLock (void)
 Calling the OSLock function will prevent the OS from changing tasks.
 
void OSUnlock (void)
 This function unlocks the OS.
 
uint8_t OSSemInit (OS_SEM *psem, long value)
 Initializes a semaphore.
 
uint8_t OSSemPost (OS_SEM *psem)
 Increases the value of the semaphore by one. Note: If any higher priority tasks were waiting on the semaphore - it releases them.
 
uint8_t OSSemPend (OS_SEM *psem, uint16_t timeout)
 Wait timeout ticks for the value of the semaphore to be non zero. Note: A timeout value of 0 (zero) waits forever.
 
uint8_t OSSemPendNoWait (OS_SEM *psem)
 OSSemPendNoWait() is identical to OSSemPend(), but it does not wait.
 
uint8_t OSMboxInit (OS_MBOX *pmbox, void *msg)
 This function is used to initialize an OS_MBOX structure.
 
uint8_t OSMboxPost (OS_MBOX *pmbox, void *msg)
 This function posts a message to a Mail box.
 
void * OSMboxPend (OS_MBOX *pmbox, uint16_t timeout, uint8_t *err)
 Wait timeout ticks for some other task to post to the Mailbox.
 
void * OSMboxPendNoWait (OS_MBOX *pmbox, uint8_t *err)
 OSMboxPendNoWait() is identical to OSMboxPend(), but it does not wait.
 
uint8_t OSQInit (OS_Q *pq, void **start, uint8_t size)
 A queue functions as a fixed size FIFO for communication between tasks. This function initializes an OS_Q structure.
 
uint8_t OSQPost (OS_Q *pq, void *msg)
 This function posts a message to a Queue.
 
uint8_t OSQPostFirst (OS_Q *pq, void *msg)
 This function posts a message like OSQPost, but posts the message at the head of the queue.
 
uint8_t OSQPostUnique (OS_Q *pq, void *msg)
 This function posts a message like OSQPost, but only if the message isn't already in the queue The function performs a brute force check to see if the message is already in the queue.
 
uint8_t OSQPostUniqueFirst (OS_Q *pq, void *msg)
 This function posts a message like OSQPostFirst, but only if the message isn't already in the queue The function performs a brute force check to see if the message is already in the queue.
 
void * OSQPend (OS_Q *pq, uint16_t timeout, uint8_t *err)
 Wait timeout ticks for another task to post to the queue.
 
void * OSQPendNoWait (OS_Q *pq, uint8_t *err)
 OSQPendNoWait() is identical to the OSQPend() function but it does not wait.
 
uint8_t OSFifoInit (OS_FIFO *pFifo)
 Initialize a FIFO, which is used to pass structures from one task to another.
 
uint8_t OSFifoPost (OS_FIFO *pFifo, OS_FIFO_EL *pToPost)
 This function posts to a FIFO.
 
uint8_t OSFifoPostFirst (OS_FIFO *pFifo, OS_FIFO_EL *pToPost)
 This function is identical to OSFifoPost(), but the element posted is put at the beginning of the FIFO list.
 
OS_FIFO_ELOSFifoPend (OS_FIFO *pFifo, uint16_t timeout)
 This function pends on a FIFO.
 
OS_FIFO_ELOSFifoPendNoWait (OS_FIFO *pFifo)
 This function is identical to the OSFifoPen() function, but it does not wait.
 
uint8_t OSCritInit (OS_CRIT *pCrit)
 This function initializes the critical section.
 
uint8_t OSCritEnter (OS_CRIT *pCrit, uint16_t timeout)
 This function tries to enter or claim the critical section.
 
uint8_t OSCritEnterNoWait (OS_CRIT *pCrit)
 This function tries to enter or claim the critical section.
 
uint8_t OSCritLeave (OS_CRIT *pCrit)
 This function releases the critical section.
 
uint8_t OSTaskID (void)
 Returns the current task's priority.
 
const char * OSTaskName ()
 Returns the current task's name.
 
void OSChangeTaskDly (uint16_t task_prio, uint32_t to_count)
 This function allows the User to modify the timeout delay for a task that is waiting.
 
void OSDumpStack (void)
 Dump the task stack to the stdout.
 
void OSDumpTCBStacks (void)
 This function dumps information about the UCOS stacks and tasks to stdout. This function is useful for debugging.
 
void OSDumpTasks (void)
 Dump the state and call stack for every task to stdout. This function is useful for debugging.
 
void OSStartTaskDumper (uint8_t prio, uint32_t reportInterval)
 This function creates a task that calls OSDumpTasks() at the specified system time tick interval. The task is intended for use when debugging run status of multiple tasks.
 
void ShowTaskList (void)
 This functions dumps the current RTOS task states to stdio.
 

Detailed Description

NetBurner Real-Time Operating System (NBRTOS) API.