annotate gsm-fw/serial/uart.h @ 1014:0511507bf6e7

fc-shell: tch-dl control command implemented
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 20 Mar 2016 22:52:25 +0000
parents afceeeb2cba1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
116
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * UART.H
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 * This module allows to use the UARTs of chipset 1.5 in interrupt mode.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 * The driver calls a user's function when characters are received.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 * (C) Texas Instruments 1999 - 2003
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 #ifndef __UART_H__
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 #define __UART_H__
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 typedef enum {
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 UA_UART_0, /* IrDA */
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 UA_UART_1 /* Modem */
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 #if (CHIPSET == 12)
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 , UA_UART_2 /* Modem 2 */
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 #endif
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 } T_tr_UartId;
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 #if (CHIPSET == 12)
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 #define NUMBER_OF_TR_UART (3)
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 #else
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 #define NUMBER_OF_TR_UART (2)
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 #endif
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 #ifndef C_EXTERN
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 #if 1 //(OP_L1_STANDALONE == 1)
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 #define C_EXTERN extern
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 #else
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 #define C_EXTERN
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 #endif
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 #endif
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 * initialize_uart_sleep
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 * Purpose : Performs basic UART hardware initialization including sleep mode.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 * Arguments: In : uart_id : UART id.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 * Out: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 * Returns: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 * Warning: Parameters are not verified.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 C_EXTERN void initialize_uart_sleep (T_tr_UartId uart_id);
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 * UA_Init
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 * Purpose : Initializes the module and the UART.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 * Arguments: In : uart_id : UART id.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 * baudrate: baud rate selected.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 * callback: user's function called characters are received.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 * Out: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 * Returns: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 * Warning: Parameters are not verified.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 C_EXTERN void UA_Init (T_tr_UartId uart_id,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 T_tr_Baudrate baudrate,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 void (callback_function (void)));
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 * UA_ReadNChars
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 * Purpose : Reads N characters from the RX buffer.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 * Arguments: In : uart_id : UART id.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 * buffer : buffer address where the characters are
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 * copied.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 * chars_to_read: number of characters to read.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 * Out: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 * Returns : The number of characters read.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 * Warning: Parameters are not verified.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 C_EXTERN SYS_UWORD32 UA_ReadNChars (T_tr_UartId uart_id,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94 char *buffer,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 SYS_UWORD32 chars_to_read);
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 * UA_ReadNBytes
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101 * Purpose : Reads and destuff N bytes from the RX buffer.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 * Arguments: In : uart_id : UART id.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104 * buffer : buffer address where the bytes are copied.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 * chars_to_read: number of bytes to read.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 * Out: eof_detected : indicates if an EOF has been detected.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108 * Returns : The number of bytes read.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110 * Warning: Parameters are not verified.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
113
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 C_EXTERN SYS_UWORD32 UA_ReadNBytes (T_tr_UartId uart_id,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 char *buffer,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 SYS_UWORD32 bytes_to_read,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117 SYS_BOOL *eof_detected);
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 * UA_WriteNChars
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123 * Purpose : Writes N characters in the TX FIFO.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 * Arguments: In : uart_id : UART id.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126 * buffer : buffer address from which characters are
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127 * written.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128 * bytes_to_write: number of bytes to write.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 * Out: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 * Returns : Number of bytes written.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 * Warning: Parameters are not verified.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 C_EXTERN SYS_UWORD32 UA_WriteNChars (T_tr_UartId uart_id,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138 char *buffer,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 SYS_UWORD32 chars_to_write);
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 * UA_EncapsulateNChars
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145 * Purpose : Writes N characters in the TX FIFO in encapsulating them with 2
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 * STX bytes (one at the beginning and one at the end).
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 * Arguments: In : uart_id : UART id.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 * buffer : buffer address from which characters are
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 * written.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
151 * chars_to_write: number of chars to write.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152 * Out: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154 * Returns : Number of chars written.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 * Warning: Parameters are not verified.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
159
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
160 C_EXTERN SYS_UWORD32 UA_EncapsulateNChars (T_tr_UartId uart_id,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
161 char *buffer,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 SYS_UWORD32 chars_to_write);
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
165 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166 * UA_WriteNBytes
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
167 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
168 * Purpose : Writes N bytes in the TX FIFO in encapsulating with 2 STX bytes
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
169 * at the beginning and the end of the frame, and in making byte
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
170 * stuffing.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
171 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
172 * Arguments: In : uart_id : UART id.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
173 * buffer : buffer address from which bytes are
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
174 * written.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
175 * bytes_to_write: number of bytes to write.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
176 * Out: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
177 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
178 * Returns : Number of bytes written.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 * Warning: Parameters are not verified.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
181 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
182 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
183
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
184 C_EXTERN SYS_UWORD32 UA_WriteNBytes (T_tr_UartId uart_id,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
185 SYS_UWORD8 *buffer,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
186 SYS_UWORD32 bytes_to_write);
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
187
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
189 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
190 * UA_WriteChar
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
191 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
192 * Purpose : Writes a character in the TX FIFO.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
193 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
194 * Arguments: In : uart: UART id.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
195 * character
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
196 * Out: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
197 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
198 * Returns : none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
199 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
200 * Warning: Parameters are not verified.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
201 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
202 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
203
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
204 C_EXTERN void UA_WriteChar (T_tr_UartId uart_id,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
205 char character);
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
206
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
207 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
208 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
209 * UA_WriteString
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
210 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
211 * Purpose : Writes a null terminated string in the TX FIFO.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
212 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
213 * Arguments: In : uart_id: UART id.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
214 * buffer : buffer address from which characters are written.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
215 * Out: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
216 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
217 * Returns : none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
218 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
219 * Warning: Parameters are not verified.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
220 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
221 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
222
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
223 C_EXTERN void UA_WriteString (T_tr_UartId uart_id,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
224 char *buffer);
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
225
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
226 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
227 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
228 * UA_EnterSleep
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
229 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
230 * Purpose : Checks if UART is ready to enter Deep Sleep. If ready, enables
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
231 * wake-up interrupt.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
232 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
233 * Arguments: In : uart_id : UART id.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
234 * Out: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
235 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
236 * Returns: 0 : Deep Sleep is not possible.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
237 * >= 1 : Deep Sleep is possible.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
238 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
239 * Warning: Parameters are not verified.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
240 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
241 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
242
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
243 C_EXTERN SYS_BOOL UA_EnterSleep (T_tr_UartId uart_id);
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
244
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
245 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
246 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
247 * UA_WakeUp
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
248 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
249 * Purpose : Wakes up UART after Deep Sleep.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
250 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
251 * Arguments: In : uart_id : UART id.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
252 * Out: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
253 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
254 * Returns: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
255 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
256 * Warning: Parameters are not verified.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
257 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
258 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
259
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
260 C_EXTERN void UA_WakeUp (T_tr_UartId uart_id);
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
261
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
262 /*******************************************************************************
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
263 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
264 * UA_InterruptHandler
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
265 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
266 * Purpose : Interrupt handler.
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
267 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
268 * Arguments: In : uart_id : origin of interrupt
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
269 * interrupt_status: source of interrupt
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
270 * Out: none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
271 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
272 * Returns : none
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
273 *
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
274 ******************************************************************************/
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
275
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
276 void UA_InterruptHandler (T_tr_UartId uart_id,
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
277 SYS_UWORD8 interrupt_status);
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
278
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
279 #undef C_EXTERN
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
280
22c8199e08af started integrating TI's serial code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
281 #endif /* __UART_H__ */