32 #define UP_MSGS_WHEN_Q_FULL 41 #define CRITICAL_Q_SIZE (1 << 3) 42 #define HIGH_Q_SIZE (1 << 3) 43 #define NORMAL_Q_SIZE (1 << 8) 44 #define LOW_Q_SIZE (1 << 4) 48 #define EXCLUSION_RATIO (35) 64 static void *vq_read_sema = 0;
65 static void *queue_mutex = 0;
74 static int show_yeild_failure = 0;
77 static int put_sema_total = 0;
78 static int get_sema_total = 0;
79 static int put_msg_total[
PRTY_INVALID] = {0, 0, 0, 0, 0};
80 static int get_msg_total[
PRTY_INVALID] = {0, 0, 0, 0, 0};
81 #if defined(STACK_DEBUGGING) 82 void STB_OSTaskPrint(
void);
100 if (queue_mutex != 0)
107 if (queue_mutex == NULL)
109 TRACE(TERROR, (
"failed to create mutex"));
113 if (vq_read_sema == NULL)
115 TRACE(TERROR, (
"failed to create semaphore"));
122 if (msg_queue[i] == NULL)
161 p_queue = msg_queue[i];
201 if (nx == queue_size[i])
258 if (queue_mutex == 0)
260 TRACE(TERROR, (
"Queue not open"));
265 p_queue = msg_queue[priority];
273 if (new_ndx == queue_size[priority])
283 p += put_msg_total[i];
284 g += get_msg_total[i];
286 TRACE(TQUEUE, (
"QQQ FULL sema=(%d,%d) qp=(%d,%d) all=(%d,%d) QQQ FULL",
287 put_sema_total, get_sema_total, put_msg_total[priority], get_msg_total[priority], p, g))
289 TRACE(TWARN | TQUEUE, (
"VGR QUEUE(%d) is FULL", priority))
292 show_yeild_failure = 1;
300 vqn = vq_notify_head;
309 if (SizeFree(priority) < (queue_size[priority] >> 2))
311 urgent_priority = priority;
313 vqn = vq_notify_head;
322 Q_STATS(put_msg_total[priority]++; )
352 if (put_sema_total == get_sema_total)
383 p_queue = msg_queue[i];
390 if (nxt_ndx == queue_size[i])
398 vqn = vq_notify_head;
411 SizeFree(urgent_priority) > ((queue_size[urgent_priority] * 3) >> 2))
420 p += put_msg_total[i];
421 g += get_msg_total[i];
423 if (put_sema_total - get_sema_total != p - g)
425 TRACE(TQUEUE, (
"QQQ sema=(%d,%d) all=(%d,%d) QQQ", put_sema_total, get_sema_total, p, g))
439 if (queue_mutex == 0)
446 count = SizeFree(priority);
462 if (queue_mutex != NULL)
468 TRACE(TQUEUE, (
"Critical MESSAGE"))
477 if (SizeFree(priority) < (queue_size[priority] >> 2))
479 urgent_priority = priority;
480 TRACE(TQUEUE, (
"Priority %d low on space", priority))
489 if (!needed && show_yeild_failure)
493 TRACE(TQUEUE, (
"p=%d, fsz=%d qsz=%d", priority, SizeFree(priority), queue_size[priority] >> 2));
495 show_yeild_failure = 0;
519 vqn->
next = vq_notify_head;
520 vq_notify_head = vqn;
534 ppvqn = &vq_notify_head;
539 *ppvqn = (*ppvqn)->
next;
543 ppvqn = &((*ppvqn)->next);
U32BIT STB_OSGetClockMilliseconds(void)
Get Current Computer Clock Time.
void STB_OSSemaphoreWait(void *semaphore)
Wait on Semaphore Indefinity or Until Released.
void VQ_Close(void)
Close component control and section queue component. Destroys all allocated memory and resources for ...
U16BIT VQ_GetSizeFree(E_PRIORITY priority)
Get size available on a queue.
#define FUNCTION_FINISH(name)
F_MSG_PROCESS proc_msg_func
E_MhegErr VQ_GetMsg(S_MhegMessage *pMsg)
Get an event or section from the component queues. This is a blocking function.
F_QueueNotify normal_rcvd_func
void STB_OSDeleteMutex(void *mutex)
Delete a mutex.
void(* F_QueueNotify)(void)
E_MhegErr VQ_Open(S_MhegConfig *cfg_params)
Initialise component control and section queues. Allocates memory for, sets up and creates event (com...
F_QueueNotify critical_rcvd_func
BOOLEAN VQ_EventNeedsProcessing(void)
Check whether any events on component queues needs processing.
struct s_q_notify S_Q_NOTIFY
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. 'leave', 'signal' or 'release')
void STR_DataFree(unsigned char *data, unsigned int size)
void * STB_OSCreateMutex(void)
Create a mutex.
void VQ_UnRegisterNotify(void *qn)
System Wide Global Technical Data Type Definitions.
F_QueueNotify critical_done_func
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. 'enter', 'wait' or 'get').
E_MhegErr VQ_PutMsg(S_MhegMessage *pMsg, E_PRIORITY priority)
Post an event or section into component queues. Copies data into queue.
void * VQ_RegisterNotify(F_QueueNotify normal_rcvd, F_QueueNotify critical_rcvd, F_QueueNotify critical_done)
union s_mhg_message::@13 data
#define FUNCTION_START(name)
void * STB_OSCreateCountSemaphore(U32BIT value)
Create a counting semaphore.
struct s_msg_queue S_MSG_QUEUE
void STB_OSDeleteSemaphore(void *semaphore)
Delete a Semaphore.
void STB_OSSemaphoreSignal(void *semaphore)
Signal a Semaphore to Release it by decrementing its counter.
Header file - Function prototypes for operating system.