SimpleLink Host Driver  0.0.5.1
 All Data Structures Functions Variables Groups
Porting - Operating System

Macros

#define SL_PLATFORM_MULTI_THREADED
 
#define SL_OS_RET_CODE_OK   ((int)OSI_OK)
 
#define SL_OS_WAIT_FOREVER   ((OsiTime_t)OSI_WAIT_FOREVER)
 
#define SL_OS_NO_WAIT   ((OsiTime_t)OSI_NO_WAIT)
 
#define _SlTime_t   OsiTime_t
 type definition for a time value More...
 
#define _SlSyncObj_t   OsiSyncObj_t
 type definition for a sync object container More...
 
#define sl_SyncObjCreate(pSyncObj, pName)
 This function creates a sync object. More...
 
#define sl_SyncObjDelete(pSyncObj)
 This function deletes a sync object. More...
 
#define sl_SyncObjSignal(pSyncObj)
 This function generates a sync signal for the object. More...
 
#define sl_SyncObjSignalFromIRQ(pSyncObj)
 This function generates a sync signal for the object from Interrupt. More...
 
#define sl_SyncObjWait(pSyncObj, Timeout)
 This function waits for a sync signal of the specific sync object. More...
 
#define _SlLockObj_t   OsiLockObj_t
 type definition for a locking object container More...
 
#define sl_LockObjCreate(pLockObj, pName)
 This function creates a locking object. More...
 
#define sl_LockObjDelete(pLockObj)
 This function deletes a locking object. More...
 
#define sl_LockObjLock(pLockObj, Timeout)
 This function locks a locking object. More...
 
#define sl_LockObjUnlock(pLockObj)
 This function unlock a locking object. More...
 
#define SL_PLATFORM_EXTERNAL_SPAWN
 This function call the pEntry callback from a different context. More...
 
#define sl_Spawn(pEntry, pValue, flags)
 

Detailed Description

The simple link driver can run on multi-threaded environment as well as non-os environment (mail loop)

This section IS NOT REQUIRED in case you are working on non-os environment.

If you choose to work in multi-threaded environment under any operating system you will have to provide some basic adaptation routines to allow the driver to protect access to resources from different threads (locking object) and to allow synchronization between threads (sync objects).

PORTING ACTION:

  1. Uncomment SL_PLATFORM_MULTI_THREADED define
  2. Bind locking object routines
  3. Bind synchronization object routines
  4. Optional - Bind spawn thread routine

Macro Definition Documentation

#define _SlLockObj_t   OsiLockObj_t

type definition for a locking object container

Locking object are used to protect a resource from mutual accesses of two or more threads. The locking object should support reentrant 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.
belongs to porting_sec
#define _SlSyncObj_t   OsiSyncObj_t

type definition for a sync object container

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.
belongs to porting_sec
#define _SlTime_t   OsiTime_t

type definition for a time value

Note
On each porting or platform the type could be whatever is needed - integer, pointer to structure etc.
belongs to porting_sec
#define sl_LockObjCreate (   pLockObj,
  pName 
)

This function creates a locking object.

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
belongs to porting_sec
Warning
#define sl_LockObjDelete (   pLockObj)

This function deletes a locking object.

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
belongs to porting_sec
Warning
#define sl_LockObjLock (   pLockObj,
  Timeout 
)

This function locks a locking object.

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
\return upon successful reception of the locking object the function should return 0
            Otherwise, a negative value indicating the error code shall be returned
Note
belongs to porting_sec
Warning
#define sl_LockObjUnlock (   pLockObj)

This function unlock a locking object.

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
belongs to porting_sec
Warning
#define SL_OS_NO_WAIT   ((OsiTime_t)OSI_NO_WAIT)
See Also
Note
belongs to porting_sec
Warning
#define SL_OS_RET_CODE_OK   ((int)OSI_OK)
See Also
Note
belongs to porting_sec
Warning
#define SL_OS_WAIT_FOREVER   ((OsiTime_t)OSI_WAIT_FOREVER)
See Also
Note
belongs to porting_sec
Warning
#define SL_PLATFORM_EXTERNAL_SPAWN

This function call the pEntry callback from a different context.

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
belongs to porting_sec
Warning
#define sl_SyncObjCreate (   pSyncObj,
  pName 
)

This function creates a sync object.

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
belongs to porting_sec
Warning
#define sl_SyncObjDelete (   pSyncObj)

This function deletes a sync object.

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
belongs to porting_sec
Warning
#define sl_SyncObjSignal (   pSyncObj)

This function generates a sync signal for the object.

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
#define sl_SyncObjSignalFromIRQ (   pSyncObj)

This function generates a sync signal for the object from Interrupt.

This is for RTOS that should signal from IRQ using a dedicated API

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
#define sl_SyncObjWait (   pSyncObj,
  Timeout 
)

This function waits for a sync signal of the specific sync object.

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
belongs to porting_sec
Warning