comparison src/g23m-aci/bat/bat_intern.h @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-F&D (8411)
4 | Modul : ACI
5 +-----------------------------------------------------------------------------
6 | Copyright 2005 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This Modul holds the definitions for internal use
18 | for the binary AT command library
19 +-----------------------------------------------------------------------------
20 */
21 #ifndef BAT_INTERN_H
22 #define BAT_INTERN_H
23
24
25 /*********************************************************************************
26 *
27 * defines
28 *
29 *********************************************************************************/
30
31 #define BAT_CONTROL_CHANNEL 0xFE
32 #define BAT_BROADCAST_CHANNEL 0xFF
33 #define BAT_INVALID_CLIENT_HANDLE 0xFFFF
34 #define BAT_INVALID_INSTANCE_HANDLE 0xFF
35
36 #define GET_INST_HNDL_FROM_CLNT_HANDLE(clnt_hndl) ((U8)((clnt_hndl & 0xff00) >> 8))
37 #define GET_CLNT_ID_FROM_CLNT_HANDLE(clnt_hndl) ((U8)(clnt_hndl & 0xff))
38 #define MAKE_CLNT_HNDL(clnt_id, inst_hndl) ((U16)((clnt_id & 0x00ff)|((0x00ff & inst_hndl)<<8)))
39 #define MAKE_UNS_CLNT_HNDL(inst_hndl) ((U16)((0x00ff & inst_hndl)<<8|0x00ff))
40
41 #ifdef NEW_FRAME
42 #include "vsi.h"
43 #ifndef _SIMULATION_
44 EXTERN T_HANDLE GDD_DIO_handle; /* include of gdd_dio.h needs a lot of other includes */
45 #undef TRACE_FUNCTION
46 #define TRACE_FUNCTION(a) vsi_o_ttrace(GDD_DIO_handle,TC_EVENT,a)
47 #undef TRACE_EVENT
48 #define TRACE_EVENT(a) vsi_o_ttrace(GDD_DIO_handle,TC_EVENT,a)
49 #undef TRACE_EVENT_P1
50 #define TRACE_EVENT_P1(f,a1) vsi_o_ttrace(GDD_DIO_handle,TC_EVENT,f,a1)
51 #undef TRACE_EVENT_P2
52 #define TRACE_EVENT_P2(f,a1,a2) vsi_o_ttrace(GDD_DIO_handle,TC_EVENT,f,a1,a2)
53 #undef TRACE_BINDUMP
54 #define TRACE_BINDUMP(s,m,d,p,l) {vsi_o_ttrace(GDD_DIO_handle,m,d);vsi_o_primsend(GDD_DIO_handle,m,0,FRM_PCO_NAME,BIN_TRACE_OPC,p,l FILE_LINE_MACRO);}
55 #else /* _SIMULATION_ */
56 EXTERN T_HANDLE aci_handle; /* include of aci.h needs a lot of additional includes */
57 #undef TRACE_BINDUMP
58 #define TRACE_BINDUMP(s,m,d,p,l) {vsi_o_ttrace(aci_handle,m,d);vsi_o_primsend(aci_handle,m,0,FRM_PCO_NAME,BIN_TRACE_OPC,p,l FILE_LINE_MACRO);}
59 #endif /* _SIMULATION_ */
60 #define BAT_TRACE_ERROR(a) TRACE_ERROR(a)
61 #define BAT_TRACE_FUNCTION(a) TRACE_FUNCTION(a)
62 #define BAT_TRACE_EVENT(a) TRACE_EVENT(a)
63 #define BAT_TRACE_EVENT_P1(f,a1) TRACE_EVENT_P1(f,a1)
64 #define BAT_TRACE_EVENT_P2(f,a1,a2) TRACE_EVENT_P2(f,a1,a2)
65 #define BAT_TRACE_BINDUMP(s,m,d,p,l) TRACE_BINDUMP(s,m,d,p,l)
66 #else /* NEW_FRAME */
67 #define BAT_TRACE_ERROR(a) ((void)(0))
68 #define BAT_TRACE_FUNCTION(a) ((void)(0))
69 #define BAT_TRACE_EVENT(a) ((void)(0))
70 #define BAT_TRACE_EVENT_P1(f,a1) ((void)(0))
71 #define BAT_TRACE_EVENT_P2(f,a1,a2) ((void)(0))
72 #define BAT_TRACE_BINDUMP(s,m,d,p,l) ((void)(0))
73 typedef int T_HANDLE; /* in case of BAT Lib dos not run under GPF */
74 #endif /* NEW_FRAME */
75
76
77 /*==== GLOBAL VARS =================================================================*/
78
79 GLOBAL void bat_change_client_state (T_BAT_client_maintain *client,
80 T_BAT_client_state new_state);
81 GLOBAL void bat_change_instance_state (T_BAT_instance_maintain *instance,
82 T_BAT_instance_state new_state);
83 GLOBAL void bat_change_buffer_state (T_BAT_instance_maintain *instance,
84 T_BAT_buf_state new_state);
85
86 T_BAT_return bat_init_global_params (void);
87 T_BAT_return bat_deinit_global_params (void);
88 T_BAT_return bat_init_instance_pointer (T_BAT_instance inst_hndl,
89 T_BAT_instance_maintain *inst_mt);
90 T_BAT_return bat_deinit_instance_pointer (T_BAT_instance inst_hndl);
91
92 BOOL bat_check_init_or_deinit (BOOL is_init);
93 BOOL bat_check_if_all_instances_are_closed (void);
94 BOOL bat_check_if_all_clients_are_closed (T_BAT_instance inst_hndl);
95
96 T_BAT_return bat_get_new_instance (T_BAT_instance *instance);
97 T_BAT_return bat_delete_instance (T_GDD_CON_HANDLE con_handle);
98 T_BAT_return bat_get_instance_from_gdd_handle (T_GDD_CON_HANDLE con_handle,
99 T_BAT_instance *instance_handle,
100 T_BAT_instance_maintain **instance);
101 T_BAT_return bat_get_instance_from_client_handle (T_BAT_client client_handle,
102 T_BAT_instance_maintain **instance);
103 T_BAT_return bat_get_new_client (T_BAT_instance instance,
104 T_BAT_client *client);
105 T_BAT_return bat_init_new_client (T_BAT_client client,
106 int(*response_cb)( T_BAT_client client,
107 T_BAT_cmd_response *rsp),
108 void(*signal_cb)( T_BAT_client client,
109 T_BAT_signal));
110
111 T_BAT_return bat_make_client_handle_from_gdd_and_client_id
112 (T_GDD_CON_HANDLE con_handle,
113 U8 client_id,
114 T_BAT_client *client);
115
116 T_BAT_return bat_get_client_from_client_handle (T_BAT_client client,
117 T_BAT_client_maintain **client_maintain);
118
119 T_BAT_return bat_response_rcv (T_BAT_instance inst_hndl,
120 T_BAT_cmd_response *rsp);
121 T_BAT_return bat_unsolicited_code_rcv (T_BAT_instance inst_hndl,
122 T_BAT_cmd_response *rsp);
123 T_BAT_return bat_get_instance_from_instance_handle (T_BAT_instance instance,
124 T_BAT_instance_maintain **inst_mt);
125 T_BAT_return bat_control_confirm_rcv (T_BAT_instance inst_hndl,
126 T_BATC_confirm cnf);
127 T_BAT_return bat_command_response_rcv (T_BAT_instance inst_hndl,
128 U8 clnt_id,
129 T_BAT_cmd_response *rsp);
130 T_BAT_return bat_send_cmd_data (T_BAT_client clnt_hndl,
131 T_BAT_cmd_send *data);
132 T_BAT_return bat_send_ctrl_data (T_BAT_instance inst_hndl,
133 T_BATC_signal *data);
134
135 /* callbacks for GDD */
136
137 void bat_gdd_signal_cb (T_GDD_CON_HANDLE con, T_GDD_SIGNAL signal);
138 GDD_RESULT bat_gdd_receive_data_cb (T_GDD_CON_HANDLE con, T_GDD_BUF *buf);
139
140 BOOL bat_l2p_receive (U8 inst_hndl, T_GDD_BUF *buf);
141
142
143 /* callbacks for L2P */
144 void *bat_l2p_get_tx_buffer(U8 inst_hndl, U16 data_size,
145 void **seg_hdr_ptr, U16 *total_size, U16 *seg_size);
146 int bat_l2p_send_frame(U8 inst_hndl);
147 void *bat_l2p_get_rx_buffer(U8 inst_hndl);
148 void bat_l2p_message_rxd (U8 inst_hndl, U8 client_id, U32 data_tag,
149 void *data_ptr, U16 data_size);
150
151 void *bat_l2p_get_next_buf_seg (U8 inst_hndl, void *seg_hdr, void **seg_hdr_ptr, U16 *segSize);
152
153 #endif /* BAT_INTERN_H */
154
155