DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
stbhwos.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
24 // pre-processor mechanism so multiple inclusions don't cause compilation error
25 #ifndef _STBHWOS_H
26 
27 #define _STBHWOS_H
28 
29 #include "techtype.h"
30 
31 //---Constant and macro definitions for public use-----------------------------
32 
33 // hardware event class and types
34 #define HW_EV_CLASS_HANDSET 0
35 #define HW_EV_CLASS_KEYPAD 1
36 #define HW_EV_CLASS_LNB 2
37 #define HW_EV_CLASS_TUNER 3
38 #define HW_EV_CLASS_DECODE 4
39 #define HW_EV_CLASS_SCART 5
40 #define HW_EV_CLASS_DISK 6
41 #define HW_EV_CLASS_DVD 7
42 #define HW_EV_CLASS_PVR 8
43 #define HW_EV_CLASS_USB 9
44 #define HW_EV_CLASS_HDMI 10
45 #define HW_EV_CLASS_CEC 11
46 #define HW_EV_CLASS_PRIVATE 255 /* Class to allow events to be created that are unique to a platform */
47 
48 #define HW_EV_TYPE_FALSE 0
49 #define HW_EV_TYPE_TRUE 1
50 #define HW_EV_TYPE_LOCKED 2
51 #define HW_EV_TYPE_NOTLOCKED 3
52 
53 #define HW_EV_TYPE_AUDIO_STARTED 4
54 #define HW_EV_TYPE_VIDEO_STARTED 5
55 #define HW_EV_TYPE_AUDIO_STOPPED 6
56 #define HW_EV_TYPE_VIDEO_STOPPED 7
57 
58 #define HW_EV_TYPE_4_3 8
59 #define HW_EV_TYPE_16_9 9
60 
61 #define HW_EV_TYPE_SIGNAL_DATA_BAD 10
62 #define HW_EV_TYPE_SIGNAL_DATA_OK 11
63 
64 #define HW_EV_TYPE_FORMAT_COMPLETE 12
65 #define HW_EV_TYPE_FORMAT_FAILED 13
66 
67 #define HW_EV_TYPE_REPAIR_COMPLETE 14
68 #define HW_EV_TYPE_REPAIR_FAILED 15
69 
70 #define HW_EV_TYPE_DVD_DISK_INSERTED 16
71 #define HW_EV_TYPE_DVD_DISK_REMOVED 17
72 
73 #define HW_EV_TYPE_PVR_REC_START 18
74 #define HW_EV_TYPE_PVR_REC_STOP 19
75 #define HW_EV_TYPE_PVR_PLAY_START 20
76 #define HW_EV_TYPE_PVR_PLAY_STOP 21
77 #define HW_EV_TYPE_PVR_PLAY_BOF 22 /* Playback has reached the beginning of the file */
78 #define HW_EV_TYPE_PVR_PLAY_EOF 23 /* Playback has reached the end of the file */
79 #define HW_EV_TYPE_PVR_PLAY_NOTIFY_TIME 24 /* Playback has reached the end of the file */
80 
81 #define HW_EV_TYPE_SAMPLE_STOPPED 25
82 
83 #define HW_EV_TYPE_DISK_CONNECTED 26
84 #define HW_EV_TYPE_DISK_REMOVED 27
85 #define HW_EV_TYPE_DISK_FULL 28
86 
87 #define HW_EV_TYPE_HDMI_CONNECT 29
88 #define HW_EV_TYPE_HDMI_DISCONNECT 30
89 
90 #define HW_EV_TYPE_CEC_PLAY 31
91 #define HW_EV_TYPE_CEC_STANDBY 32
92 
93 #define HW_EV_TYPE_AD_STARTED 34
94 #define HW_EV_TYPE_AD_STOPPED 35
95 
96 #define HW_EV_TYPE_VIDEO_UNDERFLOW 36
97 #define HW_EV_TYPE_AUDIO_UNDERFLOW 37
98 
99 // timeouts for queues, semaphores etc
100 #define TIMEOUT_NOW 0
101 #define TIMEOUT_NEVER 0xffff
102 
103 //---Enumerations for public use-----------------------------------------------
104 
105 //---Global type defs for public use-------------------------------------------
106 
107 //---Global Function prototypes for public use---------------------------------
108 
112 void STB_OSInitialise(void);
113 
118 void STB_OSRegisterCallback(void (*func)(BOOLEAN, U16BIT, U16BIT, void *, U32BIT));
119 
128 void STB_OSSendEvent(BOOLEAN repeat, U16BIT event_class, U16BIT event_type, void *data, U32BIT data_size);
129 
134 void STB_OSSetClockRTC(U32BIT num_seconds);
135 
142 U32BIT STB_OSGetClockRTC(void);
143 
148 void STB_OSSetClockGMT(U32BIT num_seconds);
149 
154 U32BIT STB_OSGetClockGMT(void);
155 
160 U32BIT STB_OSGetClockMilliseconds(void);
161 
167 U32BIT STB_OSGetClockDiff(U32BIT timestamp);
168 
181 void* STB_OSCreateTask(void (*function)(void *), void *param, U32BIT stack, U8BIT priority, U8BIT *name);
182 
186 void STB_OSTaskSuspend(void);
187 
192 void STB_OSTaskDelay(U16BIT timeout);
193 
198 void STB_OSTaskSleep(void);
199 
203 void STB_OSTaskWakeUp(void);
204 
209 void STB_OSDestroyTask(void *task);
210 
217 U8BIT STB_OSTaskPriority(void *task, U8BIT priority);
218 
225 void STB_OSTaskLock(void);
226 
233 void STB_OSTaskUnlock(void);
234 
239 void* STB_OSGetCurrentTask(void);
240 
247 void* STB_OSCreateQueue(U16BIT msg_size, U16BIT msg_max);
248 
257 BOOLEAN STB_OSReadQueue(void *queue, void *msg, U16BIT msg_size, U16BIT timeout);
258 
267 BOOLEAN STB_OSWriteQueue(void *queue, void *msg, U16BIT msg_size, U16BIT timeout);
268 
274 BOOLEAN STB_OSDestroyQueue(void *queue);
275 
280 void* STB_OSCreateSemaphore(void);
281 
287 void* STB_OSCreateCountSemaphore(U32BIT value);
288 
296 void STB_OSInitCountSemaphore(void *semaphore, U32BIT value);
297 
303 void STB_OSDeleteSemaphore(void *semaphore);
304 
310 void STB_OSSemaphoreWait(void *semaphore);
311 
316 void STB_OSSemaphoreSignal(void *semaphore);
317 
324 BOOLEAN STB_OSSemaphoreWaitTimeout(void *semaphore, U16BIT timeout);
325 
330 void* STB_OSCreateMutex(void);
331 
336 void STB_OSMutexLock(void *mutex);
337 
342 void STB_OSMutexUnlock(void *mutex);
343 
348 void STB_OSDeleteMutex(void *mutex);
349 
353 void STB_OSResetCPU(void);
354 
355 #endif // _STBHWOS_H
356 
357 //*****************************************************************************
358 // End of file
359 //*****************************************************************************
360 
void STB_OSResetCPU(void)
Reset the board.
U32BIT STB_OSGetClockGMT(void)
Returns the system time in seconds.
void STB_OSTaskUnlock(void)
Unlock the calling task. Allows task scheduler to preempting calling task and should always be used a...
void STB_OSInitialise(void)
Allows setting of initial boot time.
void STB_OSSetClockRTC(U32BIT num_seconds)
Set the local time in seconds since midnight 1-1-1970.
U32BIT STB_OSGetClockDiff(U32BIT timestamp)
Get Difference between Given Time and Current Time.
void * STB_OSCreateSemaphore(void)
Create a Semaphore.
void STB_OSTaskLock(void)
Lock the calling task. Prevents task scheduler from preempting calling task and should always be used...
BOOLEAN STB_OSSemaphoreWaitTimeout(void *semaphore, U16BIT timeout)
Wait on Semaphore for Set Time Period in an Attempt to Acquire.
void STB_OSSemaphoreSignal(void *semaphore)
Signal a Semaphore to Release it by decrementing its counter.
void * STB_OSCreateCountSemaphore(U32BIT value)
Create a counting semaphore.
void STB_OSTaskSleep(void)
Put Calling Task to Sleep. This is the equivalent of a Task Reschedule which is useful when a task wa...
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.
BOOLEAN STB_OSDestroyQueue(void *queue)
Destroy Queue.
void STB_OSDestroyTask(void *task)
Delete Task must be called upon termination of each task as it frees all OS specific resources alloca...
void STB_OSDeleteSemaphore(void *semaphore)
Delete a Semaphore.
U8BIT STB_OSTaskPriority(void *task, U8BIT priority)
Set a New Priority Level for Specified Task.
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. 'leave', 'signal' or 'release')
void STB_OSTaskSuspend(void)
Suspend the calling task.
void STB_OSSemaphoreWait(void *semaphore)
Wait on Semaphore Indefinity or Until Released.
void STB_OSInitCountSemaphore(void *semaphore, U32BIT value)
Initialise a counting semaphore.
U32BIT STB_OSGetClockRTC(void)
Returns the current time in seconds. This is calculated by using the set UTC time and adding the diff...
void STB_OSRegisterCallback(void(*func)(BOOLEAN, U16BIT, U16BIT, void *, U32BIT))
Register the function that will be called when STB_OSSendEvent is used.
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. 'enter', 'wait' or 'get').
void * STB_OSGetCurrentTask(void)
Returns the handle of the current task.
BOOLEAN STB_OSWriteQueue(void *queue, void *msg, U16BIT msg_size, U16BIT timeout)
Write a message to the queue.
System Wide Global Technical Data Type Definitions.
void STB_OSSetClockGMT(U32BIT num_seconds)
Set the time in seconds since midnight 1-1-1970 in GMT.
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...
void * STB_OSCreateQueue(U16BIT msg_size, U16BIT msg_max)
Create Queue of given number of messages and size of message.
void * STB_OSCreateMutex(void)
Create a mutex.
void STB_OSTaskWakeUp(void)
Wake up a task that was put to sleep when it called STB_OSTaskSleep().
BOOLEAN STB_OSReadQueue(void *queue, void *msg, U16BIT msg_size, U16BIT timeout)
Read a message from a queue.
void STB_OSTaskDelay(U16BIT timeout)
Delay Task for Specifed Time Period.
void STB_OSDeleteMutex(void *mutex)
Delete a mutex.
U32BIT STB_OSGetClockMilliseconds(void)
Get Current Computer Clock Time.