XDK API  3.6.0
Documentation
Data Structures | Macros | Typedefs | Functions | Variables
osi.h File Reference
#include "FreeRTOS.h"
#include "task.h"
+ Include dependency graph for osi.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  tSimpleLinkSpawnMsg
 structure definition for simple link spawn message More...
 

Macros

#define OSI_ABORTED   (-3)
 
#define OSI_EVENT_OPEARTION_FAILURE   (-8)
 
#define OSI_EVENTS_IN_USE   (-7)
 
#define OSI_FAILURE   (-1)
 
#define OSI_INVALID_PARAMS   (-4)
 
#define OSI_MEMORY_ALLOCATION_FAILURE   (-5)
 
#define OSI_NO_WAIT   (0)
 
#define OSI_OK   (0)
 
#define OSI_OPERATION_FAILED   (-2)
 
#define OSI_TIMEOUT   (-6)
 
#define OSI_WAIT_FOREVER   (0xFFFFFFFF)
 

Typedefs

typedef void * OsiLockObj_t
 type definition for a locking object container More...
 
typedef void * OsiMsgQ_t
 
typedef long OsiReturnVal_e
 
typedef void * OsiSyncObj_t
 type definition for a sync object container More...
 
typedef void * OsiTaskHandle
 
typedef unsigned long OsiTime_t
 type definition for a time value More...
 
typedef void(* P_OSI_EVENT_HANDLER )(void *pValue)
 
typedef void(* P_OSI_INTR_ENTRY )(void)
 
typedef void(* P_OSI_SPAWN_ENTRY )(void *pValue)
 type definition for a spawn entry callback More...
 
typedef void(* P_OSI_TASK_ENTRY )(void *pValue)
 

Functions

void mem_copy (void *pDst, void *pSrc, size_t Size)
 Copy Memory. More...
 
void mem_Free (void *pMem)
 Deallocates Memory. More...
 
void * mem_Malloc (unsigned long Size)
 Allocates Memory on Heap. More...
 
void mem_set (void *pBuf, int Val, size_t Size)
 Set Memory. More...
 
void osi_ContextRestore ()
 This function used to retrieve the context after sleep. More...
 
void osi_ContextSave ()
 This function used to save the os context before sleep. More...
 
unsigned long osi_EnterCritical (void)
 Enter Critical Section. More...
 
void osi_ExitCritical (unsigned long ulKey)
 Exit Critical Section. More...
 
void osi_InterruptDeRegister (int iIntrNum)
 This function De-registers an interrupt in NVIC table. More...
 
OsiReturnVal_e osi_InterruptRegister (int iIntrNum, P_OSI_INTR_ENTRY pEntry, unsigned char ucPriority)
 This function registers an interrupt in NVIC table. More...
 
OsiReturnVal_e osi_LockObjCreate (OsiLockObj_t *pLockObj)
 This function creates a locking object. More...
 
OsiReturnVal_e osi_LockObjDelete (OsiLockObj_t *pLockObj)
 This function deletes a locking object. More...
 
OsiReturnVal_e osi_LockObjLock (OsiLockObj_t *pLockObj, OsiTime_t Timeout)
 This function locks a locking object. More...
 
OsiReturnVal_e osi_LockObjUnlock (OsiLockObj_t *pLockObj)
 This function unlock a locking object. More...
 
OsiReturnVal_e osi_MsgQCreate (OsiMsgQ_t *pMsgQ, char *pMsgQName, unsigned long MsgSize, unsigned long MaxMsgs)
 This function is used to create the MsgQ. More...
 
OsiReturnVal_e osi_MsgQDelete (OsiMsgQ_t *pMsgQ)
 This function is used to delete the MsgQ. More...
 
OsiReturnVal_e osi_MsgQRead (OsiMsgQ_t *pMsgQ, void *pMsg, OsiTime_t Timeout)
 This function is used to read data from the MsgQ. More...
 
