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