dcDCPL_Os.h File Reference

DPWSCore OS portability layer. More...

#include "stdint.h"

Functions

Clock management
uint64_t dcpl_get_clock (void)
 Return a system clock value.
int dcpl_get_time (uint32_t *s, uint32_t *ns)
 Retrieves the time since 00:00:00 GMT, January 1, 1970.
int dcpl_sleep (uint64_t dly)
 Makes the current thread sleep for a given duration.
Process management
uint32_t dcpl_process_id (void)
 Return a process ID used for UUID generation diversification.

Mutexes management

#define DC_LOCK_NB   8
 The number of mutexes used by the dpws stack that may be used to size static memory for the mutexes.
typedef void * dcpl_mutex_t
 An implementation dependent type forward declaration for the mutex (can be replaced by a structure by the implementation).
dcpl_mutex_tdcpl_mutex_init (void)
 Creates a new mutex for thread synchronization.
int dcpl_mutex_delete (dcpl_mutex_t *mutex)
 Deletes a mutex created using dcpl_mutex_init.
int dcpl_mutex_lock (dcpl_mutex_t *mutex)
 Takes a mutex lock.
int dcpl_mutex_unlock (dcpl_mutex_t *mutex)
 Releases a mutex lock.


Detailed Description

DPWSCore OS portability layer.


Define Documentation

#define DC_LOCK_NB   8

The number of mutexes used by the dpws stack that may be used to size static memory for the mutexes.


Typedef Documentation

typedef void* dcpl_mutex_t

An implementation dependent type forward declaration for the mutex (can be replaced by a structure by the implementation).


Function Documentation

uint64_t dcpl_get_clock ( void   ) 

Return a system clock value.

Returns:
A time value in milliseconds that is not necessarily absolute (since the origin is generally the boot time). Note that of course, the implementation is responsible to provide the best resolution possible without damaging the system performance, knowing that the minimum resolution expected is 10ms.

int dcpl_get_time ( uint32_t *  s,
uint32_t *  ns 
)

Retrieves the time since 00:00:00 GMT, January 1, 1970.

If no absolute clock is available on the platform this API should return a boot relative time value. Note that of course, the implementation is responsible to provide the best resolution possible without damaging the system performance, knowing that the minimum resolution expected is 10ms.

Parameters:
[out] s The number of seconds since 00:00:00 GMT, January 1, 1970.
[out] ns The remainder in nanoseconds for the returned time.
Returns:
A DCPL error code.

int dcpl_sleep ( uint64_t  dly  ) 

Makes the current thread sleep for a given duration.

Parameters:
dly The number of milliseconds for which the thread must be stopped.
Returns:
DCPL_OK or a DCPL error code.

dcpl_mutex_t* dcpl_mutex_init ( void   ) 

Creates a new mutex for thread synchronization.

Note that the mutex is not expected to be reentrant.

Returns:
A pointer to the implementation type for the "thread" mutex.

int dcpl_mutex_delete ( dcpl_mutex_t mutex  ) 

Deletes a mutex created using dcpl_mutex_init.

Parameters:
mutex A pointer to the "thread" mutex.
Returns:
DCPL_OK or a DCPL error code.

int dcpl_mutex_lock ( dcpl_mutex_t mutex  ) 

Takes a mutex lock.

Parameters:
mutex A pointer to the "thread" mutex.
Returns:
DCPL_OK or a DCPL error code. Since the mutex is not expected to be reentrant, it may return DCPL_ILLEGAL_OPERATION if it is called twice in a raw.

int dcpl_mutex_unlock ( dcpl_mutex_t mutex  ) 

Releases a mutex lock.

Parameters:
mutex A pointer to the "thread" mutex.
Returns:
DCPL_OK or a DCPL error code.

uint32_t dcpl_process_id ( void   ) 

Return a process ID used for UUID generation diversification.

Returns:
A numeric process ID. On a platform without processes, return any value.


Generated on Fri Apr 17 15:18:24 2009 for DPWSCore by  doxygen 1.5.8