comparison src/g23m-fad/tcpip/include/atp_api.h @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /*******************************************************************************
2 *
3 * File Name : atp_api.h
4 *
5 * External definition for ATP SW entity
6 *
7 * (C) Texas Instruments, all rights reserved
8 *
9 * Version number : 0.1 Date : 28-Feb-2000
10 *
11 * History : 0.1 - Created by E. Baissus
12 *
13 *
14 * Author : Eric Baissus : e-baissus@ti.com
15 *
16 * (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved
17 ******************************************************************************/
18 #ifndef ATP_API_H
19 #define ATP_API_H
20
21 #include "rv_general.h"
22 #include "rvf_api.h"
23 #include "atp_config.h"
24 #include "atp_cmd.h"
25
26 typedef T_RV_RET T_ATP_RET;
27
28 typedef UINT16 T_ATP_SW_ENTITY_ID;
29 #define ATP_WRONG_SW_ID 0xFFFF
30
31 typedef UINT8 T_ATP_SW_ENTITY_NAME[ATP_SW_ENTITY_NAME_MAX_CARAC];
32 typedef UINT8 * T_ATP_BUFFER;
33
34 typedef T_RV_RETURN T_ATP_CALLBACK;
35
36 /* ---------------------------------------------------*/
37 /* Definitions related to SW entity registration */
38 /* ---------------------------------------------------*/
39
40 // Define the command modes : text or interpreted
41 typedef enum
42 {
43 TXT_MODE,
44 INTERPRETED_MODE
45 } T_ATP_CMD_MODE;
46
47 // Define the copy modes : copy is on or off
48 typedef enum
49 {
50 COPY_ON,
51 COPY_OFF
52 } T_ATP_COPY_MODE;
53
54 // Define if the SWE support commands or not
55 typedef enum
56 {
57 CMD_SUPPORT_ON,
58 CMD_SUPPORT_OFF
59 } T_ATP_CMD_SUPPORT;
60
61 // Structure defining the different mode selection of a SW entity which register to the ATP
62 typedef struct
63 {
64 T_ATP_CMD_SUPPORT cmd_support_mode;
65 T_ATP_CMD_MODE cmd_mode;
66 T_ATP_COPY_MODE cp_mode;
67 } T_ATP_ENTITY_MODE;
68
69 #define ATP_INVALID_SWE_ID (0xFF)
70
71 /* ---------------------------------------------------*/
72 /* Definitions related to port registration */
73 /* ---------------------------------------------------*/
74 typedef UINT16 T_ATP_PORT_NB; // Need to remain 16 bits in order to fit with SPP (MSB is FLAG SERVER/CLIENT)
75 typedef UINT8 T_ATP_SIGNAL_MASK;
76 typedef UINT8 T_ATP_SIGNAL_CHANGE_MASK;
77
78 typedef enum
79 {
80 DCE_CONFIG, // in this configuration, if one of the SW entity is not supporting commands (CMD_SUPPORT_OFF), ATP will automatically emulates a DCE on the port .
81 DTE_CONFIG, // in this configuration, if one of the SW entity is not supporting commands (CMD_SUPPORT_OFF), ATP will automatically emulates a DTE on the port .
82 DATA_CONFIG, // in this configuration, only data can be exchanged on the port.
83 NOT_DEFINED_CONFIG // Configuration defined by the other SWE
84 } T_ATP_PORT_CONFIG;
85
86 typedef UINT8 T_ATP_RING_TYPE;
87
88 #define ATP_NO_RING_TYPE (0x00) // the ringing signal is meaningless.
89 #define ATP_VOICE_RING_TYPE (0x01) // the SW entity is only interested in voice calls (i.e Headset).
90 #define ATP_DATA_RING_TYPE (0x02) // the SW entity is only interested in data calls (i.e Dial-Up Networking).
91 #define ATP_FAX_RING_TYPE (0x04) // the SW entity is only interested in fax calls (i.e Fax).
92
93 #define ATP_INVALID_PORT_CONFIG_VALUE (0xFF)
94
95 typedef struct
96 {
97 T_ATP_PORT_CONFIG port_config;
98 T_ATP_RING_TYPE ring_type;
99 T_ATP_SIGNAL_MASK signal_mask;
100 T_ATP_DCE_MASK dce_mask;
101 } T_ATP_PORT_INFO;
102
103 // Structure used to store information when no copy option is selected
104 typedef enum
105 {
106 RX_HEADER_ON,
107 RX_HEADER_OFF
108 } T_ATP_RX_HEADER_MODE;
109
110 typedef enum
111 {
112 TX_HEADER_ON,
113 TX_HEADER_OFF
114 } T_ATP_TX_HEADER_MODE;
115
116 typedef enum
117 {
118 SEGMENTED_PACKET,
119 NORMAL_PACKET
120 } T_ATP_PACKET_MODE;
121
122 #define ATP_GET_ALL_EVENTS (0xFFFF)
123
124 typedef struct
125 {
126 T_RVF_MB_ID rx_mb;
127 T_RVF_MB_ID tx_mb;
128 T_ATP_TX_HEADER_MODE tx_head_mode;
129 UINT16 tx_head_size;
130 UINT16 tx_trail_size;
131 T_ATP_RX_HEADER_MODE rx_head_mode;
132 UINT16 rx_head_size;
133 UINT16 rx_trail_size;
134 T_ATP_PACKET_MODE packet_mode;
135 } T_ATP_NO_COPY_INFO;
136
137 // Definition for custom parameters
138 typedef enum
139 {
140 ATP_TO_SPP_INFO,
141 ATP_FROM_SPP_INFO,
142 ATP_TO_GSM_INFO,
143 ATP_FROM_GSM_INFO,
144 ATP_TO_RNET_INFO,
145 ATP_FROM_RNET_INFO
146 } T_ATP_CUSTOM_TYPE;
147
148 /* Custom information used during a new open port response by gsm */
149
150 typedef struct
151 {
152 T_ATP_CUSTOM_TYPE custom_type;
153 } T_ATP_CUSTOM_INFO;
154
155 // open port result definition
156 typedef enum
157 {
158 OPEN_PORT_OK,
159 OPEN_PORT_NOK
160 } T_ATP_OPEN_PORT_RESULT;
161
162 // definition related to command functions
163 typedef UINT8 T_ATP_CMD_TYPE;
164 #define AT_CMD (0)
165 #define RESULT_CODE (1)
166 #define UNSOLICITED_RESULT (2)
167 #define INFORMATION_TXT (3)
168 #define CUSTOM_CMD (4)
169 #define CMD_ABORT (5)
170 #define UNKNOWN (6)
171 #define PRELIMINARY_RESULT_CODE (7)
172
173 typedef UINT16 T_ATP_CMD_NB;
174
175 typedef void T_ATP_CMD;
176
177 typedef char * T_ATP_TXT_CMD;
178
179 // definition related to signals
180 typedef UINT8 T_ATP_PORT_SIGNAL;
181
182 // Signal is unmasked when mask is set to 1
183 #define ATP_RX_FLOW_ON (0x01)
184 #define ATP_RX_FLOW_OFF (0x00)
185 #define ATP_TX_FLOW_ON (0x02)
186 #define ATP_TX_FLOW_OFF (0x00)
187 #define ATP_DTR_DSR_0 (0x00)
188 #define ATP_DTR_DSR_1 (0x04)
189 #define ATP_RTS_CTS_0 (0x00)
190 #define ATP_RTS_CTS_1 (0x08)
191 #define ATP_DCD_1 (0x10)
192 #define ATP_DCD_0 (0x00)
193 #define ATP_RI_1 (0x020)
194 #define ATP_RI_0 (0x00)
195
196 #define ATP_DTR_DSR_UNMASK (ATP_DTR_DSR_1)
197 #define ATP_RTS_CTS_UNMASK (ATP_RTS_CTS_1)
198 #define ATP_DCD_UNMASK (ATP_DCD_1)
199 #define ATP_RI_UNMASK (ATP_RI_1)
200 #define ATP_RX_FLOW_UNMASK (ATP_RX_FLOW_ON)
201 #define ATP_TX_FLOW_UNMASK (ATP_TX_FLOW_ON)
202
203 /* Number of signal allowed is defined by */
204 #define ATP_NON_RX_TX_SIGNAL_UNMASK (ATP_DTR_DSR_UNMASK | ATP_RTS_CTS_UNMASK | ATP_DCD_UNMASK | \
205 ATP_RI_UNMASK)
206 #define ATP_ALL_THE_SIGNAL_UNMASK (ATP_RX_FLOW_UNMASK | ATP_TX_FLOW_UNMASK | \
207 ATP_NON_RX_TX_SIGNAL_UNMASK)
208
209 // definition related to port mode and data exchange
210 typedef enum
211 {
212 ATP_PORT_DATA_MODE,
213 ATP_PORT_CMD_MODE
214 } T_ATP_PORT_MODE;
215
216 typedef enum
217 {
218 ATP_REDIRECT_ON,
219 ATP_REDIRECT_OFF
220 } T_ATP_REDIRECT_MODE;
221
222 /******************************************************************************
223 * Function name: atp_reg
224 *
225 * Description : This function is used to register a new SW entity to the ATP entity
226
227 * Parameters : - name = SW entity name
228 * - return_path => way to send event to the new registered entity,
229 * - mode => supported mode of the new registered entity
230 * - &sw_id_p => pointer on id to use later on to identify the SW entity
231 *
232 * Return : Standard error
233 * RV_OK or RV_MEMORY_ERR (no more entity can register, or prim MB not GREEN)
234 *
235 * History : 0.1 (29-Feb-2000)
236 * : 0.9 (3-May-2000) : reviewed
237 ******************************************************************************/
238 T_ATP_RET atp_reg(T_ATP_SW_ENTITY_NAME name, T_ATP_CALLBACK return_path,
239 T_ATP_ENTITY_MODE mode , T_ATP_SW_ENTITY_ID * sw_id_p);
240
241 /******************************************************************************
242 * Function name: atp_dereg
243 *
244 * Description : This function is used to remove a SW entity to the list of
245 * SW entities registered in ATP.
246 *
247 * Parameters : - sw_id => id of the SWE
248 *
249 * Return : Standard error
250 * RV_OK ,
251 * RV_NOT_READY if a port is still open involving the SW entity
252 * RV_NOT_SUPPORTED if sw_id is already de-registered -> ignore call
253 *
254 * History : 0.1 (29-Feb-2000)
255 * : 0.9 (3-May-2000) : reviewed
256 ******************************************************************************/
257 T_ATP_RET atp_dereg(T_ATP_SW_ENTITY_ID sw_id);
258
259 /******************************************************************************
260 * Function name: atp_reg_info
261 *
262 * Description : This function is used to get info on a SWE
263 *
264 * Parameters : - name => name of the SWE to get info on
265 * - return : id of the SWE
266 * - return : SWE mode information
267 *
268 * Return : Standard error
269 * RV_OK ,
270 * RV_NOT_SUPPORTED if name has not been found
271 *
272 * History : 0.1 (29-Feb-2000)
273 * : 0.9 (3-May-2000) : reviewed
274 ******************************************************************************/
275 T_ATP_RET atp_reg_info(T_ATP_SW_ENTITY_NAME name, T_ATP_SW_ENTITY_ID * sw_id_p,
276 T_ATP_ENTITY_MODE * mode_p);
277
278 /******************************************************************************
279 * Function name: atp_free_message
280 *
281 * Description : Generic function service provided to SW entity to free an ATP message
282 *
283 * Parameters : pointer on the buffer
284 *
285 * Return : return of the rvf_free_buf function
286 *
287 * History : 0.1 (1-Marsh-2000) - Created
288 *
289 ******************************************************************************/
290 T_ATP_RET atp_free_message(void * buffer_p);
291
292 /******************************************************************************
293 * Function name: atp_open_port_rqst
294 *
295 * Description : Initialise a port creation
296 *
297 * Parameters : see BT9901
298 *
299 * Return :
300 *
301 * History : 0.1 (1-Marsh-2000) - Created
302 *
303 ******************************************************************************/
304
305 T_ATP_RET atp_open_port_rqst(T_ATP_SW_ENTITY_ID initiator_id, T_ATP_SW_ENTITY_ID target_id,
306 T_ATP_PORT_NB port_nb, T_ATP_PORT_INFO port_info,
307 T_ATP_NO_COPY_INFO no_copy_info, T_ATP_CUSTOM_INFO * cust_info_p);
308
309 /******************************************************************************
310 * Function name: atp_open_port_rsp
311 *
312 * Description : Response from the target to a open port request
313 *
314 * Parameters : see BT9901
315 *
316 * Return :
317 *
318 * History : 0.1 (1-Marsh-2000) - Created
319 *
320 ******************************************************************************/
321
322 T_ATP_RET atp_open_port_rsp(T_ATP_SW_ENTITY_ID initiator_id, T_ATP_PORT_NB initiator_port_nb,
323 T_ATP_SW_ENTITY_ID target_id, T_ATP_PORT_NB target_port_nb,
324 T_ATP_PORT_INFO port_info, T_ATP_NO_COPY_INFO no_copy_info,
325 T_ATP_CUSTOM_INFO * custom_info_p, T_ATP_OPEN_PORT_RESULT result);
326
327 /******************************************************************************
328 * Function name: atp_close_port
329 *
330 * Description : Close a port
331 *
332 * Parameters : see BT9901
333 *
334 * Return :
335 *
336 * History : 0.1 (1-Marsh-2000) - Created
337 *
338 ******************************************************************************/
339 T_ATP_RET atp_close_port(T_ATP_SW_ENTITY_ID closer_sw_id, T_ATP_PORT_NB port_nb);
340
341 /******************************************************************************
342 * Function name: atp_get_buffer
343 *
344 * Description : Generic function service provided to SW entity to free an ATP buffer
345 *
346 * Parameters : pointer on the buffer
347 *
348 * Return : return of the rvf_free_buf function
349 *
350 * History : 0.1 (1-Marsh-2000) - Created
351 *
352 ******************************************************************************/
353 T_ATP_RET atp_get_buffer(UINT32 buffer_size,void ** buffer_pp);
354
355 /******************************************************************************
356 * Function name: atp_free_buffer
357 *
358 * Description : Generic function service provided to SW entity to free an ATP buffer
359 *
360 * Parameters : pointer on the buffer
361 *
362 * Return : return of the rvf_free_buf function
363 *
364 * History : 0.1 (1-Marsh-2000) - Created
365 *
366 ******************************************************************************/
367 T_ATP_RET atp_free_buffer(void * buffer_p);
368
369 /******************************************************************************
370 * Function name: atp_send_cmd
371 *
372 * Description : Send a command
373 *
374 * Parameters : see BT9901
375 *
376 * Return :
377 *
378 * History : 0.1 (1-Marsh-2000) - Created
379 *
380 ******************************************************************************/
381 T_ATP_RET atp_send_cmd(T_ATP_SW_ENTITY_ID sender_sw_id, T_ATP_PORT_NB sender_port_nb,
382 T_ATP_CMD_TYPE cmd_type, T_ATP_CMD_NB cmd_nb, T_ATP_CMD * cmd_info_p);
383
384 /******************************************************************************
385 * Function name: atp_send_txt_cmd
386 *
387 * Description : Send a command in text format
388 *
389 * Parameters : see BT9901
390 *
391 * Return :
392 *
393 * History : 0.1 (1-Marsh-2000) - Created
394 *
395 ******************************************************************************/
396 T_ATP_RET atp_send_txt_cmd(T_ATP_SW_ENTITY_ID sender_sw_id, T_ATP_PORT_NB sender_port_nb,
397 T_ATP_CMD_TYPE cmd_type, T_ATP_TXT_CMD text_p);
398
399 /******************************************************************************
400 * Function name: atp_no_copy_send_data
401 *
402 * Description : Send data on a port.
403 *
404 * Parameters : see BT9901
405 *
406 * Return :
407 *
408 * History : 0.1 (1-Marsh-2000) - Created
409 *
410 ******************************************************************************/
411 T_ATP_RET atp_no_copy_send_data(T_ATP_SW_ENTITY_ID sender_sw_id, T_ATP_PORT_NB sender_port_nb,
412 T_ATP_BUFFER atp_buffer_p, UINT32 buffer_size);
413
414 /******************************************************************************
415 * Function name: atp_send_data
416 *
417 * Description : Send data on a port
418 *
419 * Parameters : see BT9901
420 *
421 * Return :
422 *
423 * History : 0.1 (1-Marsh-2000) - Created
424 *
425 ******************************************************************************/
426 T_ATP_RET atp_send_data(T_ATP_SW_ENTITY_ID sender_sw_id, T_ATP_PORT_NB sender_port_nb,
427 void * data_buffer_p, UINT32 buffer_size, UINT32 *nb_bytes_left_p);
428
429 /******************************************************************************
430 * Function name: atp_get_data
431 *
432 * Description : Copy data in the SW entity buffer
433 *
434 * Parameters : see BT9901
435 *
436 * Return :
437 *
438 * History : 0.1 (1-Marsh-2000) - Created
439 *
440 ******************************************************************************/
441 T_ATP_RET atp_get_data(T_ATP_SW_ENTITY_ID receiver_sw_id, T_ATP_PORT_NB receiver_port_nb,
442 UINT8 * data_buffer, UINT32 nb_to_read, UINT32 *nb_read_p, UINT32 *nb_left_p);
443
444 /******************************************************************************
445 * Function name: atp_set_signal
446 *
447 * Description : Set modem signals
448 *
449 * Parameters : see BT9901
450 *
451 * Return :
452 *
453 * History : 0.1 (1-Marsh-2000) - Created
454 *
455 ******************************************************************************/
456 T_ATP_RET atp_set_signal(T_ATP_SW_ENTITY_ID sender_sw_id, T_ATP_PORT_NB sender_port_nb,
457 T_ATP_PORT_SIGNAL signal_value, T_ATP_SIGNAL_CHANGE_MASK signal_mask);
458
459 /******************************************************************************
460 * Function name: atp_get_signal
461 *
462 * Description : Get signal value of the port
463 *
464 * Parameters : see BT9901
465 *
466 * Return : RV_OK
467 * RV_INVALID_PARAMETER : one of the id or port_nb was wrong : ignore call
468 *
469 * atp_error can be called if MB is RED
470 *
471 * History : 0.1 (1-Marsh-2000) - Created
472 *
473 ******************************************************************************/
474 T_ATP_RET atp_get_signal(T_ATP_SW_ENTITY_ID sw_id, T_ATP_PORT_NB port_nb,
475 T_ATP_PORT_SIGNAL * signal_p);
476
477 /******************************************************************************
478 * Function name: atp_set_mode
479 *
480 * Description : Change the mode of the port
481 *
482 * Parameters : see BT9901
483 *
484 * Return : RV_OK
485 * RV_INVALID_PARAMETER : one of the id or port_nb was wrong : ignore call
486 *
487 * atp_error can be called if MB is RED
488 *
489 * History : 0.1 (09-May-2000) - Created
490 *
491 ******************************************************************************/
492 T_ATP_RET atp_set_mode(T_ATP_SW_ENTITY_ID sender_sw_id, T_ATP_PORT_NB sender_port_nb,
493 T_ATP_PORT_MODE mode);
494
495 /******************************************************************************
496 * Function name: atp_flow_redirect
497 *
498 * Description : Redirect the flow from one port to another one
499 *
500 * Parameters : see BT9901
501 *
502 * Return : RV_OK
503 * RV_INVALID_PARAMETER : one of the id or port_nb was wrong : ignore call
504 *
505 * atp_error can be called if MB is RED
506 *
507 * History : 0.1 (22-May-2000) - Created
508 *
509 ******************************************************************************/
510 T_ATP_RET atp_flow_redirect(T_ATP_SW_ENTITY_ID sw_id, T_ATP_PORT_NB port_nb_1,
511 T_ATP_PORT_NB port_nb_2, T_ATP_REDIRECT_MODE redirect_mode);
512
513 /******************************************************************************
514 * Function name: atp_get_buffer_from_tx_mb
515 *
516 * Description : Function used to get memory from the tx memory bank of the SWE
517 *
518 * Parameters :
519 *
520 * Return : return of the rvf_free_buf function
521 *
522 * History : 0.1 (1-Marsh-2000) - Created
523 *
524 ******************************************************************************/
525 T_ATP_RET atp_get_buffer_from_tx_mb(T_ATP_SW_ENTITY_ID sender_sw_id,T_ATP_PORT_NB sender_port_nb,
526 UINT32 buffer_size,void ** buffer_pp);
527
528 /******************************************************************************
529 * Function name: atp_get_info_on_port_end
530 *
531 * Description : Provide information on the other end of the port
532 * (for example, which format of data the other SW entity is expecting )
533 *
534 * Parameters : see BT9901
535 *
536 * Return : RV_OK
537 * RV_INVALID_PARAMETER : one of the id or port_nb was wrong : ignore call
538 * RV_NOT_SUPPORTED : command needed to be translated and was unknow by ATP
539 *
540 * atp_error can be called if MB is RED
541 *
542 * History : 0.1 19-Dec-2001
543 *
544 ******************************************************************************/
545 // Structure gathering main information regardinmg NO_COPY mode
546 typedef struct
547 {
548 UINT16 tx_head_size;
549 UINT16 tx_trail_size;
550 UINT16 rx_head_size;
551 UINT16 rx_trail_size;
552 T_ATP_PACKET_MODE packet_mode; // SEGMENTED means that data are stored in segmented buffer.
553 // l2cap_read_uint function must be called to fetch the data
554 // NORMAL means that data are in a single buffer
555 } T_ATP_NO_COPY_PORT_INFO; // Information regarding no copy data processing
556
557 typedef struct
558 {
559 T_ATP_SW_ENTITY_NAME name;
560 T_ATP_ENTITY_MODE mode;
561 T_ATP_NO_COPY_PORT_INFO no_copy_info;
562 } T_ATP_OTHER_PORT_END_INFO;
563
564 T_ATP_RET atp_get_info_on_port_end (T_ATP_SW_ENTITY_ID requester_sw_id, T_ATP_PORT_NB requester_port_nb,
565 T_ATP_OTHER_PORT_END_INFO * other_info_p);
566
567 #endif
568