OsiReturnVal_e osi_MsgQWrite (OsiMsgQ_t *pMsgQ, void *pMsg, OsiTime_t Timeout)
 This function is used to write data to the MsgQ. More...
 
void osi_Sleep (unsigned int MilliSecs)
 This function used to suspend the task for the specified number of milli secs. More...
 
OsiReturnVal_e osi_Spawn (P_OSI_SPAWN_ENTRY pEntry, void *pValue, unsigned long flags)
 This function call the pEntry callback from a different context. More...
 
void osi_start ()
 This function starts the OS Scheduler. More...
 
OsiReturnVal_e osi_SyncObjClear (OsiSyncObj_t *pSyncObj)
 This function clears a sync object. More...
 
OsiReturnVal_e osi_SyncObjCreate (OsiSyncObj_t *pSyncObj)
 This function creates a sync object. More...
 
OsiReturnVal_e osi_SyncObjDelete (OsiSyncObj_t *pSyncObj)
 This function deletes a sync object. More...
 
OsiReturnVal_e osi_SyncObjSignal (OsiSyncObj_t *pSyncObj)
 This function generates a sync signal for the object. More...
 
OsiReturnVal_e osi_SyncObjSignalFromISR (OsiSyncObj_t *pSyncObj)
 This function generates a sync signal for the object. from ISR context. More...
 
OsiReturnVal_e osi_SyncObjWait (OsiSyncObj_t *pSyncObj, OsiTime_t Timeout)
 This function waits for a sync signal of the specific sync object. More...
 
OsiReturnVal_e osi_TaskCreate (P_OSI_TASK_ENTRY pEntry, const signed char *const pcName, unsigned short usStackDepth, void *pvParameters, unsigned long uxPriority, OsiTaskHandle *pTaskHandle)
 This function call the pEntry callback from a different context. More...
 
void osi_TaskDelete (OsiTaskHandle *pTaskHandle)
 This function Deletes a Task. More...
 
unsigned long osi_TaskDisable (void)
 This function used to disable the tasks. More...
 
void osi_TaskEnable (unsigned long)
 This function used to enable all tasks. More...
 
void VDeleteSimpleLinkSpawnTask (void)
 This is the API to delete SL spawn task and delete the SL queue. More...
 
OsiReturnVal_e VStartSimpleLinkSpawnTask (unsigned portBASE_TYPE uxPriority)
 This is the API to create SL spawn task and create the SL queue. More...
 

Variables

void * xSimpleLinkSpawnQueue
 

Macro Definition Documentation

#define OSI_ABORTED   (-3)
#define OSI_EVENT_OPEARTION_FAILURE   (-8)
#define OSI_EVENTS_IN_USE   (-7)
#define OSI_FAILURE   (-1)
#define OSI_INVALID_PARAMS   (-4)
#define OSI_MEMORY_ALLOCATION_FAILURE   (-5)
#define OSI_NO_WAIT   (0)
#define OSI_OK   (0)
#define OSI_OPERATION_FAILED   (-2)
#define OSI_TIMEOUT   (-6)
#define OSI_WAIT_FOREVER   (0xFFFFFFFF)

Typedef Documentation

typedef void* OsiLockObj_t

Locking object are used to protect a resource from mutual accesses of two or more threads. The locking object should support re-entrant locks by a signal thread. This object is generally implemented by mutex semaphore

Note
On each porting or platform the type could be whatever is needed - integer, structure etc.
typedef void* OsiMsgQ_t
typedef void* OsiSyncObj_t

Sync object is object used to synchronize between two threads or thread and interrupt handler. One thread is waiting on the object and the other thread send a signal, which then release the waiting thread. The signal must be able to be sent from interrupt context. This object is generally implemented by binary semaphore or events.

Note
On each porting or platform the type could be whatever is needed - integer, structure etc.
typedef void* OsiTaskHandle
typedef unsigned long OsiTime_t
Note
On each porting or platform the type could be whatever is needed - integer, pointer to structure etc.
typedef void(* P_OSI_EVENT_HANDLER)(void *pValue)
typedef void(* P_OSI_INTR_ENTRY)(void)
typedef void(* P_OSI_SPAWN_ENTRY)(void *pValue)

