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