FreeCalypso > hg > freecalypso-sw
comparison nuc-fw/serial/init.c @ 117:e40d8661ecab
nuc-fw: low-level serial code should be complete
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Mon, 28 Oct 2013 07:35:47 +0000 |
parents | |
children | 789a9a95533f |
comparison
equal
deleted
inserted
replaced
116:22c8199e08af | 117:e40d8661ecab |
---|---|
1 #include "../include/config.h" | |
2 #include "../include/sys_types.h" | |
3 | |
4 #include "serialswitch.h" | |
5 | |
6 #include <string.h> | |
7 | |
8 /* | |
9 * Serial Configuration set up. | |
10 */ | |
11 | |
12 /* | |
13 ** One config is: | |
14 ** {XXX_BT_HCI, // Bluetooth HCI | |
15 ** XXX_FAX_DATA, // Fax/Data AT-Cmd | |
16 ** XXX_TRACE, // L1/Riviera Trace Mux | |
17 ** XXX_TRACE}, // Trace PS | |
18 ** | |
19 ** with XXX being DUMMY, UART_IRDA or UART_MODEM | |
20 */ | |
21 | |
22 const T_AppliSerialInfo appli_ser_cfg_info = { | |
23 /* | |
24 * Default configuration: for now we always set it | |
25 * to the "standard" 0x0168; later we may add | |
26 * compile-time conditionals based on FreeCalypso | |
27 * configuration magic. | |
28 */ | |
29 {DUMMY_BT_HCI, | |
30 UART_MODEM_FAX_DATA, | |
31 UART_IRDA_TRACE, | |
32 DUMMY_TRACE}, // default config = 0x0168 | |
33 #ifdef BTEMOBILE | |
34 12, // 12 serial config allowed | |
35 #else // BTEMOBILE | |
36 9, // 9 serial config allowed | |
37 #endif | |
38 { | |
39 // Configs with Condat Panel only | |
40 {DUMMY_BT_HCI, | |
41 DUMMY_FAX_DATA, | |
42 DUMMY_TRACE, | |
43 UART_IRDA_TRACE}, // 0x1048 | |
44 {DUMMY_BT_HCI, | |
45 DUMMY_FAX_DATA, | |
46 DUMMY_TRACE, | |
47 UART_MODEM_TRACE}, // 0x2048 | |
48 // Configs with L1/Riviera Trace only | |
49 {DUMMY_BT_HCI, | |
50 DUMMY_FAX_DATA, | |
51 UART_IRDA_TRACE, | |
52 DUMMY_TRACE}, // 0x0148 | |
53 {DUMMY_BT_HCI, | |
54 DUMMY_FAX_DATA, | |
55 UART_MODEM_TRACE, | |
56 DUMMY_TRACE}, // 0x0248 | |
57 // Configs with AT-Cmd only | |
58 {DUMMY_BT_HCI, | |
59 UART_MODEM_FAX_DATA, | |
60 DUMMY_TRACE, | |
61 DUMMY_TRACE}, // 0x0068 | |
62 // Configs with Condat Panel and L1/Riviera Trace | |
63 {DUMMY_BT_HCI, | |
64 DUMMY_FAX_DATA, | |
65 UART_MODEM_TRACE, | |
66 UART_IRDA_TRACE}, // 0x1248 | |
67 {DUMMY_BT_HCI, | |
68 DUMMY_FAX_DATA, | |
69 UART_IRDA_TRACE, | |
70 UART_MODEM_TRACE}, // 0x2148 | |
71 // Configs with Condat Panel and AT-Cmd | |
72 {DUMMY_BT_HCI, | |
73 UART_MODEM_FAX_DATA, | |
74 DUMMY_TRACE, | |
75 UART_IRDA_TRACE}, // 0x1068 | |
76 #ifdef BTEMOBILE | |
77 // Configs with L1/Riviera Trace and Bluetooth HCI | |
78 {UART_IRDA_BT_HCI, | |
79 DUMMY_FAX_DATA, | |
80 UART_MODEM_TRACE, | |
81 DUMMY_TRACE}, // 0x0249 | |
82 {UART_MODEM_BT_HCI, | |
83 DUMMY_FAX_DATA, | |
84 UART_IRDA_TRACE, | |
85 DUMMY_TRACE}, // 0x014A | |
86 // Configs with AT-Cmd and Bluetooth HCI | |
87 {UART_IRDA_BT_HCI, | |
88 UART_MODEM_FAX_DATA, | |
89 DUMMY_TRACE, | |
90 DUMMY_TRACE}, // 0x0069 | |
91 #endif // BTEMOBILE | |
92 // Configs with L1/Riviera Trace and AT-Cmd | |
93 {DUMMY_BT_HCI, | |
94 UART_MODEM_FAX_DATA, | |
95 UART_IRDA_TRACE, | |
96 DUMMY_TRACE} // 0x0168 | |
97 } | |
98 }; | |
99 | |
100 /* | |
101 * Init_Serial_Flows | |
102 * | |
103 * Performs Serialswitch + related serial data flows initialization. | |
104 */ | |
105 | |
106 void Init_Serial_Flows (void) | |
107 { | |
108 #if 1 //(OP_L1_STANDALONE == 0) | |
109 | |
110 /* | |
111 * Initialize Serial Switch module. | |
112 */ | |
113 #if ((BOARD==35) || (BOARD == 46)) | |
114 SER_InitSerialConfig (GC_GetSerialConfig()); | |
115 #else | |
116 SER_InitSerialConfig (&appli_ser_cfg_info); | |
117 #endif | |
118 /* | |
119 * Then Initialize the Serial Data Flows and the associated UARTs: | |
120 * - G2-3 Trace if GSM/GPRS Protocol Stack | |
121 * - AT-Cmd/Fax & Data Flow | |
122 * | |
123 * Layer1/Riviera Trace Flow and Bluetooth HCI Flow are initialized | |
124 * by the appropriate SW Entities. | |
125 * | |
126 * G2-3 Trace => No more Used | |
127 */ | |
128 SER_tr_Init(SER_PROTOCOL_STACK, TR_BAUD_38400, NULL); | |
129 | |
130 /* | |
131 * Fax & Data / AT-Command Interpreter Serial Data Flow Initialization | |
132 */ | |
133 | |
134 #if ((BOARD != 35) && (BOARD != 46)) | |
135 (void) SER_fd_Initialize (); | |
136 #endif | |
137 #else /* OP_L1_STANDALONE */ | |
138 | |
139 #if (TESTMODE || (TRACE_TYPE==1) || (TRACE_TYPE==2) || (TRACE_TYPE==3) || (TRACE_TYPE==6) || (TRACE_TYPE==7)) | |
140 #if ((BOARD == 35) || (BOARD == 46)) | |
141 ser_cfg_info[UA_UART_0] = '0'; | |
142 #else | |
143 ser_cfg_info[UA_UART_0] = 'G'; | |
144 #endif | |
145 #if (CHIPSET !=15) | |
146 ser_cfg_info[UA_UART_1] = 'R'; // Riviear Demux on UART MODEM | |
147 #else | |
148 ser_cfg_info[UA_UART_0] = 'R'; // Riviear Demux on UART MODEM | |
149 #endif | |
150 | |
151 /* init Uart Modem */ | |
152 SER_InitSerialConfig (&appli_ser_cfg_info); | |
153 | |
154 #if TESTMODE || (TRACE_TYPE == 1) || (TRACE_TYPE == 7) | |
155 SER_tr_Init (SER_LAYER_1, TR_BAUD_115200, rvt_activate_RX_HISR); | |
156 | |
157 rvt_register_id("OTHER",&trace_id,(RVT_CALLBACK_FUNC)NULL); | |
158 #else | |
159 SER_tr_Init (SER_LAYER_1, TR_BAUD_38400, NULL); | |
160 #endif | |
161 | |
162 L1_trace_string(" \n\r"); | |
163 | |
164 #endif /* TRACE_TYPE */ | |
165 | |
166 #endif /* OP_L1_STANDALONE */ | |
167 } |