This repository has been archived by the owner on Jan 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathxtm_hal.h
249 lines (222 loc) · 6.28 KB
/
xtm_hal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/*========================================================================================
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2019 RDK Management
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*===========================================================================================*/
#ifndef __XTM_HAL_H__
#define __XTM_HAL_H__
#ifndef ULLONG
#define ULLONG unsigned long long
#endif
#ifndef ULONG
#define ULONG unsigned long
#endif
#ifndef USHORT
#define USHORT unsigned short
#endif
#ifndef BOOL
#define BOOL unsigned char
#endif
#ifndef CHAR
#define CHAR char
#endif
#ifndef UCHAR
#define UCHAR unsigned char
#endif
#ifndef INT
#define INT int
#endif
#ifndef UINT
#define UINT unsigned int
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef ENABLE
#define ENABLE 1
#endif
#ifndef RETURN_OK
#define RETURN_OK 0
#endif
#ifndef RETURN_ERR
#define RETURN_ERR -1
#endif
/**
* @brief enum to identify the XTM link type.
* It could be either ATM, PTM or Not Supported.
*/
typedef enum _XTM_LINK_TYPE
{
PTM_LINK = 0,
ATM_LINK,
NOT_SUPPORTED
} XTM_LINK_TYPE, *PXTM_LINK_TYPE;
/**
* Enum to store the link status information.
*/
typedef enum _XTM_LINK_STATUS
{
XTM_LINK_TRAINING = 0,
XTM_LINK_UP,
XTM_LINK_DOWN,
XTM_LINK_DORMANT,
XTM_LINK_NOT_PRESENT,
XTM_LINK_LOWER_LAYER_DOWN,
XTM_LINK_UNKNOWN,
XTM_LINK_ERROR,
} XTM_LINK_STATUS, *PXTM_LINK_STATUS;
/**
* Struture used to hold the XTM (PTM/ATM) line Statistics
* information.
*/
typedef struct _XTM_LINK_STATS
{
ULONG BytesSent;
ULONG BytesReceived;
ULONG PacketsSent;
ULONG PacketsReceived;
UINT ErrorsSent;
UINT ErrorsReceived;
ULONG UnicastPacketsSent;
ULONG UnicastPacketsReceived;
UINT DiscardPacketsSent;
UINT DiscardPacketsReceived;
ULONG MulticastPacketsSent;
ULONG MulticastPacketsReceived;
ULONG BroadcastPacketsSent;
ULONG BroadcastPacketsReceived;
UINT UnknownProtoPacketsReceived;
UINT Atm_TransmittedBlocks;
UINT Atm_ReceivedBlocks;
UINT Atm_CRCErrors;
UINT Atm_HECErrors;
} XTM_LINK_STATS, *PXTM_LINK_STATS;
/* xtm_hal_init() function */
/**
* @brief - Initialise the xtm features
*
* @return The status of the operation
* @retval RETURN_OK if successful
* @retval RETURN_ERR if any error is detected
*
*/
INT xtm_hal_init();
/* xtm_hal_setLinkEnable() function */
/**
* @brief - Enable/Disable XTM link interface. This bringup the XTM interface up.
*
* @param Type of XTM link type. Could be ATM or PTM
* @param XTM link line index
* @param Enable/Disable flag
*
* @return The status of the operation
* @retval RETURN_OK if successful
* @retval RETURN_ERR if any error is detected
*/
INT xtm_hal_setLinkEnable(XTM_LINK_TYPE type, UINT lineIndex, BOOL enable);
/* xtm_hal_getLinkEnable() function */
/**
* @brief - Get XTM link interface enabled or not.
*
* @param Type of XTM link type. Could be ATM or PTM
* @param Flag to store enable/disable status
*
* @return The status of the operation
* @retval RETURN_OK if successful
* @retval RETURN_ERR if any error is detected
*/
INT xtm_hal_getLinkEnable(XTM_LINK_TYPE type, BOOL* enable);
/* xtm_hal_getLinkStats() function */
/**
* @brief - Get XTM link statistics information
*
* @param Type of XTM link type. Could be ATM or PTM
* @param Structure pointer to hold statistics information
*
* @return The status of the operation
* @retval RETURN_OK if successful
* @retval RETURN_ERR if any error is detected
*/
INT xtm_hal_getLinkStats(XTM_LINK_TYPE type, UINT lineIndex, PXTM_LINK_STATS linkStats);
/* xtm_hal_getLinkName() function */
/**
* @brief - Get XTM (ATM/PTM) link interface name
*
* @param Type of XTM link type. Could be ATM or PTM
* @param XTM link line index
* @param String to hold XTM link interface name
*
* @return The status of the operation
* @retval RETURN_OK if successful
* @retval RETURN_ERR if any error is detected
*/
INT xtm_hal_getLinkName(XTM_LINK_TYPE type, UINT lineIndex, CHAR *ifName);
/* xtm_hal_getLinkMacAddress() function */
/**
* @brief - Get XTM (ATM/PTM) link interface mac address.
*
* @param Type of XTM link type. Could be ATM or PTM
* @param XTM link line index
* @param String to hold XTM link interface Mac address
*
* @return The status of the operation
* @retval RETURN_OK if successful
* @retval RETURN_ERR if any error is detected
*
*/
INT xtm_hal_getLinkMacAddress(XTM_LINK_TYPE type, UINT lineIndex, CHAR *macAddr);
/* xtm_hal_getLinkStatus() function */
/**
* @brief - Get XTM (ATM/PTM) interface link status.
*
* @param Type of XTM link type. Could be ATM or PTM
* @param XTM link line index
* @param Enum object to hold the link status
*
* @return The status of the operation
* @retval RETURN_OK if successful
* @retval RETURN_ERR if any error is detected
*/
INT xtm_hal_getLinkStatus(XTM_LINK_TYPE type, UINT lineIndex, PXTM_LINK_STATUS linkStatus);
/* xtm_hal_getLinkNumberOfEntries () function */
/**
* @brief - Get total number of XTM (ATM/PTM) link entries.
*
* @param Type of XTM link type. Could be ATM or PTM
* @param Unsigned integer to store the total number of XTM line entries
*
* @return The status of the operation
* @retval RETURN_OK if successful
* @retval RETURN_ERR if any error is detected
*/
INT xtm_hal_getLinkNumberOfEntries(XTM_LINK_TYPE type, UINT *lineCount);
/* xtm_hal_getLinkLastChange() function */
/**
* @brief - Get XTM (ATM/PTM) link interface last configured time stamp.
*
* @param Type of XTM link type. Could be ATM or PTM
* @param PTM line index number
* @param String to hold the last XTM interface configured time.
*
* @return The status of the operation
* @return The status of the operation
* @retval Return last timestamp value
*/
INT xtm_hal_getLinkLastChange(XTM_LINK_TYPE type, UINT lineIndex, UINT *timestamp);
#endif