clean up header file
This commit is contained in:
@@ -4,25 +4,32 @@
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/netif.h"
|
||||
|
||||
void phy_write_reg(uint8_t reg_add, uint16_t reg_val);
|
||||
uint16_t phy_read_reg(uint8_t reg_add);
|
||||
|
||||
/* Unique device ID */
|
||||
#define ROM_CFG_USERADR_ID 0x1FFFF7E8
|
||||
|
||||
#define ETH_DMARxDesc_FrameLengthShift 16
|
||||
|
||||
#define ETH_MAX_PACKET_SIZE \
|
||||
1536 /* ETH_HEADER + VLAN_TAG + MAX_ETH_PAYLOAD + ETH_CRC */
|
||||
#define ETH_HEADER \
|
||||
14 /* 6 byte Dest addr, 6 byte Src addr, 2 byte length/type \
|
||||
*/
|
||||
/* Ethernet Frame Size Definitions */
|
||||
#define ETH_HEADER \
|
||||
14 /* 6 byte Dest addr, 6 byte Src addr, 2 byte length/type */
|
||||
#define ETH_CRC 4 /* Ethernet CRC */
|
||||
#define ETH_EXTRA 2 /* Extra bytes in some cases */
|
||||
#define VLAN_TAG 4 /* optional 802.1q VLAN Tag */
|
||||
|
||||
#define MIN_ETH_PAYLOAD 46 /* Minimum Ethernet payload size */
|
||||
#define MAX_ETH_PAYLOAD 1500 /* Maximum Ethernet payload size */
|
||||
|
||||
#define ETH_MAX_PACKET_SIZE \
|
||||
1536 /* ETH_HEADER + VLAN_TAG + MAX_ETH_PAYLOAD + ETH_CRC */
|
||||
#define MIN_ETH_FRAME_SIZE (ETH_HEADER + MIN_ETH_PAYLOAD) /* 60 bytes */
|
||||
|
||||
/* Buffer Configuration */
|
||||
#define ETH_RX_BUF_COUNT 4
|
||||
#define ETH_TX_BUF_COUNT 2
|
||||
#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE
|
||||
#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE
|
||||
|
||||
/* DMA descriptor stuff */
|
||||
#define ETH_DMARxDesc_FrameLengthShift 16
|
||||
|
||||
typedef struct {
|
||||
uint32_t volatile Status; /* Status */
|
||||
uint32_t ControlBufferSize; /* Control and Buffer1, Buffer2 lengths */
|
||||
@@ -31,29 +38,52 @@ typedef struct {
|
||||
} ETH_DMADESCTypeDef;
|
||||
|
||||
/**
|
||||
* @brief Initialize the ethernet interface and lwIP network stack.
|
||||
* This function should be passed as the init function to netif_add().
|
||||
* Should be called at the beginning of the program to set up the
|
||||
* network interface. It calls the function low_level_init() to do the
|
||||
* actual setup of the hardware.
|
||||
*
|
||||
* @param netif The lwIP network interface structure to be initialized.
|
||||
* @return ERR_OK if the loopif is initialized, ERR_MEM if private data couldn't
|
||||
* be allocated.
|
||||
* This function should be passed as a parameter to netif_add().
|
||||
*
|
||||
* @param netif the lwip network interface structure for this ethernetif
|
||||
* @return ERR_OK if the loopif is initialized
|
||||
* ERR_MEM if private data couldn't be allocated
|
||||
* any other err_t on error
|
||||
*/
|
||||
err_t ethernetif_init(struct netif* netif);
|
||||
|
||||
/**
|
||||
* @brief This function should be called periodically from your main loop
|
||||
* to check for incoming packets and pass them to lwIP.
|
||||
* This function should be called when a packet is ready to be read
|
||||
* from the interface. It uses the function low_level_input() that
|
||||
* should handle the actual reception of bytes from the network
|
||||
* interface. Then the type of the received packet is determined and
|
||||
* the appropriate input function is called.
|
||||
*
|
||||
* @param netif The lwIP network interface structure.
|
||||
* @param netif the lwip network interface structure for this ethernetif
|
||||
*/
|
||||
void ethernetif_input(struct netif* netif);
|
||||
|
||||
/**
|
||||
* @brief This function should be called periodically from your main loop
|
||||
* to check the link status and update lwIP accordingly.
|
||||
* This function should be called periodically from the main loop
|
||||
* to check the link status and update lwIP accordingly.
|
||||
*
|
||||
* @param netif The lwIP network interface structure..
|
||||
* @param netif the lwip network interface structure for this ethernetif
|
||||
*/
|
||||
void ethernetif_link_poll(struct netif* netif);
|
||||
|
||||
/**
|
||||
* Write a value to PHY register.
|
||||
*
|
||||
* @param reg_add PHY register address.
|
||||
* @param reg_val Value to write.
|
||||
*/
|
||||
void phy_write_reg(uint8_t reg_add, uint16_t reg_val);
|
||||
|
||||
/**
|
||||
* Read a value from PHY register.
|
||||
*
|
||||
* @param reg_add PHY register address.
|
||||
* @return Register value.
|
||||
*/
|
||||
uint16_t phy_read_reg(uint8_t reg_add);
|
||||
|
||||
#endif /* __ETHERNETIF_H */
|
||||
Reference in New Issue
Block a user