uwb-core DPL (Decawave Porting Layer) semapahore wrappers More...

Detailed Description

uwb-core DPL (Decawave Porting Layer) semapahore wrappers

Author
Francisco Molina franc.nosp@m.ois-.nosp@m.xavie.nosp@m.r.mo.nosp@m.lina@.nosp@m.inri.nosp@m.a.fr

Definition in file dpl_sem.h.

#include <stdint.h>
#include "dpl_types.h"
#include "dpl_error.h"
#include "sema.h"
+ Include dependency graph for dpl_sem.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dpl_sem
 dpl semaphore wrapper More...
 

Functions

dpl_error_t dpl_sem_init (struct dpl_sem *sem, uint16_t tokens)
 Initialize a semaphore. More...
 
dpl_error_t dpl_sem_pend (struct dpl_sem *sem, dpl_time_t timeout)
 Pend (wait) for a semaphore. More...
 
dpl_error_t dpl_sem_release (struct dpl_sem *sem)
 Release a semaphore. More...
 
uint16_t dpl_sem_get_count (struct dpl_sem *sem)
 Get current semaphore's count.
 

Function Documentation

◆ dpl_sem_init()

dpl_error_t dpl_sem_init ( struct dpl_sem sem,
uint16_t  tokens 
)

Initialize a semaphore.

Parameters
[in]sempointer to semaphore
[in]tokens# of tokens the semaphore should contain initially.
Returns
dpl_error_t DPL_INVALID_PARM Semaphore passed in was NULL. DPL_OK no error.

◆ dpl_sem_pend()

dpl_error_t dpl_sem_pend ( struct dpl_sem sem,
dpl_time_t  timeout 
)

Pend (wait) for a semaphore.

Parameters
[in]sempointer to semaphore.
[in]timeouttimeout, in os ticks. A timeout of 0 means do not wait if not available. A timeout of DPL_TIMEOUT_NEVER means wait forever.
Returns
dpl_error_t DPL_INVALID_PARM semaphore passed in was NULL. DPL_TIMEOUT semaphore was owned by another task and timeout=0 DPL_OK no error

◆ dpl_sem_release()

dpl_error_t dpl_sem_release ( struct dpl_sem sem)

Release a semaphore.

Parameters
[in]sempointer to the semaphore to be released
Returns
dpl_error_t DPL_INVALID_PARM semaphore passed in was NULL. DPL_OK no error