comparison chipsetsw/layer1/dl1/dl1_com.c @ 165:4e72d69319d6

dl1_com.c: beginning of reconstruction
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 07 Jun 2016 05:43:40 +0000
parents 10fc1fb079d7
children 5bad5a0bdec2
comparison
equal deleted inserted replaced
164:10fc1fb079d7 165:4e72d69319d6
8 * 8 *
9 * The present C code has been extracted from LoCosto's init.c, 9 * The present C code has been extracted from LoCosto's init.c,
10 * guided by the disassembly of dl1_com.obj from the Leonardo version. 10 * guided by the disassembly of dl1_com.obj from the Leonardo version.
11 */ 11 */
12 12
13 #include "config.h"
14 #include "sys_types.h"
15 #include "../../riviera/rv/general.h"
16 #include "../../nucleus/nucleus.h"
17
18 /* Include Files */ 13 /* Include Files */
19 #include <ctype.h> 14 #include <assert.h>
20 #include <stdarg.h> 15 #include <stdarg.h>
16 #include <stdio.h>
21 #include <stdlib.h> 17 #include <stdlib.h>
22 #include <string.h> 18 #include <string.h>
19
20 #include "nucleus.h"
23 21
24 #include "l1_types.h" 22 #include "l1_types.h"
25 #include "l1_confg.h" 23 #include "l1_confg.h"
26 #include "l1_const.h" 24 #include "l1_const.h"
27 25
57 55
58 #if (TRACE_TYPE == 4) 56 #if (TRACE_TYPE == 4)
59 #include "l1_defty.h" 57 #include "l1_defty.h"
60 #endif 58 #endif
61 59
62 #include "../../bsp/armio.h" 60 #include "armio.h"
63 #include "../../bsp/timer.h" 61 #include "timer.h"
64 62
65 #include "../../bsp/iq.h" 63 #include "iq.h"
66 #include "../../bsp/mem.h" 64 #include "mem.h"
67 #include "../../bsp/clkm.h" 65 #include "clkm.h"
68 #include "../../bsp/inth.h" 66 #include "inth.h"
69
70 /*
71 * The function that sets up the HISRs has an assert() macro call in it.
72 * The Leonardo version was built with the TMS470 compiler's C library
73 * version of assert() in it, which is not very useful. Here I am
74 * pulling in some GPF/VSI headers so we get the more useful GPF/VSI
75 * version of assert() instead.
76 */
77 #include "../../gpf/inc/typedefs.h"
78 #include "../../gpf/inc/vsi.h"
79 #include "../../gpf/inc/cust_os.h"
80 67
81 /* 68 /*
82 * Timing monitor 69 * Timing monitor
83 */ 70 */
84 #if (TRACE_TYPE == 4) 71 #if (TRACE_TYPE == 4)
93 UWORD32 dsp_max_cpu_load_idle_frame; 80 UWORD32 dsp_max_cpu_load_idle_frame;
94 unsigned short l1_dsp_cpu_load_trace_flag; 81 unsigned short l1_dsp_cpu_load_trace_flag;
95 #endif 82 #endif
96 #endif 83 #endif
97 84
98 #define STACK_SECTION __attribute__ ((section ("int.ram")))
99
100 #if (L1_EXT_AUDIO_MGT == 1) 85 #if (L1_EXT_AUDIO_MGT == 1)
101 NU_HISR EXT_AUDIO_MGT_hisr; 86 NU_HISR EXT_AUDIO_MGT_hisr;
102 char FAR ext_audio_mgt_hisr_stack[500] STACK_SECTION; 87 char FAR ext_audio_mgt_hisr_stack[500];
103 extern void Cust_ext_audio_mgt_hisr(void); 88 extern void Cust_ext_audio_mgt_hisr(void);
104 #endif 89 #endif
105 90
106 #if ( (L1_MP3 == 1) || (L1_MIDI == 1) || (L1_AAC == 1) || (L1_DYN_DSP_DWNLD == 1) ) // equivalent to an API_HISR flag 91 #if ( (L1_MP3 == 1) || (L1_MIDI == 1) || (L1_AAC == 1) || (L1_DYN_DSP_DWNLD == 1) ) // equivalent to an API_HISR flag
107 extern void api_hisr(void); 92 extern void api_hisr(void);
108 char FAR API_HISR_stack[0x400] STACK_SECTION; 93 #pragma DATA_SECTION (API_HISR_stack,"API_HISR_stack");
94 char FAR API_HISR_stack[0x400];
109 NU_HISR apiHISR; 95 NU_HISR apiHISR;
110 #endif // (L1_MP3 == 1) || (L1_MIDI == 1) || (L1_DYN_DSP_DWNLD == 1) 96 #endif // (L1_MP3 == 1) || (L1_MIDI == 1) || (L1_DYN_DSP_DWNLD == 1)
111 97
112 #if (FF_L1_IT_DSP_USF == 1) || (FF_L1_IT_DSP_DTX == 1) 98 #if (FF_L1_IT_DSP_USF == 1) || (FF_L1_IT_DSP_DTX == 1)
113 char FAR API_MODEM_HISR_stack[0x400] STACK_SECTION; // stack size to be tuned 99 char FAR API_MODEM_HISR_stack[0x400]; // stack size to be tuned
114 NU_HISR api_modemHISR; 100 NU_HISR api_modemHISR;
115 #endif // FF_L1_IT_DSP_USF 101 #endif // FF_L1_IT_DSP_USF
116 102
117 /* 103 /*
118 * HISR stack and semaphore needed by L1 104 * HISR stack and semaphore needed by L1
119 */ 105 */
120 #if (OP_L1_STANDALONE == 0) 106 #if (OP_L1_STANDALONE == 0)
121 #define LAYER_1_SYNC_STACK_SIZE 4000 /* matching Leonardo version */ 107 #define LAYER_1_SYNC_STACK_SIZE 4000 /* matching Leonardo version */
122 unsigned char layer_1_sync_stack[LAYER_1_SYNC_STACK_SIZE] STACK_SECTION; 108 unsigned char layer_1_sync_stack[LAYER_1_SYNC_STACK_SIZE];
123 #else 109 #else
124 #if TESTMODE 110 #if TESTMODE
125 char FAR layer_1_sync_stack[2600 /*3600*/]; // Frame interrupt task stack for EVA3 111 char FAR layer_1_sync_stack[2600 /*3600*/]; // Frame interrupt task stack for EVA3
126 #else 112 #else
127 char FAR layer_1_sync_stack[1600 /* 2600 */]; // Frame interrupt task stack for EVA3 113 char FAR layer_1_sync_stack[1600 /* 2600 */]; // Frame interrupt task stack for EVA3
132 118
133 /* forward declaration */ 119 /* forward declaration */
134 void layer_1_sync_HISR_entry (void); 120 void layer_1_sync_HISR_entry (void);
135 121
136 /* 122 /*
137 * l1_create_HISR 123 * l1_create_ISR
138 * 124 *
139 * Create L1 HISR. This function is called from l1_pei. 125 * Create L1 HISR. This function is called from l1_pei.
140 * 126 */
141 * Apparently this function was originally called l1_create_ISR(), 127 void l1_create_ISR (void)
142 * as that is how it appears in the Leonardo dl1_com.obj module.
143 * The LoCosto version originally had an l1_create_ISR() wrapper
144 * that simply calls l1_create_HISR(), but I plan on changing
145 * l1_pei to call l1_create_HISR() instead. -- Space Falcon
146 */
147 void l1_create_HISR (void)
148 { 128 {
149 STATUS status; 129 STATUS status;
150 130
151 #if (OP_L1_STANDALONE == 0) 131 #if (OP_L1_STANDALONE == 0)
152 // Fill the entire stack with the pattern 0xFE 132 // Fill the entire stack with the pattern 0xFE
202 assert (status == 0); 182 assert (status == 0);
203 } 183 }
204 184
205 /* 185 /*
206 * The versions of TP_FrameIntHandler() and layer_1_sync_HISR_entry() 186 * The versions of TP_FrameIntHandler() and layer_1_sync_HISR_entry()
207 * in the Leonardo dl1_com.obj module contain CPU load measurement 187 * in the TCS211 dl1_com.obj module contain CPU load measurement
208 * code, but in the LoCosto version of L1 which we are using this 188 * code. TI changed things for LoCosto, so we have to revert their
209 * functionality has been moved into L1S proper, i.e., inside the 189 * changes and restore the TCS211 way.
210 * hisr() function. 190 */
211 */ 191
192 #if (TRACE_TYPE == 4)
193 #define TIMER_RESET_VALUE (0xFFFF)
194 #define TICKS_PER_TDMA (1875)
195 #endif
212 196
213 /*-------------------------------------------------------*/ 197 /*-------------------------------------------------------*/
214 /* TP_FrameIntHandler() Low Interrupt service routine */ 198 /* TP_FrameIntHandler() Low Interrupt service routine */
215 /*-------------------------------------------------------*/ 199 /*-------------------------------------------------------*/
216 /* Parameters : */ 200 /* Parameters : */
239 l1_cpu_load_start(); 223 l1_cpu_load_start();
240 #endif 224 #endif
241 225
242 #else 226 #else
243 227
244 #if (TRACE_TYPE == 4) && (TI_NUC_MONITOR != 1) && (WCP_PROF == 1) 228 #if (TRACE_TYPE == 4) && (TI_NUC_MONITOR != 1)
245 TM_ResetTimer (2, TIMER_RESET_VALUE, 1, 0); 229 TM_ResetTimer (2, TIMER_RESET_VALUE, 1, 0);
246 TM_StartTimer (2); 230 TM_StartTimer (2);
247 #endif 231 #endif
248 232
249 #if (TI_NUC_MONITOR == 1) 233 #if (TI_NUC_MONITOR == 1)
278 void layer_1_sync_HISR_entry (void) 262 void layer_1_sync_HISR_entry (void)
279 { 263 {
280 // Call Synchronous Layer1 264 // Call Synchronous Layer1
281 hisr(); 265 hisr();
282 } 266 }
267
268 /* the following stub functions live in the dl1_com module per TCS211 */
269
270 void rx_tch_data (API *data_address,
271 UWORD8 channel_mode,
272 UWORD8 blk_seq_number)
273 {
274 }
275
276 UWORD8 *tx_tch_data (void)
277 {
278 return(NULL);
279 }