FreeCalypso > hg > fc-selenite
comparison src/g23m-aci/l2p/l2p_types.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 | Project : BAT L2P () | |
4 | Modul : L2P Types | |
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 : L2P type definitions definitions | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifndef L2P_TYPES_H | |
22 #define L2P_TYPES_H | |
23 | |
24 #include "typedefs.h" | |
25 | |
26 /********************************************************** | |
27 ** | |
28 ** Enumerated Type definitions | |
29 ** | |
30 ***********************************************************/ | |
31 typedef enum { | |
32 L2P_STAT_SUCCESS = 0, | |
33 L2P_STAT_UNKNOWN_ERROR = -1, | |
34 L2P_STAT_MSG_SEND_FAIL = -2, | |
35 L2P_STAT_INVALID_PARAMETER = -3, | |
36 L2P_STAT_NO_SUCH_BAT_ID = -4, | |
37 L2P_STAT_NO_SUCH_MUX_ID = -5, | |
38 L2P_STAT_UNABLE_TO_GET_BUFFER = -6, | |
39 L2P_STAT_BAT_ID_ALREADY_EXISTS = -7, | |
40 L2P_STAT_UNEXPECTED_FRAME_RXD = -8, | |
41 L2P_STAT_CRC_FAIL = -9 | |
42 } T_L2P_STATUS; | |
43 | |
44 typedef enum { | |
45 L2P_FT_UNKNOWN_FRAME_TYPE=0, | |
46 L2P_FT_START_FRAME, | |
47 L2P_FT_CONTINUATION_FRAME, | |
48 L2P_FT_END_FRAME, | |
49 L2P_FT_COMPLETE_FRAME | |
50 } T_L2P_FRAME_TYPE; | |
51 | |
52 typedef enum { | |
53 L2P_SP_PSI, | |
54 L2P_SP_MAX_NUM | |
55 }T_L2P_SUPPORTED_PROTOCOLS; | |
56 | |
57 | |
58 /********************************************************** | |
59 ** | |
60 ** Callback function type definitions | |
61 ** | |
62 ***********************************************************/ | |
63 typedef void *(* L2P_Get_Rx_Buf_CB)(U8 batId); /* Data Size not needed - The user will always return a maximum size buffer */ | |
64 typedef void *(* L2P_Get_Tx_Buf_CB)(U8 batId, U16 dataSize, void **seg_hdr_ptr, U16 *totalSize, U16 *segSize); | |
65 typedef void *(* L2P_Get_Next_Seg_CB)(U8 batId, void *last_seg_hdr, void **seg_hdr_ptr, U16 *segSize); | |
66 typedef int (* L2P_Send_Frame_CB)(U8 batId); | |
67 typedef void (* L2P_Msg_Rxd_CB)(U8 batId , U8 muxId, U32 dataTag, void *dataPtr, U16 dataSize); | |
68 | |
69 | |
70 /********************************************************** | |
71 ** | |
72 ** L2P Structure definitions | |
73 ** | |
74 ***********************************************************/ | |
75 | |
76 typedef struct { | |
77 L2P_Get_Tx_Buf_CB Get_TxBuf_Cb; | |
78 L2P_Get_Rx_Buf_CB Get_RxBuf_Cb; | |
79 L2P_Get_Next_Seg_CB Get_Next_Seg_Cb; | |
80 L2P_Send_Frame_CB Send_Frame_Cb; | |
81 L2P_Msg_Rxd_CB Msg_Rxd_Cb; | |
82 } T_L2P_CALLBACK_BLOCK; | |
83 | |
84 /* | |
85 ** NDH : 20/06/05 : Modified the order of the fields in the L2P Control Block Structure | |
86 ** to ensure that the compiler Byte Alignment is efficient so that the | |
87 ** compiler does not add unnecessary padding bytes. | |
88 ** | |
89 ** In the following Comments the Bytes Alignment is show with the notation bN | |
90 ** where N is 0 - 3. | |
91 ** 8bit entries can be on any byte | |
92 ** 16bit entries should be on b0 or b2 only | |
93 ** 32bit entries should be on b0 only | |
94 */ | |
95 typedef struct l2p_control_block_tag { | |
96 U8 batId; /* b0 : Bat Instance Id */ | |
97 U8 frameId; /* b1 : Frame Id of last transmitted packet*/ | |
98 U16 maxMTU; /* b2 : Maximum Transport Unit size */ | |
99 T_L2P_SUPPORTED_PROTOCOLS protocolId; /* b0 : protocol used for link */ | |
100 T_L2P_CALLBACK_BLOCK callbacks; /* b0 : Call back functions from calling entity */ | |
101 char *rxBuf; /* b0 : Pointer to the current receive buffer */ | |
102 U8 muxId; /* b0 : Client Id of the sender/receipient */ | |
103 U8 cmdTagReceived; /* b1 : Flag to indicate whether the Cmd Tag has been fully received */ | |
104 U16 dataSize; /* b2 : Amount of data expected in total (length of the Cmd Data excl the Cmd Tag) */ | |
105 U32 receivedCmdTag; /* b0 : The value of the Cmd Tag received in the latest message*/ | |
106 U16 bytesToBeRead; /* b0 : byte read counter must be persistent over several calls to L2P_Receive */ | |
107 U8 pad_byte1; /* b2 : Padding byte - not used */ | |
108 U8 pad_byre2; /* b3 : Padding byte - not used */ | |
109 char *dataToBeRead; /* b0 : data read pointer must be persistent over several calls to L2P_Receive */ | |
110 struct l2p_control_block_tag *next; /* b0 : Pointer to the next block in the L2P Linked-List */ | |
111 } T_L2P_CONTROL_BLOCK; | |
112 | |
113 typedef struct { | |
114 U8 frame_type; | |
115 U8 frame_id; | |
116 U8 protocol_id; | |
117 U8 mux_id; | |
118 UINT16 dataLen; /* length of the Command Data */ | |
119 U16 frameLen; /* length of the frame, including L2 Frame Control Bytes */ | |
120 } T_L2P_FRAME_CONTROL_BYTES; | |
121 | |
122 /********************************************************** | |
123 ** | |
124 ** L2P Size definitions | |
125 ** | |
126 ***********************************************************/ | |
127 #define L2P_CONTROL_BLOCK_HDR_SIZE sizeof(T_L2P_CONTROL_BLOCK) | |
128 #define L2P_FRAME_CONTROL_SIZE sizeof(T_L2P_FRAME_CONTROL_BYTES) | |
129 | |
130 #endif | |
131 |