the spawn mechanism enable to run a function on different context. This mechanism allow to transfer the execution context from interrupt context to thread context or changing the context from an unknown user thread to general context. The implementation of the spawn mechanism depends on the user's system requirements and could varies from implementation of serialized execution using single thread to creating thread per call

Note
The stack size of the execution thread must be at least of TBD bytes!
typedef void(* P_OSI_TASK_ENTRY)(void *pValue)

Function Documentation

void mem_copy ( void *  pDst,
void *  pSrc,
size_t  Size 
)
Parameters
pDst- Pointer to the Destination Buffer
pSrc- Pointer to the Source Buffer
Size- Size of the memory to be copied
Returns
void
Note
Warning

Copy Memory.

Parameters
pDst- pointer to the destination
pSrc- pointer to the source
Size- Size of the memory which needs to be copy
Returns
- void
Note
Warning
void mem_Free ( void *  pMem)
Parameters
pMem- Pointer to the Buffer to be freed
Returns
void
See also
Note
Warning

Deallocates Memory.

Parameters
pMem- pointer to the memory which needs to be freed
Returns
- void
Note
Warning

+ Here is the call graph for this function:

void* mem_Malloc ( unsigned long  Size)
Parameters
Size- Size of the Buffer to be allocated
See also
Note
Warning

Allocates Memory on Heap.

Parameters
Size- size of memory to alloc in bytes
Returns
- void *
Note
Warning

+ Here is the call graph for this function:

void mem_set ( void *  pBuf,
int  Val,
size_t  Size 
)
Parameters
pBuf- Pointer to the Buffer
Val- Value to be set
Size- Size of the memory to be set
See also
Note
Warning

Set Memory.

Parameters
pBuf- pointer to the memory to be fill
Val- Value to be fill
Size- Size of the memory which needs to be fill
Returns
- void
Note
Warning
void osi_ContextRestore ( )
Parameters
void
Returns
void
Note
Warning

This function used to retrieve the context after sleep.

Parameters
void
Returns
- void
Note
Warning
void osi_ContextSave ( )
Parameters
void
Returns
void
Note
Warning

This function used to save the os context before sleep.

Parameters
void
Returns
- void
Note
Warning
unsigned long osi_EnterCritical ( void  )
See also
Note
Warning

Enter Critical Section.

Parameters
void
Returns
- void
Note
Warning
void osi_ExitCritical ( unsigned long  ulKey)
See also
Note
Warning

Exit Critical Section.

Parameters
void
Returns
- void
Note
Warning
void osi_InterruptDeRegister ( int  iIntrNum)
Parameters
iIntrNum- Interrupt number to register
pEntry- Pointer to the interrupt handler
Returns
upon successful creation the function should return Positive number Otherwise, a negative value indicating the error code shall be returned
Note
Warning
OsiReturnVal_e osi_InterruptRegister ( int  iIntrNum,
P_OSI_INTR_ENTRY  pEntry,
unsigned char  ucPriority 
)

The sync object is used for synchronization between different thread or ISR and a thread.

Parameters
iIntrNum- Interrupt number to register
pEntry- Pointer to the interrupt handler
Returns
upon successful creation the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
Warning
OsiReturnVal_e osi_LockObjCreate ( OsiLockObj_t pLockObj)

The locking object is used for protecting a shared resources between different threads.

Parameters
pLockObj- pointer to the locking object control block
Returns
upon successful creation the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
Warning
OsiReturnVal_e osi_LockObjDelete ( OsiLockObj_t pLockObj)
Parameters
pLockObj- pointer to the locking object control block
Returns
upon successful deletion the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
Warning
OsiReturnVal_e osi_LockObjLock ( OsiLockObj_t pLockObj,
OsiTime_t  Timeout 
)

All other threads that call this function before this thread calls the osi_LockObjUnlock would be suspended

