NXP LPC LWIP port documentation  v0.80
LWIP port for LPC devices
C:/lwip_lpc/nxpcommon/lpc_emac.h
Go to the documentation of this file.
00001 /**********************************************************************
00002 * $Id$    lpc_emac.h      2011-11-20
00003 */
00026 #ifndef __LPC_EMAC_H
00027 #define __LPC_EMAC_H
00028 
00029 #include "lwip/netif.h"
00030 #include "lwip/pbuf.h"
00031 #include "lpc_emac_config.h"
00032 #include "lpc_phy.h"
00033 #include "lpc177x_8x_emac.h"
00034 
00035 #ifdef __cplusplus
00036 extern "C"
00037 {
00038 #endif
00039 
00045 typedef struct
00046 {
00047   volatile u32_t packet;        
00048   volatile u32_t control;       
00049 } LPC_TXRX_DESC_T;
00050 
00053 typedef struct
00054 {
00055   volatile u32_t statusinfo;   
00056   volatile u32_t statushashcrc; 
00057 } LPC_TXRX_STATUS_T;
00058 
00061 struct lpc_enetdata {
00062   struct netif *netif;        
00063   LPC_TXRX_DESC_T ptxd[LPC_NUM_BUFF_TXDESCS];   
00064   LPC_TXRX_STATUS_T ptxs[LPC_NUM_BUFF_TXDESCS]; 
00065   LPC_TXRX_DESC_T prxd[LPC_NUM_BUFF_RXDESCS];   
00066   LPC_TXRX_STATUS_T prxs[LPC_NUM_BUFF_RXDESCS]; 
00067 #if LPC_PBUF_RX_ZEROCOPY
00068   struct pbuf *rxb[LPC_NUM_BUFF_RXDESCS]; 
00069   u32_t rx_fill_desc_index; 
00070   u32_t rx_free_descs; 
00071 #else
00072   u32_t lpc_rx_buffs[LPC_NUM_BUFF_RXDESCS][1 + (EMAC_ETH_MAX_FLEN / 4)]; 
00073 #endif
00074 #if LPC_PBUF_TX_ZEROCOPY
00075   struct pbuf *txb[LPC_NUM_BUFF_TXDESCS]; 
00076   u32_t lpc_last_tx_idx; 
00077 #else
00078   u32_t lpc_tx_buffs[LPC_NUM_BUFF_TXDESCS][1 + (EMAC_ETH_MAX_FLEN / 4)]; 
00079 #endif
00080 };
00081 
00085 extern struct lpc_enetdata lpc_enetdata;
00086 
00087 void lpc_mii_write_noblock(u32_t PhyReg, u32_t Value);
00088 err_t lpc_mii_write(u32_t PhyReg, u32_t Value);
00089 u32_t lpc_mii_read_status(void);
00090 u32_t lpc_mii_read_data(void);
00091 err_t lpc_mii_read(u32_t PhyReg, u32_t *data);
00092 void lpc_mii_read_noblock(u32_t PhyReg);
00093 void lpc_enetif_input(struct netif *netif);
00094 s32_t lpc_tx_ready(struct netif *netif);
00095 err_t lpc_enetif_init(struct netif *netif);
00096 #if LPC_PBUF_RX_ZEROCOPY
00097 s32_t lpc_rx_queue(struct netif *netif);
00098 #endif
00099 #if LPC_PBUF_TX_ZEROCOPY
00100 void lpc_tx_reclaim(struct netif *netif);
00101 #endif
00102 
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 #endif