comparison src/cs/layer1/dyn_dwl_cfile/l1_dyn_dwl_sync.c @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /************* Revision Controle System Header *************
2 * GSM Layer 1 software
3 * L1_DYN_DWL_SYNC.C
4 *
5 * Filename l1_dyn_dwl_sync.c
6 * Copyright 2004 (C) Texas Instruments
7 *
8 ************* Revision Controle System Header *************/
9
10 #include <stdio.h>
11 #include <string.h>
12
13 #include "nucleus.h"
14 #include "l1_confg.h"
15 #include "l1_types.h"
16 #include "sys_types.h"
17 #include "cust_os.h"
18 #include "l1audio_signa.h"
19 #include "l1audio_const.h"
20 #include "l1audio_cust.h"
21 #include "l1audio_defty.h"
22 #include "l1_const.h"
23 #include "l1tm_defty.h"
24 #if (L1_GTT == 1)
25 #include "l1gtt_const.h"
26 #include "l1gtt_defty.h"
27 #endif
28 #if (L1_DYN_DSP_DWNLD==1)
29 #include "l1_dyn_dwl_defty.h"
30 #include "l1_dyn_dwl_msgty.h"
31 #include "l1_dyn_dwl_const.h"
32 #include "l1_dyn_dwl_signa.h"
33 #include "l1_dyn_dwl_error.h"
34 #include "l1_dyn_dwl_proto.h"
35 #include "l1_api_hisr.h"
36 #endif
37
38 #if (L1_MP3 == 1)
39 #include "l1mp3_defty.h"
40 #endif //L1_MP3
41 #if (L1_MIDI == 1)
42 #include "l1midi_defty.h"
43 #endif
44
45 #include "l1_macro.h"
46 #include "l1_defty.h"
47 #include "l1_varex.h"
48 #include "l1_trace.h"
49 #include "sys_dma.h"
50
51 #if (L1_DYN_DSP_DWNLD == 1)
52
53 extern T_DYN_DWNLD_MCU_DSP *dyn_dwl_ndb;
54
55
56 /*-------------------------------------------------------*/
57 /* l1s_dyn_dsp_dwnld_manager() */
58 /*-------------------------------------------------------*/
59 /* */
60 /* Parameters : n/a */
61 /* */
62 /* Return : n/a */
63 /* */
64 /* Description : dsp dynamic download L1S manager task. */
65 /* */
66 /*-------------------------------------------------------*/
67
68 void l1s_dyn_dwnld_manager(void)
69 {
70 enum states
71 {
72 WAIT_INIT = 0,
73 WAIT_RESULT,
74 WAIT_STOP
75 };
76
77 UWORD8 *state = &l1s.dyn_dwnld_state;
78 xSignalHeaderRec *conf_msg;
79
80 switch(*state)
81 {
82 case WAIT_INIT:
83 {
84 if(l1a_l1s_com.dyn_dwnld_task.start==TRUE)
85 {
86 // make sure the DSP is able to receive API interrupt
87 // for this, we wait 1 TDMA frame
88 // change state
89 *state=WAIT_RESULT;
90 }
91 }
92 break;
93
94 case WAIT_RESULT:
95 {
96 // reset the command
97 l1a_l1s_com.dyn_dwnld_task.start=FALSE;
98 // send start background to the DSP
99 dyn_dwl_ndb->d_api_dwl_download_ctrl = (API) C_DWL_DOWNLOAD_CTRL_INIT;
100 l1s_dsp_com.dsp_ndb_ptr->a_background_tasks[C_BGD_DSP_DYN_DWNLD] = (API)((C_BGD_DSP_DYN_DWNLD<<11) | 1);
101 l1s_dsp_com.dsp_ndb_ptr->d_background_enable|=(API)(1<<C_BGD_DSP_DYN_DWNLD);
102 l1_trigger_api_interrupt();
103
104 // change state
105 *state=WAIT_STOP;
106 }
107 break;
108
109 case WAIT_STOP:
110 {
111 if(l1a_l1s_com.dyn_dwnld_task.stop==TRUE)
112 {
113 // reset the command
114 l1a_l1s_com.dyn_dwnld_task.stop=FALSE;
115
116 // send stop background to the DSP
117 l1s_dsp_com.dsp_ndb_ptr->a_background_tasks[C_BGD_DSP_DYN_DWNLD] = (API)((C_BGD_DSP_DYN_DWNLD<<11) | 0);
118 l1s_dsp_com.dsp_ndb_ptr->d_background_enable&=(API)(~(1<<C_BGD_DSP_DYN_DWNLD));
119 l1_trigger_api_interrupt();
120
121 // send confirmation to the L1A
122 conf_msg=os_alloc_sig(0);
123 DEBUGMSG(status,NU_ALLOC_ERR)
124 conf_msg->SignalCode=L1_DYN_DWNLD_STOP_CON;
125 os_send_sig(conf_msg,L1C1_QUEUE);
126 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
127
128 // change state
129 *state=WAIT_INIT;
130 }
131 }
132 break;
133 }
134 }
135
136 #endif // L1_DYN_DSP_DWNLD==1
137