comparison src/cs/drivers/drv_core/uart/serialswitch_core.h @ 0:945cf7f506b2

src/cs: chipsetsw import from tcs211-fcmodem binary blobs and LCD demo files have been excluded, all line endings are LF only
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Sep 2016 22:50:11 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:945cf7f506b2
1 /*******************************************************************************
2 *
3 * SERIALSWITCH_CORE.H
4 *
5 * This module allows managing the use of the serial ports of TI GSM Evaluation
6 * Boards.
7 * An application may have to send several serial data flows. The board on which
8 * the application is running may have one or several devices. The purpose of
9 * this module is to establish connections between the serial data flows and the
10 * serial devices at runtime, when the application is started.
11 *
12 * (C) Texas Instruments 1999 - 2003
13 *
14 ******************************************************************************/
15 /*
16 * 17/12/03
17 * Duplication of serialswitch.h for L1 standalone only
18 *
19 ******************************************************************************/
20
21 #ifndef __SERIALSWITCH_CORE_H__
22 #define __SERIALSWITCH_CORE_H__
23
24 #ifndef _WINDOWS
25 #include "l1sw.cfg"
26 #include "swconfig.cfg"
27 #include "chipset.cfg"
28 #endif
29
30 #ifndef __MONITOR__
31
32 #if (OP_L1_STANDALONE == 0)
33 #include "main/sys_types.h"
34 #else
35 #include "sys_types.h"
36 #endif
37
38 #include "traceswitch.h"
39 #endif /* __MONITOR__ */
40
41 #ifndef C_EXTERN
42 #if (OP_L1_STANDALONE)
43 #define C_EXTERN extern
44 #else
45 #define C_EXTERN
46 #endif
47 #endif
48
49 /*
50 * Constants used to identify the serial data flows.
51 */
52
53 #define SER_FLOW_1 (0)
54 #define SER_FLOW_2 (1)
55 #define SER_FLOW_3 (2)
56 #define SER_FLOW_4 (3)
57
58 #define SER_PROTOCOL_STACK (SER_FLOW_1)
59 #define SER_LAYER_1 (SER_FLOW_2)
60 #define SER_FAX_DATA (SER_FLOW_3)
61 #define SER_BLUETOOTH_HCI (SER_FLOW_4)
62
63 #define SER_HWTEST (SER_FLOW_1)
64 #define SER_SERIAL_TEST_1 (SER_FLOW_3)
65
66
67 #define SER_MAX_NUMBER_OF_FLOWS (4)
68
69 #define SER_MAX_NUMBER_OF_CFG (16)
70
71 /*
72 * Type used to define the various drivers configuration
73 * available, according to the UART devices.
74 */
75
76 typedef enum {
77 /* Trace Flow */
78 DUMMY_TRACE, /* = 0 */
79 UART_IRDA_TRACE, /* = 1 */
80 UART_MODEM_TRACE, /* = 2 */
81 #if (CHIPSET == 12)
82 UART_MODEM2_TRACE, /* = 3 */
83 #endif
84 /* AT-Commands/Fax & Data Flow */
85 DUMMY_FAX_DATA = 4, /* = 4 */
86 /* UART IrDA F&D Driver, not supported - should be = 5 */
87 UART_MODEM_FAX_DATA = 6, /* = 6 */
88 #if (CHIPSET == 12)
89 /* UART Modem2 F&D Driver, not supported - should be = 7 */
90 #endif
91 /* Bluetooth HCI Flow */
92 DUMMY_BT_HCI = 8, /* = 8 */
93 UART_IRDA_BT_HCI, /* = 9 */
94 UART_MODEM_BT_HCI /* = A */
95 #if (CHIPSET == 12)
96 , UART_MODEM2_BT_HCI /* = B */
97 #endif
98 } T_SerialDriver;
99
100 /*
101 * Type used to describe a defined serial configuration;
102 * Each field is a 4 bits field representing one serial flow.
103 *
104 * T_DefinedSerialConfig : [ flow_1 | flow_2 | flow_3 | flow_4 ]
105 * 15 12 11 8 7 4 3 0
106 */
107
108 typedef struct {
109
110 unsigned int flow_4 :4;
111 unsigned int flow_3 :4;
112 unsigned int flow_2 :4;
113 unsigned int flow_1 :4;
114
115 } T_DefinedSerialConfig;
116
117
118 /*
119 * Type used to describe all serial configuration informations
120 * of a defined application:
121 * - the default configuration to set up, if the current one is
122 * not valid,
123 * - the number of allowed serial configurations,
124 * - the entire allowed serial configurations.
125 */
126
127 typedef struct {
128
129 T_DefinedSerialConfig default_config;
130 SYS_UWORD8 num_config;
131 T_DefinedSerialConfig allowed_config[SER_MAX_NUMBER_OF_CFG];
132
133 } T_AppliSerialInfo;
134
135
136 /*
137 * Functions prototypes.
138 */
139
140 #ifndef __MONITOR__
141
142 C_EXTERN void SER_InitSerialConfig (T_AppliSerialInfo *serial_info);
143
144 C_EXTERN SYS_BOOL SER_UartSleepStatus (void);
145
146 C_EXTERN void SER_WakeUpUarts (void);
147
148 void SER_restart_uart_sleep_timer (void);
149
150 void SER_activate_timer_hisr (void);
151
152 C_EXTERN void SER_tr_Init (int serial_data_flow,
153 T_tr_Baudrate baudrate,
154 void (callback_function (void)));
155
156 C_EXTERN SYS_UWORD32 SER_tr_ReadNChars (int serial_data_flow,
157 char *buffer,
158 SYS_UWORD32 chars_to_read);
159
160 C_EXTERN SYS_UWORD32 SER_tr_ReadNBytes (int serial_data_flow,
161 char *buffer,
162 SYS_UWORD32 chars_to_read,
163 SYS_BOOL *eof_detected);
164
165 C_EXTERN SYS_UWORD32 SER_tr_WriteNChars (int serial_data_flow,
166 char *buffer,
167 SYS_UWORD32 chars_to_write);
168
169 C_EXTERN SYS_UWORD32 SER_tr_EncapsulateNChars (int serial_data_flow,
170 char *buffer,
171 SYS_UWORD32 chars_to_write);
172
173 C_EXTERN SYS_UWORD32 SER_tr_WriteNBytes (int serial_data_flow,
174 SYS_UWORD8 *buffer,
175 SYS_UWORD32 chars_to_write);
176
177 C_EXTERN void SER_tr_WriteChar (int serial_data_flow,
178 char character);
179
180 C_EXTERN SYS_BOOL SER_tr_EnterSleep (int serial_data_flow);
181
182 C_EXTERN void SER_tr_WakeUp (int serial_data_flow);
183
184 C_EXTERN void SER_tr_WriteString (int serial_data_flow,
185 char *buffer);
186
187
188 #if ((CHIPSET == 2) || (CHIPSET == 3))
189 C_EXTERN void SER_uart_handler (void);
190 #elif ((CHIPSET == 4) || (CHIPSET == 5) || (CHIPSET == 6) || (CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 9) || (CHIPSET == 10) || (CHIPSET == 11) || (CHIPSET == 12))
191 C_EXTERN void SER_uart_modem_handler (void);
192 C_EXTERN void SER_uart_irda_handler (void);
193 #endif
194 #if (CHIPSET == 12)
195 C_EXTERN void SER_uart_modem2_handler (void);
196 #endif
197
198 #endif /* __MONITOR__ */
199
200 #undef C_EXTERN
201
202 #endif /* __SERIALSWITCH_CORE_H__ */