Parameters
pLockObj- pointer to the locking object control block
Timeout- numeric value specifies the maximum number of mSec to stay suspended while waiting for the locking object Currently, the simple link driver uses only two values:
  • OSI_WAIT_FOREVER
  • OSI_NO_WAIT
Returns
upon successful reception of the locking object the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
Warning
OsiReturnVal_e osi_LockObjUnlock ( OsiLockObj_t pLockObj)
Parameters
pLockObj- pointer to the locking object control block
Returns
upon successful unlocking the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
Warning
OsiReturnVal_e osi_MsgQCreate ( OsiMsgQ_t pMsgQ,
char *  pMsgQName,
unsigned long  MsgSize,
unsigned long  MaxMsgs 
)
Parameters
pMsgQ- pointer to the message queue
pMsgQName- msg queue name
MsgSize- size of message on the queue
MaxMsgs- max. number of msgs that the queue can hold
Returns
- OsiReturnVal_e
Note
Warning
OsiReturnVal_e osi_MsgQDelete ( OsiMsgQ_t pMsgQ)
Parameters
pMsgQ- pointer to the message queue
Returns
- OsiReturnVal_e
Note
Warning

+ Here is the call graph for this function:

OsiReturnVal_e osi_MsgQRead ( OsiMsgQ_t pMsgQ,
void *  pMsg,
OsiTime_t  Timeout 
)
Parameters
pMsgQ- pointer to the message queue
pMsg- pointer to the Msg strut to read into
Timeout- timeout to wait for the Msg to be available
Returns
- OsiReturnVal_e
Note
Warning

+ Here is the call graph for this function:

OsiReturnVal_e osi_MsgQWrite ( OsiMsgQ_t pMsgQ,
void *  pMsg,
OsiTime_t  Timeout 
)
Parameters
pMsgQ- pointer to the message queue
pMsg- pointer to the Msg strut to read into
Timeout- timeout to wait for the Msg to be available
Returns
- OsiReturnVal_e
Note
Warning
void osi_Sleep ( unsigned int  MilliSecs)
Parameters
MilliSecs- Time in millisecs to suspend the task
Returns
void
Note
Warning
Parameters
MilliSecs- Time in millisecs to suspend the task
Returns
- void
Note
Warning

+ Here is the call graph for this function:

OsiReturnVal_e osi_Spawn ( P_OSI_SPAWN_ENTRY  pEntry,
void *  pValue,
unsigned long  flags 
)
Parameters
pEntry- pointer to the entry callback function
pValue- pointer to any type of memory structure that would be passed to pEntry callback from the execution thread.
flags- execution flags - reserved for future usage
Returns
upon successful registration of the spawn the function should return 0 (the function is not blocked till the end of the execution of the function and could be returned before the execution is actually completed) Otherwise, a negative value indicating the error code shall be returned
Note
Warning
void osi_start ( )
Parameters
-void
Returns
- void
Note
Warning

This function starts the OS Scheduler.

Parameters
void
Returns
- void
Note
Warning

+ Here is the call graph for this function:

OsiReturnVal_e osi_SyncObjClear ( OsiSyncObj_t pSyncObj)
Parameters
pSyncObj- pointer to the sync object control block
Returns
upon successful clearing the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
Warning

+ Here is the call graph for this function:

OsiReturnVal_e osi_SyncObjCreate ( OsiSyncObj_t pSyncObj)

The sync object is used for synchronization between different thread or ISR and a thread.

Parameters
pSyncObj- pointer to the sync object control block
Returns
upon successful creation the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
Warning
OsiReturnVal_e osi_SyncObjDelete ( OsiSyncObj_t pSyncObj)
Parameters
pSyncObj- pointer to the sync object control block
Returns
upon successful deletion the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
Warning
OsiReturnVal_e osi_SyncObjSignal ( OsiSyncObj_t pSyncObj)

All suspended threads waiting on this sync object are resumed

