LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
enet_17xx_40xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC17xx/40xx ethernet driver
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __ENET_17XX_40XX_H_
33 #define __ENET_17XX_40XX_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
65 
74 {
75  IP_ENET_Reset(pENET);
76 }
77 
84 STATIC INLINE void Chip_ENET_SetADDR(LPC_ENET_T *pENET, const uint8_t *macAddr)
85 {
86  IP_ENET_SetADDR(pENET, macAddr);
87 }
88 
99 STATIC INLINE void Chip_ENET_SetupMII(LPC_ENET_T *pENET, uint32_t div, uint8_t addr)
100 {
101  IP_ENET_SetupMII(pENET, div, addr);
102 }
103 
113 STATIC INLINE void Chip_ENET_StartMIIWrite(LPC_ENET_T *pENET, uint8_t reg, uint16_t data)
114 {
115  IP_ENET_StartMIIWrite(pENET, reg, data);
116 }
117 
128 {
129  IP_ENET_StartMIIRead(pENET, reg);
130 }
131 
138 {
139  return IP_ENET_IsMIIBusy(pENET);
140 }
141 
148 {
149  return IP_ENET_ReadMIIData(pENET);
150 }
151 
158 {
159  IP_ENET_TXEnable(pENET);
160 }
161 
168 {
169  IP_ENET_TXDisable(pENET);
170 }
171 
178 {
179  IP_ENET_RXEnable(pENET);
180 }
181 
188 {
189  IP_ENET_RXDisable(pENET);
190 }
191 
198 {
199  IP_ENET_ResetTXLogic(pENET);
200 }
201 
208 {
209  IP_ENET_ResetRXLogic(pENET);
210 }
211 
219 {
220  IP_ENET_EnableRXFilter(pENET, mask);
221 }
222 
230 {
231  IP_ENET_DisableRXFilter(pENET, mask);
232 }
233 
240 {
241  IP_ENET_SetFullDuplex(pENET);
242 }
243 
250 {
251  IP_ENET_SetHalfDuplex(pENET);
252 }
253 
260 {
261  IP_ENET_Set100Mbps(pENET);
262 }
263 
270 {
271  IP_ENET_Set10Mbps(pENET);
272 }
273 
282 STATIC INLINE void Chip_ENET_InitTxDescriptors(LPC_ENET_T *pENET, ENET_TXDESC_T *pDescs,
283  ENET_TXSTAT_T *pStatus,
284  uint32_t descNum)
285 {
286  IP_ENET_InitTxDescriptors(pENET, pDescs, pStatus, descNum);
287 }
288 
297 STATIC INLINE void Chip_ENET_InitRxDescriptors(LPC_ENET_T *pENET, ENET_RXDESC_T *pDescs,
298  ENET_RXSTAT_T *pStatus,
299  uint32_t descNum)
300 {
301  IP_ENET_InitRxDescriptors(pENET, pDescs, pStatus, descNum);
302 }
303 
310 {
311  return IP_ENET_GetTXProduceIndex(pENET);
312 }
313 
320 {
321  return IP_ENET_GetTXConsumeIndex(pENET);
322 }
323 
330 {
331  return IP_ENET_GetRXProduceIndex(pENET);
332 }
333 
340 {
341  return IP_ENET_GetRXConsumeIndex(pENET);
342 }
343 
352 STATIC INLINE ENET_BUFF_STATUS Chip_ENET_GetBufferStatus(LPC_ENET_T *pENET, uint16_t produceIndex,
353  uint16_t consumeIndex,
354  uint16_t buffSize)
355 {
356  return IP_ENET_GetBufferStatus(produceIndex, consumeIndex, buffSize);
357 }
358 
367 STATIC INLINE uint32_t Chip_ENET_GetFillDescNum(LPC_ENET_T *pENET, uint16_t produceIndex, uint16_t consumeIndex, uint16_t buffSize)
368 {
369  return IP_ENET_GetFillDescNum(produceIndex, consumeIndex, buffSize);
370 }
371 
380 STATIC INLINE uint32_t Chip_ENET_GetFreeDescNum(LPC_ENET_T *pENET, uint16_t produceIndex, uint16_t consumeIndex, uint16_t buffSize)
381 {
382  return IP_ENET_GetFreeDescNum(produceIndex, consumeIndex, buffSize);
383 }
384 
391 {
392  return IP_ENET_IsTxFull(pENET);
393 }
394 
401 {
402  return IP_ENET_IsRxEmpty(pENET);
403 }
404 
411 {
412  return IP_ENET_IncTXProduceIndex(pENET);
413 }
414 
421 {
422  return IP_ENET_IncRXConsumeIndex(pENET);
423 }
424 
432 {
433  IP_ENET_EnableInt(pENET, mask);
434 }
435 
443 {
444  IP_ENET_DisableInt(pENET, mask);
445 }
446 
453 {
454  return IP_ENET_GetIntStatus(pENET);
455 }
456 
464 {
465  IP_ENET_ClearIntStatus(pENET, mask);
466 }
467 
476 void Chip_ENET_Init(LPC_ENET_T *pENET);
477 
483 void Chip_ENET_DeInit(LPC_ENET_T *pENET);
484 
494 
499 #ifdef __cplusplus
500 }
501 #endif
502 
503 #endif /* __ENET_17XX_40XX_H_ */