comparison src/cs/services/atp/atp_api.h @ 0:b6a5e36de839

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