49 #define STB_PVR_MSG_PRINT(x) STB_SPDebugWrite x 51 #define STB_PVR_MSG_PRINT(x) 71 static U16BIT last_handle_value;
72 static BOOLEAN new_messages;
73 static void *msg_mutex;
89 STB_PVR_MSG_PRINT((
"PVR MSG - InitialiseMessages"));
91 if (msg_mutex == NULL)
95 last_handle_value = 0;
115 U32BIT num_bytes_in_string;
126 if (msg_mutex != NULL)
129 if (num_bytes_in_string > 0)
135 handle = last_handle_value;
140 msg_ptr = GetHandleStatus(handle);
142 while (msg_ptr != NULL);
144 last_handle_value = handle;
154 msg_ptr->handle = handle;
155 msg_ptr->date = cur_date;
156 msg_ptr->hour = cur_hour;
157 msg_ptr->min = cur_min;
159 memcpy(&msg_ptr->message, message, num_bytes_in_string);
162 if (msg_head == NULL)
169 msg_ptr->prev = msg_tail;
170 msg_tail->next = msg_ptr;
197 ret_val = new_messages;
198 new_messages = FALSE;
218 if (msg_mutex != NULL)
223 while (msg_ptr != NULL)
226 msg_ptr = msg_ptr->next;
234 return(num_messages);
247 FUNCTION_START(STB_PVRDeleteHandle);
251 if (msg_mutex != NULL)
256 msg_ptr = GetHandleStatus(handle);
260 if (msg_ptr->prev != NULL)
263 msg_ptr->prev->next = msg_ptr->next;
268 msg_head = msg_ptr->next;
269 if (msg_head != NULL)
271 msg_head->prev = NULL;
275 if (msg_ptr->next != NULL)
278 msg_ptr->next->prev = msg_ptr->prev;
283 msg_tail = msg_tail->prev;
284 if (msg_tail != NULL)
286 msg_tail->next = NULL;
313 U16BIT i, num_messages;
318 if (msg_mutex != NULL)
323 if (num_messages > 0)
325 *handle_array = (U16BIT *)
STB_GetMemory(num_messages *
sizeof(U16BIT));
326 if (*handle_array != NULL)
329 for (i = 0; (i < num_messages) && (msg_ptr != NULL); i++)
331 (*handle_array)[i] = msg_ptr->handle;
332 msg_ptr = msg_ptr->next;
350 return(num_messages);
370 if (msg_mutex != NULL)
374 msg_ptr = GetHandleStatus(handle);
377 *date = msg_ptr->date;
378 *hour = msg_ptr->hour;
406 if (msg_mutex != NULL)
410 msg_ptr = GetHandleStatus(handle);
413 text_ptr = &msg_ptr->message;
433 FUNCTION_START(GetHandleStatus);
436 while (msg_ptr != NULL)
439 if (msg_ptr->handle == handle)
444 msg_ptr = msg_ptr->next;
447 FUNCTION_FINISH(GetHandleStatus);
void * STB_GetMemory(U32BIT bytes)
Attempts to allocate memory from the heap.
BOOLEAN STB_PVRDeleteMessage(U16BIT handle)
Deletes a message from the list.
BOOLEAN STB_PVRInitialiseMessages(void)
Initialises file that provides messages for recording er.
U16BIT STB_PVRGetNumMessages(void)
Returns the number of messages.
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. 'leave', 'signal' or 'release')
U8BIT * STB_PVRGetMessageText(U16BIT handle)
Returns a pointer to the text for the message with the given handle.
void STB_FreeMemory(void *addr)
Releases previously allocated heap memory.
Debug functions header file.
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. 'enter', 'wait' or 'get').
Header file - macros and function prototypes for public use.
void STB_GCGetGMTDateTime(U16BIT *code, U8BIT *hour, U8BIT *min, U8BIT *secs)
Reads the current GMT date code and time.
Header for STB unicode string handling routines.
BOOLEAN STB_PVRAddMessage(U8BIT *message)
Adds a message to the end of the list of existing messages.
U32BIT STB_GetNumBytesInString(U8BIT *string_ptr)
Determines the no of bytes of the given string.
Header file - Function prototypes for operating system.
System Wide Global Technical Data Type Definitions.
BOOLEAN STB_PVRCheckMessages(void)
Check for new messages and clear the new message flag.
Header file - Function prototypes for heap memory.
void * STB_OSCreateMutex(void)
Create a mutex.
U16BIT STB_PVRGetMessages(U16BIT **handle_array)
Returns an allocated array of the message handles and number of messages currently in the list...
BOOLEAN STB_PVRGetMessageInfo(U16BIT handle, U16BIT *date, U8BIT *hour, U8BIT *min)
Gets date/time for the message with the given handle.