DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
Macros | Functions
stbhwos.h File Reference

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

#include "techtype.h"

Go to the source code of this file.

Macros

#define HW_EV_CLASS_HANDSET   0
 
#define HW_EV_CLASS_KEYPAD   1
 
#define HW_EV_CLASS_LNB   2
 
#define HW_EV_CLASS_TUNER   3
 
#define HW_EV_CLASS_DECODE   4
 
#define HW_EV_CLASS_SCART   5
 
#define HW_EV_CLASS_DISK   6
 
#define HW_EV_CLASS_DVD   7
 
#define HW_EV_CLASS_PVR   8
 
#define HW_EV_CLASS_USB   9
 
#define HW_EV_CLASS_HDMI   10
 
#define HW_EV_CLASS_CEC   11
 
#define HW_EV_CLASS_PRIVATE   255 /* Class to allow events to be created that are unique to a platform */
 
#define HW_EV_TYPE_FALSE   0
 
#define HW_EV_TYPE_TRUE   1
 
#define HW_EV_TYPE_LOCKED   2
 
#define HW_EV_TYPE_NOTLOCKED   3
 
#define HW_EV_TYPE_AUDIO_STARTED   4
 
#define HW_EV_TYPE_VIDEO_STARTED   5
 
#define HW_EV_TYPE_AUDIO_STOPPED   6
 
#define HW_EV_TYPE_VIDEO_STOPPED   7
 
#define HW_EV_TYPE_4_3   8
 
#define HW_EV_TYPE_16_9   9
 
#define HW_EV_TYPE_SIGNAL_DATA_BAD   10
 
#define HW_EV_TYPE_SIGNAL_DATA_OK   11
 
#define HW_EV_TYPE_FORMAT_COMPLETE   12
 
#define HW_EV_TYPE_FORMAT_FAILED   13
 
#define HW_EV_TYPE_REPAIR_COMPLETE   14
 
#define HW_EV_TYPE_REPAIR_FAILED   15
 
#define HW_EV_TYPE_DVD_DISK_INSERTED   16
 
#define HW_EV_TYPE_DVD_DISK_REMOVED   17
 
#define HW_EV_TYPE_PVR_REC_START   18
 
#define HW_EV_TYPE_PVR_REC_STOP   19
 
#define HW_EV_TYPE_PVR_PLAY_START   20
 
#define HW_EV_TYPE_PVR_PLAY_STOP   21
 
#define HW_EV_TYPE_PVR_PLAY_BOF   22 /* Playback has reached the beginning of the file */
 
#define HW_EV_TYPE_PVR_PLAY_EOF   23 /* Playback has reached the end of the file */
 
#define HW_EV_TYPE_PVR_PLAY_NOTIFY_TIME   24 /* Playback has reached the end of the file */
 
#define HW_EV_TYPE_SAMPLE_STOPPED   25
 
#define HW_EV_TYPE_DISK_CONNECTED   26
 
#define HW_EV_TYPE_DISK_REMOVED   27
 
#define HW_EV_TYPE_DISK_FULL   28
 
#define HW_EV_TYPE_HDMI_CONNECT   29
 
#define HW_EV_TYPE_HDMI_DISCONNECT   30
 
#define HW_EV_TYPE_CEC_PLAY   31
 
#define HW_EV_TYPE_CEC_STANDBY   32
 
#define HW_EV_TYPE_AD_STARTED   34
 
#define HW_EV_TYPE_AD_STOPPED   35
 
#define HW_EV_TYPE_VIDEO_UNDERFLOW   36
 
#define HW_EV_TYPE_AUDIO_UNDERFLOW   37
 
#define TIMEOUT_NOW   0
 
#define TIMEOUT_NEVER   0xffff
 

Functions

void STB_OSInitialise (void)
 Allows setting of initial boot time.
 
void STB_OSRegisterCallback (void(*func)(BOOLEAN, U16BIT, U16BIT, void *, U32BIT))
 Register the function that will be called when STB_OSSendEvent is used. More...
 
void STB_OSSendEvent (BOOLEAN repeat, U16BIT event_class, U16BIT event_type, void *data, U32BIT data_size)
 Send an event by calling the registered callback function. More...
 
void STB_OSSetClockRTC (U32BIT num_seconds)
 Set the local time in seconds since midnight 1-1-1970. More...
 
U32BIT STB_OSGetClockRTC (void)
 Returns the current time in seconds. This is calculated by using the set UTC time and adding the difference between the system boot time when it was set (sync_time) and the system boot time now. More...
 
