FreeCalypso > hg > fc-tourmaline
comparison src/cs/services/atp/atp_uart_i.h @ 0:4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:23:26 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4e78acac3d88 |
---|---|
1 /********************************************************************************/ | |
2 /* */ | |
3 /* File Name: atp_uart_i.h */ | |
4 /* */ | |
5 /* Purpose: This header file contains the internal structures, */ | |
6 /* constants and prototypes related to the ATP-UART */ | |
7 /* interface. */ | |
8 /* */ | |
9 /* Note: none. */ | |
10 /* */ | |
11 /* Revision History: */ | |
12 /* 10/04/01 Pascal Pompei */ | |
13 /* - Create. */ | |
14 /* */ | |
15 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved. */ | |
16 /* */ | |
17 /********************************************************************************/ | |
18 #ifndef _ATP_UART_I_ | |
19 #define _ATP_UART_I_ | |
20 | |
21 #include <windows.h> | |
22 #include "atp/atp_uart_api.h" | |
23 #include "rvm/rvm_gen.h" | |
24 #include "atp/atp_messages.h" | |
25 #include "atp/atp_gsm_bt_api.h" | |
26 #include "atp/atp_gsm_gsm_api.h" | |
27 | |
28 | |
29 /************************************ MAILBOX ***********************************/ | |
30 /* */ | |
31 /* Define the mailbox assigned to the ATP-UART interface. */ | |
32 #define ATP_UART_MAILBOX (RVF_TASK_MBOX_0) | |
33 | |
34 /* Define the main features of the mailbox assigned to the ATP-UART interface. */ | |
35 #define ATP_UART_ALL_EVENT_FLAGS (0xFFFF) | |
36 #define ATP_UART_EXPECTED_EVENT (RVF_TASK_MBOX_0_EVT_MASK) | |
37 | |
38 | |
39 /****************************** MAXIMUM PACKET SIZE *****************************/ | |
40 /* */ | |
41 /* Define the maximum packet size exchanged with the AT Parser. */ | |
42 #define ATP_UART_MAX_PACKET_SIZE (0x0100) | |
43 | |
44 | |
45 /********************************** PORT NUMBER *********************************/ | |
46 /* */ | |
47 /* Define the port number dedicated to the virtual modem port opened with the */ | |
48 /* AT Parser. */ | |
49 #define ATP_UART_GSM_PORT_NB (0x00FF) | |
50 | |
51 | |
52 /*************************** CONNECTION CONTROL BLOCK ***************************/ | |
53 /* */ | |
54 /* Define the default name assigned to the the COM port. Note that such a name */ | |
55 /* must be a NULL-terminated string. */ | |
56 #define ATP_UART_DEFAULT_COM_PORT_NAME ("COM0") | |
57 | |
58 /* Define a structure used to gather information related to the COM port as */ | |
59 /* well as the virtual modem port established with the AT Parser. */ | |
60 typedef struct | |
61 { | |
62 T_ATP_SW_ENTITY_ID atp_id; /* Unique entity */ | |
63 /* identifier assigned */ | |
64 /* to the ATP-UART */ | |
65 /* interface after its */ | |
66 /* registration to the */ | |
67 /* AT Parser. */ | |
68 char com_port_name[5]; /* Name associated with */ | |
69 /* the COM port. */ | |
70 HANDLE com_port_handle; /* Unique handle */ | |
71 /* assigned to the COM */ | |
72 /* port. */ | |
73 BOOLEAN virtual_modem_port_established; /* Indicate whether the */ | |
74 /* virtual modem port */ | |
75 /* is established with */ | |
76 /* the AT Parser. */ | |
77 T_ATP_PORT_MODE virtual_modem_port_mode; /* Indicate whether the */ | |
78 /* virtual modem port */ | |
79 /* is in 'Command' or */ | |
80 /* 'Data' state. */ | |
81 T_ATP_PORT_SIGNAL control_signals; /* RS232 control */ | |
82 /* signals. */ | |
83 UINT32 nb_bytes_left; /* Number of bytes */ | |
84 /* left. */ | |
85 UINT8 in_buffer_p[ATP_UART_MAX_PACKET_SIZE]; | |
86 } T_ATP_UART_CONN_CTRL_BLK; | |
87 | |
88 | |
89 /******************** GLOBAL ATP-UART INTERFACE CONTROL BLOCK *******************/ | |
90 /* */ | |
91 /* Define a global structure used to gather information related to the 'Global */ | |
92 /* ATP-UART Interface Control Block', such as the address and memory bank */ | |
93 /* identifier assigned to the ATP-UART interface. */ | |
94 typedef struct | |
95 { | |
96 T_ATP_UART_CONN_CTRL_BLK conn_ctrl_blk; | |
97 T_RVF_MB_ID mb_id; /* 'Memory Bank' identifier */ | |
98 /* assigned to the ATP-UART */ | |
99 /* interface. */ | |
100 T_RVF_ADDR_ID addr_id; /* Unique address identifier */ | |
101 /* assigned to the ATP-UART */ | |
102 /* interface. */ | |
103 T_RVM_CB_FUNC error_function_p; /* Function to be called */ | |
104 /* whenever any unrecoverable */ | |
105 /* error occurs. */ | |
106 } T_ATP_UART_CTRL_BLK; | |
107 | |
108 /* Define a pointer to the 'Global ATP-UART Interface Control Block'. */ | |
109 extern T_ATP_UART_CTRL_BLK *gbl_atp_uart_ctrl_blk_p; | |
110 | |
111 | |
112 /****************************** UNRECOVERABLE ERROR *****************************/ | |
113 /* */ | |
114 /* Define a macro used to call the function due to an unrecoverable error. */ | |
115 /* */ | |
116 /* Prototype: */ | |
117 /* ATP_UART_UNRECOVERABLE_ERROR (T_RVM_RETURN error_cause, */ | |
118 /* T_RVM_STRING error_message); */ | |
119 #define ATP_UART_UNRECOVERABLE_ERROR(error_cause, \ | |
120 error_message) \ | |
121 { \ | |
122 (gbl_atp_uart_ctrl_blk_p->error_function_p) (ATP_UART_NAME, \ | |
123 (error_cause), \ | |
124 0x00000000, \ | |
125 (error_message)); \ | |
126 } | |
127 | |
128 | |
129 /*************************** LOCAL FUNCTION PROTOTYPES **************************/ | |
130 /* */ | |
131 /* Define the local fonction prototypes. */ | |
132 T_ATP_UART_ERROR_CODES atp_uart_create_com_port (T_ATP_UART_COM_PORT com_port, | |
133 T_ATP_UART_BAUD_RATE baud_rate); | |
134 | |
135 T_ATP_UART_ERROR_CODES atp_uart_write_com_port (UINT8 *data_buffer_p, | |
136 UINT32 data_size); | |
137 | |
138 T_ATP_UART_ERROR_CODES atp_uart_read_com_port (UINT8 *data_buffer_p, | |
139 UINT32 *data_size_p); | |
140 | |
141 T_ATP_UART_ERROR_CODES atp_uart_remove_com_port (void); | |
142 | |
143 /********************************************************************************/ | |
144 | |
145 T_ATP_UART_ERROR_CODES atp_uart_handle_msg (void); | |
146 | |
147 #endif |