2 * @brief LPC18xx/43xx ethernet driver
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * All rights reserved.
\r
9 * Software that is described herein is for illustrative purposes only
\r
10 * which provides customers with programming information regarding the
\r
11 * LPC products. This software is supplied "AS IS" without any warranties of
\r
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
13 * all warranties, express or implied, including all implied warranties of
\r
14 * merchantability, fitness for a particular purpose and non-infringement of
\r
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
16 * or liability for the use of the software, conveys no license or rights under any
\r
17 * patent, copyright, mask work right, or any other intellectual property rights in
\r
18 * or to any products. NXP Semiconductors reserves the right to make changes
\r
19 * in the software without notification. NXP Semiconductors also makes no
\r
20 * representation or warranty that such application will be suitable for the
\r
21 * specified use without further testing or modification.
\r
24 * Permission to use, copy, modify, and distribute this software and its
\r
25 * documentation is hereby granted, under NXP Semiconductors' and its
\r
26 * licensor's relevant copyrights in the software, without fee, provided that it
\r
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
28 * copyright, permission, and disclaimer notice must appear in all copies of
\r
32 #ifndef __ENET_18XX_43XX_H_
\r
33 #define __ENET_18XX_43XX_H_
\r
39 /** @defgroup ENET_18XX_43XX CHIP: LPC18xx/43xx Ethernet driver
\r
40 * @ingroup CHIP_18XX_43XX_Drivers
\r
44 /** @defgroup ENET_18XX_43XX_OPTIONS CHIP: LPC18xx/43xx Ethernet driver build options
\r
45 * @ingroup ENET_18XX_43XX CHIP_18XX_43XX_DRIVER_OPTIONS
\r
46 * The ethernet driver has options that configure it's operation at build-time.<br>
\r
48 * <b>USE_RMII</b><br>
\r
49 * When defined, the driver will be built for RMII operation.<br>
\r
50 * When not defined, the driver will be built for MII operation.<br>
\r
59 * @brief Resets the ethernet interface
\r
60 * @param pENET : The base of ENET peripheral on the chip
\r
62 * @note Resets the ethernet interface. This should be called prior to
\r
63 * Chip_ENET_Init with a small delay after this call.
\r
65 STATIC INLINE void Chip_ENET_Reset(LPC_ENET_T *pENET)
\r
67 IP_ENET_Reset(pENET);
\r
71 * @brief Sets the address of the interface
\r
72 * @param pENET : The base of ENET peripheral on the chip
\r
73 * @param macAddr : Pointer to the 6 bytes used for the MAC address
\r
76 STATIC INLINE void Chip_ENET_SetADDR(LPC_ENET_T *pENET, const uint8_t *macAddr)
\r
78 IP_ENET_SetADDR(pENET, macAddr);
\r
82 * @brief Sets up the PHY link clock divider and PHY address
\r
83 * @param pENET : The base of ENET peripheral on the chip
\r
84 * @param div : Divider index, not a divider value, see user manual
\r
85 * @param addr : PHY address, used with MII read and write
\r
88 STATIC INLINE void Chip_ENET_SetupMII(LPC_ENET_T *pENET, uint32_t div, uint8_t addr)
\r
90 IP_ENET_SetupMII(pENET, div, addr);
\r
94 * @brief Starts a PHY write via the MII
\r
95 * @param pENET : The base of ENET peripheral on the chip
\r
96 * @param reg : PHY register to write
\r
97 * @param data : Data to write to PHY register
\r
99 * @note Start a PHY write operation. Does not block, requires calling
\r
100 * IP_ENET_IsMIIBusy to determine when write is complete.
\r
102 STATIC INLINE void Chip_ENET_StartMIIWrite(LPC_ENET_T *pENET, uint8_t reg, uint16_t data)
\r
104 IP_ENET_StartMIIWrite(pENET, reg, data);
\r
108 * @brief Starts a PHY read via the MII
\r
109 * @param pENET : The base of ENET peripheral on the chip
\r
110 * @param reg : PHY register to read
\r
112 * @note Start a PHY read operation. Does not block, requires calling
\r
113 * IP_ENET_IsMIIBusy to determine when read is complete and calling
\r
114 * IP_ENET_ReadMIIData to get the data.
\r
116 STATIC INLINE void Chip_ENET_StartMIIRead(LPC_ENET_T *pENET, uint8_t reg)
\r
118 IP_ENET_StartMIIRead(pENET, reg);
\r
122 * @brief Returns MII link (PHY) busy status
\r
123 * @param pENET : The base of ENET peripheral on the chip
\r
124 * @return Returns true if busy, otherwise false
\r
126 STATIC INLINE bool Chip_ENET_IsMIIBusy(LPC_ENET_T *pENET)
\r
128 return IP_ENET_IsMIIBusy(pENET);
\r
132 * @brief Returns the value read from the PHY
\r
133 * @param pENET : The base of ENET peripheral on the chip
\r
134 * @return Read value from PHY
\r
136 STATIC INLINE uint16_t Chip_ENET_ReadMIIData(LPC_ENET_T *pENET)
\r
138 return IP_ENET_ReadMIIData(pENET);
\r
142 * @brief Enables ethernet transmit
\r
143 * @param pENET : The base of ENET peripheral on the chip
\r
146 STATIC INLINE void Chip_ENET_TXEnable(LPC_ENET_T *pENET)
\r
148 IP_ENET_TXEnable(pENET);
\r
152 * @brief Disables ethernet transmit
\r
153 * @param pENET : The base of ENET peripheral on the chip
\r
156 STATIC INLINE void Chip_ENET_TXDisable(LPC_ENET_T *pENET)
\r
158 IP_ENET_TXDisable(pENET);
\r
162 * @brief Enables ethernet packet reception
\r
163 * @param pENET : The base of ENET peripheral on the chip
\r
166 STATIC INLINE void Chip_ENET_RXEnable(LPC_ENET_T *pENET)
\r
168 IP_ENET_RXEnable(pENET);
\r
172 * @brief Disables ethernet packet reception
\r
173 * @param pENET : The base of ENET peripheral on the chip
\r
176 STATIC INLINE void Chip_ENET_RXDisable(LPC_ENET_T *pENET)
\r
178 IP_ENET_RXDisable(pENET);
\r
182 * @brief Sets full or half duplex for the interface
\r
183 * @param pENET : The base of ENET peripheral on the chip
\r
184 * @param full : true to selected full duplex, false for half
\r
187 STATIC INLINE void Chip_ENET_SetDuplex(LPC_ENET_T *pENET, bool full)
\r
189 IP_ENET_SetDuplex(pENET, full);
\r
193 * @brief Sets speed for the interface
\r
194 * @param pENET : The base of ENET peripheral on the chip
\r
195 * @param speed100 : true to select 100Mbps mode, false for 10Mbps
\r
198 STATIC INLINE void Chip_ENET_SetSpeed(LPC_ENET_T *pENET, bool speed100)
\r
200 IP_ENET_SetSpeed(pENET, speed100);
\r
204 * @brief Configures the initial ethernet descriptors
\r
205 * @param pENET : The base of ENET peripheral on the chip
\r
206 * @param pTXDescs : Pointer to TX descriptor list
\r
207 * @param pRXDescs : Pointer to RX descriptor list
\r
210 STATIC INLINE void Chip_ENET_InitDescriptors(LPC_ENET_T *pENET,
\r
211 IP_ENET_001_ENHTXDESC_T *pTXDescs, IP_ENET_001_ENHRXDESC_T *pRXDescs)
\r
213 IP_ENET_InitDescriptors(pENET, pTXDescs, pRXDescs);
\r
217 * @brief Starts receive polling of RX descriptors
\r
218 * @param pENET : The base of ENET peripheral on the chip
\r
221 STATIC INLINE void Chip_ENET_RXStart(LPC_ENET_T *pENET)
\r
223 IP_ENET_RXStart(pENET);
\r
227 * @brief Starts transmit polling of TX descriptors
\r
228 * @param pENET : The base of ENET peripheral on the chip
\r
231 STATIC INLINE void Chip_ENET_TXStart(LPC_ENET_T *pENET)
\r
233 IP_ENET_TXStart(pENET);
\r
237 * @brief Initialize ethernet interface
\r
238 * @param pENET : The base of ENET peripheral on the chip
\r
240 * @note Performs basic initialization of the ethernet interface in a default
\r
241 * state. This is enough to place the interface in a usable state, but
\r
242 * may require more setup outside this function.
\r
244 void Chip_ENET_Init(LPC_ENET_T *pENET);
\r
247 * @brief De-initialize the ethernet interface
\r
248 * @param pENET : The base of ENET peripheral on the chip
\r
251 void Chip_ENET_DeInit(LPC_ENET_T *pENET);
\r
261 #endif /* __ENET_18XX_43XX_H_ */
\r