void STB_OSSetClockGMT (U32BIT num_seconds)
 Set the time in seconds since midnight 1-1-1970 in GMT. More...
 
U32BIT STB_OSGetClockGMT (void)
 Returns the system time in seconds. More...
 
U32BIT STB_OSGetClockMilliseconds (void)
 Get Current Computer Clock Time. More...
 
U32BIT STB_OSGetClockDiff (U32BIT timestamp)
 Get Difference between Given Time and Current 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_OSTaskSuspend (void)
 Suspend the calling task.
 
void STB_OSTaskDelay (U16BIT timeout)
 Delay Task for Specifed Time Period. More...
 
void STB_OSTaskSleep (void)
 Put Calling Task to Sleep. This is the equivalent of a Task Reschedule which is useful when a task wants to release the CPU on an application preemption point.
 
void STB_OSTaskWakeUp (void)
 Wake up a task that was put to sleep when it called STB_OSTaskSleep().
 
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.
 
U8BIT STB_OSTaskPriority (void *task, U8BIT priority)
 Set a New Priority Level for Specified Task. More...
 
void STB_OSTaskLock (void)
 Lock the calling task. Prevents task scheduler from preempting calling task and should always be used as a pair with STB_OSTaskUnlock() to create a critical region of code execution that cannot be interrupted by another task.
 
void STB_OSTaskUnlock (void)
 Unlock the calling task. Allows task scheduler to preempting calling task and should always be used as a pair with STB_OSTaskLock() to create a critical region of code execution that cannot be interrupted by another task.
 
void * STB_OSGetCurrentTask (void)
 Returns the handle of the current task. More...
 
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 Semaphore. More...
 
void * STB_OSCreateCountSemaphore (U32BIT value)
 Create a counting semaphore. More...
 
void STB_OSInitCountSemaphore (void *semaphore, U32BIT value)
 Initialise a counting semaphore. More...
 
void STB_OSDeleteSemaphore (void *semaphore)
 Delete a 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_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...
 
void STB_OSResetCPU (void)
 Reset the board.
 

Detailed Description

Header file - Function prototypes for operating system.

Date
12/02/2002

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 Semaphore.

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_OSGetClockDiff ( U32BIT  timestamp)

Get Difference between Given Time and Current Time.

Parameters
timestampGiven Clock Value to Compare Against.
Returns
Time Difference in MilliSeconds.
U32BIT STB_OSGetClockGMT ( void  )

Returns the system time in seconds.

Returns
system time in seconds
U32BIT STB_OSGetClockMilliseconds ( void  )

Get Current Computer Clock Time.

Returns
Time in Milliseconds.
U32BIT STB_OSGetClockRTC ( void  )

Returns the current time in seconds. This is calculated by using the set UTC time and adding the difference between the system boot time when it was set (sync_time) and the system boot time now.

Returns
The current time in seconds since midnight 1-1-1970.
void* STB_OSGetCurrentTask ( void  )

Returns the handle of the current task.

Returns
Handle of current task
void STB_OSInitCountSemaphore ( void *  semaphore,
U32BIT  value 
)

Initialise a counting semaphore.

Parameters
semaphoreSemaphore handle.
valueNew value for semaphore.
Warning
This is a very dangerous function, and should be used very carefully.
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_OSRegisterCallback ( void(*)(BOOLEAN, U16BIT, U16BIT, void *, U32BIT)  func)

Register the function that will be called when STB_OSSendEvent is used.

Parameters
funccallback function
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_OSSendEvent ( BOOLEAN  repeat,
U16BIT  event_class,
U16BIT  event_type,
void *  data,
U32BIT  data_size 
)

Send an event by calling the registered callback function.

Parameters
repeatTRUE if the event is a repeat of the last event
event_classevent class
event_typeevent identifier.
datapointer to the data associated with the event
data_sizesize of the data pointed by data_pointer
void STB_OSSetClockGMT ( U32BIT  num_seconds)

Set the time in seconds since midnight 1-1-1970 in GMT.

Parameters
num_secondstime in seconds
void STB_OSSetClockRTC ( U32BIT  num_seconds)

Set the local time in seconds since midnight 1-1-1970.

Parameters
num_secondstime in seconds
void STB_OSTaskDelay ( U16BIT  timeout)

Delay Task for Specifed Time Period.

Parameters
timeoutdelay in milliSeconds.
U8BIT STB_OSTaskPriority ( void *  task,
U8BIT  priority 
)

Set a New Priority Level for Specified Task.

Parameters
tasktask whose priority is to be changed
prioritynew priority
Returns
Old task priority
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.