MHEG  17.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
Macros | Functions
stb_os.h File Reference

Header file - Function prototypes for operating system. More...

#include "techtype.h"

Go to the source code of this file.

Macros

#define TIMEOUT_NOW   0
 
#define TIMEOUT_NEVER   0xffff
 

Functions

U32BIT STB_OSGetClockMilliseconds (void)
 Get Current Computer Clock Time. More...
 
void * STB_OSCreateTask (void(*function)(void *), void *param, U32BIT stack, U8BIT priority, U8BIT *name)
 Create a New Task to the calling process. Upon success, the created task runs on its own stack, as part of the calling process context. Task termination must be achieved by calling STB_OSDestroyTask() More...
 
void STB_OSTaskDelay (U16BIT timeout)
 Delay Task for Specifed Time Period. More...
 
void STB_OSDestroyTask (void *task)
 Delete Task must be called upon termination of each task as it frees all OS specific resources allocated for the specific task.
 
void * STB_OSCreateQueue (U16BIT msg_size, U16BIT msg_max)
 Create Queue of given number of messages and size of message. More...
 
BOOLEAN STB_OSReadQueue (void *queue, void *msg, U16BIT msg_size, U16BIT timeout)
 Read a message from a queue. More...
 
BOOLEAN STB_OSWriteQueue (void *queue, void *msg, U16BIT msg_size, U16BIT timeout)
 Write a message to the queue. More...
 
BOOLEAN STB_OSDestroyQueue (void *queue)
 Destroy Queue. More...
 
void * STB_OSCreateSemaphore (void)
 Create a Binary Semaphore. That is maximum value of 1. The initial value should be 1, so that first call to STB_OSSemaphoreWait will not block. More...
 
void * STB_OSCreateCountSemaphore (U32BIT value)
 Create a counting semaphore. More...
 
void STB_OSSemaphoreWait (void *semaphore)
 Wait on Semaphore Indefinity or Until Released. More...
 
void STB_OSSemaphoreSignal (void *semaphore)
 Signal a Semaphore to Release it by decrementing its counter. More...
 
BOOLEAN STB_OSSemaphoreWaitTimeout (void *semaphore, U16BIT timeout)
 Wait on Semaphore for Set Time Period in an Attempt to Acquire. More...
 
void STB_OSDeleteSemaphore (void *semaphore)
 Delete a Semaphore. More...
 
void * STB_OSCreateMutex (void)
 Create a mutex. More...
 
void STB_OSMutexLock (void *mutex)
 Lock a mutex (a.k.a. 'enter', 'wait' or 'get'). More...
 
void STB_OSMutexUnlock (void *mutex)
 Unlock a mutex (a.k.a. 'leave', 'signal' or 'release') More...
 
void STB_OSDeleteMutex (void *mutex)
 Delete a mutex. More...
 

Detailed Description

Header file - Function prototypes for operating system.

Date
12/02/2002
Author
Adam Sturtridge

Function Documentation

void* STB_OSCreateCountSemaphore ( U32BIT  value)

Create a counting semaphore.

Parameters
valueinitial value for semaphore.
Returns
Seamphore handle upon success, or NULL upon failure.
void* STB_OSCreateMutex ( void  )

Create a mutex.

Returns
Newly created mutex, or NULL.
void* STB_OSCreateQueue ( U16BIT  msg_size,
U16BIT  msg_max 
)

Create Queue of given number of messages and size of message.

Parameters
msg_sizeQueue Message Packet Size
num_msgsQueue Message Depth in Packets
Returns
Queue Handle - Number for success, NULL upon failure.
void* STB_OSCreateSemaphore ( void  )

Create a Binary Semaphore. That is maximum value of 1. The initial value should be 1, so that first call to STB_OSSemaphoreWait will not block.

Returns
Seamphore Handle Address upon success, or NULL upon failure.
void* STB_OSCreateTask ( void(*)(void *)  function,
void *  param,
U32BIT  stack,
U8BIT  priority,
U8BIT *  name 
)

Create a New Task to the calling process. Upon success, the created task runs on its own stack, as part of the calling process context. Task termination must be achieved by calling STB_OSDestroyTask()

Parameters
functiontask entry point
paramuser defined parameter passed when task is started
stackstack size
prioritytask priority, min 0, max 15
nametask name
Returns
handle of task
void STB_OSDeleteMutex ( void *  mutex)

Delete a mutex.

Parameters
mutex_varThe mutex to delete.
void STB_OSDeleteSemaphore ( void *  semaphore)

Delete a Semaphore.

Parameters
semaphoreSemaphore handle.
Returns
TRUE for success, FALSE upon failure.
BOOLEAN STB_OSDestroyQueue ( void *  queue)

Destroy Queue.

Parameters
queueUnique Queue Handle Identifier Variable Address.
Returns
TRUE for success, FALSE upon failure.
U32BIT STB_OSGetClockMilliseconds ( void  )

Get Current Computer Clock Time.

Returns
Time in Milliseconds.
void STB_OSMutexLock ( void *  mutex)

Lock a mutex (a.k.a. 'enter', 'wait' or 'get').

Parameters
mutex_varThe mutex to lock.
void STB_OSMutexUnlock ( void *  mutex)

Unlock a mutex (a.k.a. 'leave', 'signal' or 'release')

Parameters
mutex_varThe mutex to unlock.
BOOLEAN STB_OSReadQueue ( void *  queue,
void *  msg,
U16BIT  msg_size,
U16BIT  timeout 
)

Read a message from a queue.

Parameters
queueQueue Handle
dataUser's Read Message Buffer Start Address.
msg_sizeMessage Packet Size in Bytes.
timeouttimeout in milliseconds
Returns
TRUE for success, FALSE upon failure.
void STB_OSSemaphoreSignal ( void *  semaphore)

Signal a Semaphore to Release it by decrementing its counter.

Parameters
semaphoreSemaphore handle.
void STB_OSSemaphoreWait ( void *  semaphore)

Wait on Semaphore Indefinity or Until Released.

Parameters
semaphoreSemaphore handle.
Returns
TRUE for success, FALSE upon failure.
BOOLEAN STB_OSSemaphoreWaitTimeout ( void *  semaphore,
U16BIT  timeout 
)

Wait on Semaphore for Set Time Period in an Attempt to Acquire.

Parameters
semaphoreSemaphore handle.
timeoutTime Period to Wait in milliseconds.
Returns
TRUE for success, FALSE upon failure.
void STB_OSTaskDelay ( U16BIT  timeout)

Delay Task for Specifed Time Period.

Parameters
timeoutdelay in milliSeconds.
BOOLEAN STB_OSWriteQueue ( void *  queue,
void *  msg,
U16BIT  msg_size,
U16BIT  timeout 
)

Write a message to the queue.

Parameters
queueQueue Handle
datamessage to be queued
msg_sizesize of message in bytes
timeouttimeout in milliseconds
Returns
TRUE for success, FALSE upon failure.