comparison src/cs/services/audio/audio_bgd/audio_bgd_task.c @ 0:92470e5d0b9e

src: partial import from FC Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 May 2020 01:28:16 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92470e5d0b9e
1 /****************************************************************************/
2 /* */
3 /* Name audio_bgd_task.c */
4 /* */
5 /* Function this file contains the main AUDIO BACKGROUND functionk */
6 /* */
7 /* Version 1 */
8 /* */
9 /* Date Modification */
10 /* ------------------------------------ */
11 /* 19 June 2003 Create */
12 /* */
13 /* Author Frederic Turgis */
14 /* */
15 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
16 /****************************************************************************/
17
18 #include "rv/rv_defined_swe.h"
19
20 #ifdef RVM_AUDIO_BGD_SWE
21
22 #include "rv/rv_general.h"
23 #include "audio/audio_bgd/audio_bgd_structs_i.h"
24 #include "audio/audio_bgd/audio_bgd_macro_i.h"
25 #include "audio/audio_bgd/audio_bgd_const_i.h"
26 #include "audio/audio_bgd/audio_bgd_env_i.h"
27
28 /********************************************************************************/
29 /* Function audio_bgd_core */
30 /* */
31 /* Description Core of the audio background task, which waits for events */
32 /* */
33 /********************************************************************************/
34 T_RV_RET audio_bgd_core(void)
35 {
36 /* Declare local variables */
37 BOOLEAN error = FALSE;
38 T_RV_HDR *p_message = NULL;
39 UINT16 received_event= 0x0000;
40 T_RV_RET status;
41
42 AUDIO_BGD_SEND_TRACE("AUDIO_BACKGROUD TASK started", RV_TRACE_LEVEL_DEBUG_HIGH);
43
44 /* loop to process messages */
45 while (error == FALSE)
46 {
47 /* Wait for the necessary events (all events and no time out). */
48 received_event = rvf_wait ( AUDIO_BGD_ALL_EVENT_FLAGS, AUDIO_BGD_NOT_TIME_OUT);
49
50 /* If an event is received, then ....*/
51 if (received_event & AUDIO_BGD_TASK_MBOX_EVT_MASK)
52 {
53 /* Read the message in the audio mailbox */
54 p_message = (T_RV_HDR *) rvf_read_mbox(AUDIO_BGD_MBOX);
55
56 if (p_message != NULL)
57 {
58 p_audio_bgd_gbl_var->message_processed = FALSE;
59
60 // Handle messages
61
62 // Check message has been processed
63 if (p_audio_bgd_gbl_var->message_processed == FALSE)
64 {
65 AUDIO_BGD_SEND_TRACE_PARAM(" AUDIO BGD ERROR (env). A wrong message is received ",
66 p_message->msg_id, RV_TRACE_LEVEL_ERROR);
67 }
68 status = rvf_free_buf((T_RVF_BUFFER *)p_message);
69 if (status != RVF_GREEN)
70 {
71 AUDIO_BGD_SEND_TRACE(" AUDIO BGD ERROR (env). Can't deallocate message",
72 RV_TRACE_LEVEL_ERROR);
73 }
74 } // if (p_message != NULL)
75 else
76 {
77 AUDIO_BGD_SEND_TRACE(" AUDIO BGD ERROR (env). Can't read the message received",
78 RV_TRACE_LEVEL_ERROR);
79 }
80 } // if (received_event & AUDIO_BGD_TASK_MBOX_EVT_MASK)
81
82 /* If one of the occured events is unexpected (due to an unassigned */
83 /* mailbox), then report an internal error. */
84 if ( received_event & ~(AUDIO_BGD_TASK_MBOX_EVT_MASK) )
85 {
86 AUDIO_BGD_SEND_TRACE(" AUDIO BGD ERROR (env). One of the events is unexpected ",
87 RV_TRACE_LEVEL_ERROR);
88
89 error = TRUE;
90 }
91 } // while (error == FALSE)
92 return(RV_INTERNAL_ERR);
93 } /****************************** End of audio_bgd task function **************************/
94
95 #endif /* #ifdef RVM_AUDIO_BGD_SWE */