Nut/OS  4.10.3
API Reference
ax88796.h
Go to the documentation of this file.
00001 #ifndef _DEV_AX88796_H_
00002 #define _DEV_AX88796_H_
00003 
00004 #include <netinet/if_ether.h>
00005 #include <net/ether.h>
00006 #include <net/if_var.h>
00007 
00008 
00012 typedef struct {
00013     HANDLE volatile ni_rx_rdy;      
00014     HANDLE volatile ni_tx_rdy;      
00015     uint16_t ni_tx_cnt;              
00016     uint32_t ni_rx_packets;           
00017     uint32_t ni_tx_packets;           
00018     uint32_t ni_interrupts;           
00019     uint32_t ni_overruns;             
00020     uint32_t ni_rx_frame_errors;      
00021     uint32_t ni_rx_crc_errors;        
00022     uint32_t ni_rx_missed_errors;     
00023     uint8_t volatile ni_tx_bsy;      
00024     uint32_t ni_rx_pending;           
00025     uint8_t ni_curr_page;            
00026 }NICINFO;
00027 
00028 /*
00029  * Available drivers.
00030  */
00031 extern NUTDEVICE devAx88796;
00032 
00033 #ifndef DEV_ETHER
00034 #define DEV_ETHER   devAx88796
00035 #endif
00036 
00037 #ifndef devEth0
00038 #define devEth0   devAx88796
00039 #endif
00040 
00041 
00045 #define ASIX_BASE        0x20000000
00046 
00047 /* ! Read and write byte from controller */
00048 
00049 #define Asix_Read(reg) *(unsigned char *) (reg + ASIX_BASE)
00050 #define Asix_ReadWord(reg) *(unsigned short *) (reg + ASIX_BASE)
00051 #define Asix_Write(reg, data) *(unsigned char *) (reg + ASIX_BASE) = data
00052 #define Asix_WriteWord(reg, data) *(unsigned short *) (reg + ASIX_BASE) = data
00053 
00054 // buffer boundaries - transmit has 6 256-byte pages = 1536
00055 //   receive has 52 256-byte pages = 14848
00056 //   entire available packet buffer space is allocated
00057 #define TXSTART_INIT    0x40
00058 #define RXSTART_INIT    0x46
00059 #define RXSTOP_INIT     0x80
00060 
00061 extern int AsixInit(NUTDEVICE *dev);
00062 extern int AsixOutput(NUTDEVICE *dev, NETBUF *nb);
00063 void NicPhyWrite(uint8_t reg, uint16_t val);
00064 uint16_t NicPhyRead(uint8_t reg);
00065 
00066 #endif
00067