Ethernet.h
资源名称:str711USB.rar [点击查看]
上传用户:yyyd609
上传日期:2022-07-18
资源大小:183k
文件大小:2k
源码类别:
微处理器开发
开发平台:
C/C++
- #ifndef __ETHERNET_H__
- #define __ETHERNET_H__
- #include "71x_lib.h"
- // Ports for I/O-Mode
- #define ETH_Port(n) (*(vu16*)(0x64000000 | (n) << 11))
- #define ETH_RX_Frame_Port ETH_Port(0)
- #define ETH_TX_Frame_Port ETH_Port(0)
- #define ETH_TX_CMD_Port ETH_Port(4)
- #define ETH_TX_LEN_Port ETH_Port(6)
- #define ETH_Addr_Port ETH_Port(10)
- #define ETH_Data_Port ETH_Port(12)
- // Configuration and control registers
- #define PP_RxCFG 0x0102 // Rx Bus config
- #define PP_RxCTL 0x0104 // Receive Control Register
- #define PP_LineCTL 0x0112 // Line Config Register
- #define PP_SelfCTL 0x0114 // Self Command Register
- // Status and Event Registers
- #define PP_RxEvent 0x0124 // Rx Event Register
- #define PP_LineST 0x0134 // Line State Register
- #define PP_SelfST 0x0136 // Self State register
- #define PP_BusST 0x0138 // Bus Status
- // Adress Filter Registers
- #define PP_IA 0x0158 // Physical Address Register
- // PP_RxCFG - Receive Configuration and Interrupt Mask bit definition - Read/write
- #define SKIP_1 0x0040
- #define RX_OK_ENBL 0x0100
- // PP_RxCTL - Receive Control bit definition - Read/write
- #define RX_OK_ACCEPT 0x0100
- #define RX_IA_ACCEPT 0x0400
- #define RX_BROADCAST_ACCEPT 0x0800
- // PP_TxCMD - Transmit Command bit definition - Read-only and
- // PP_TxCommand - Write-only
- #define TX_START_ALL_BYTES 0x00C9
- // PP_LineCTL - Line Control bit definition - Read/write
- #define SERIAL_RX_ON 0x0040
- #define SERIAL_TX_ON 0x0080
- // PP_SelfCTL - Software Self Control bit definition - Read/write
- #define POWER_ON_RESET 0x0040
- // PP_RxEvent - Receive Event Bit definition - Read-only
- #define RX_OK 0x0100
- #define RX_IA 0x0400
- #define RX_BROADCAST 0x0800
- // PP_LineST - Ethernet Line Status bit definition - Read-only
- #define LINK_OK 0x0080
- // PP_SelfST - Chip Software Status bit definition
- #define INIT_DONE 0x0080
- // PP_BusST - ISA Bus Status bit definition
- #define READY_FOR_TX_NOW 0x0100
- extern u16 local_eth_addr[3];
- void NIC_Init(void);
- int NIC_RecvPack(u16 *buf);
- int NIC_SendPack(u16 *buf, int len);
- #endif