Parameters
pSyncObj- pointer to the sync object control block
Returns
upon successful signalling the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
the function could be called from ISR context
Warning

All suspended threads waiting on this sync object are resumed

Parameters
pSyncObj- pointer to the sync object control block
Returns
upon successful signaling the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
the function could be called from ISR context
Warning
OsiReturnVal_e osi_SyncObjSignalFromISR ( OsiSyncObj_t pSyncObj)

All suspended threads waiting on this sync object are resumed

Parameters
pSyncObj- pointer to the sync object control block
Returns
upon successful signalling the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
the function is called from ISR context
Warning

This function generates a sync signal for the object. from ISR context.

All suspended threads waiting on this sync object are resumed

Parameters
pSyncObj- pointer to the sync object control block
Returns
upon successful signalling the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
the function is called from ISR context
Warning
OsiReturnVal_e osi_SyncObjWait ( OsiSyncObj_t pSyncObj,
OsiTime_t  Timeout 
)
Parameters
pSyncObj- pointer to the sync object control block
Timeout- numeric value specifies the maximum number of mSec to stay suspended while waiting for the sync signal Currently, the simple link driver uses only two values:
  • OSI_WAIT_FOREVER
  • OSI_NO_WAIT
Returns
upon successful reception of the signal within the timeout window return 0 Otherwise, a negative value indicating the error code shall be returned
Note
Warning

+ Here is the caller graph for this function:

OsiReturnVal_e osi_TaskCreate ( P_OSI_TASK_ENTRY  pEntry,
const signed char *const  pcName,
unsigned short  usStackDepth,
void *  pvParameters,
unsigned long  uxPriority,
OsiTaskHandle pTaskHandle 
)
Parameters
pEntry- pointer to the entry callback function
pValue- pointer to any type of memory structure that would be passed to pEntry callback from the execution thread.
flags- execution flags - reserved for future usage
Returns
upon successful registration of the spawn the function should return 0 (the function is not blocked till the end of the execution of the function and could be returned before the execution is actually completed) Otherwise, a negative value indicating the error code shall be returned
Note
Warning

This function creates a Task.

Creates a new Task and add it to the last of tasks that are ready to run

Parameters
pEntry- pointer to the Task Function
pcName- Task Name String
usStackDepth- Stack Size Stack Size in 32-bit long words
pvParameters- pointer to structure to be passed to the Task Function
uxPriority- Task Priority
Returns
upon successful unlocking the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
Warning

This function call the pEntry callback from a different context.

Creates a new Task and add it to the last of tasks that are ready to run

Parameters
pEntry- pointer to the Task Function
pcName- Task Name String
usStackDepth- Stack Size in bytes
pvParameters- pointer to structure to be passed to the Task Function
uxPriority- Task Priority
Returns
upon successful creation the function should return 0 Otherwise, a negative value indicating the error code shall be returned
Note
Warning

+ Here is the caller graph for this function:

void osi_TaskDelete ( OsiTaskHandle pTaskHandle)

Deletes a Task and remove it from list of running task

Parameters
pTaskHandle- Task Handle
Note
Warning

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned long osi_TaskDisable ( void  )
Parameters
-void
Returns
- Key with the suspended tasks
Note
Warning

+ Here is the call graph for this function:

void osi_TaskEnable ( unsigned long  key)
Parameters
unsignedlong
Returns
- void
Note
Warning

This function used to enable all tasks.

Parameters
key- returned from suspend tasks
Returns
- void
Note
Warning

+ Here is the call graph for this function:

void VDeleteSimpleLinkSpawnTask ( void  )
Parameters
none
Returns
void
Note
Warning

+ Here is the call graph for this function:

OsiReturnVal_e VStartSimpleLinkSpawnTask ( unsigned portBASE_TYPE  uxPriority)
Parameters
uxPriority- task priority
Returns
void
Note
Warning

+ Here is the call graph for this function:

Variable Documentation

void* xSimpleLinkSpawnQueue

All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:47 by doxygen 1.8.8