⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 str912_enet.h

📁 最新版IAR FOR ARM(EWARM)5.11中的代码例子
💻 H
📖 第 1 页 / 共 2 页
字号:
/*************************************************************************
 *
 *    Used with ICCARM and AARM.
 *
 *    (c) Copyright IAR Systems 2006
 *
 *    File name   : STR912_enet.h
 *    Description : MAC/DMA Controller with DMA (ENET) driver include file
 *
 *    History :
 *    1. Date        : October 4, 2006
 *       Author      : Stanimir Bonev
 *       Description : Create
 *
 *    $Revision: 16170 $
 **************************************************************************/
#include <includes.h>

#ifndef __STR912_ENET_H
#define __STR912_ENET_H
#include <io_macros.h>

/* DMA Status/Control Register (ENET_SCR) */
typedef struct{
__REG32 SRESET             : 1;
__REG32 LOOPB              : 1;
__REG32                    : 2;
__REG32 RX_MAX_BURST_SIZE  : 2;
__REG32 TX_MAX_BURST_SIZE  : 2;
__REG32 REVISION           : 8;
__REG32 RX_CHAN_STATUS     : 2;
__REG32 RX_IO_DATA_WIDTH   : 2;
__REG32 RX_FIFO_SIZE       : 4;
__REG32 TX_CHAN_STATUS     : 2;
__REG32 TX_IO_DATA_WIDTH   : 2;
__REG32 TX_FIFO_SIZE       : 4;
} __enet_scr_bits;

/* DMA Interrupt Enable Register (ENET_IER) */
typedef struct{
__REG32 RX_EMPTY_EN      : 1;
__REG32 RX_FULL_EN       : 1;
__REG32 RX_ENTRY_EN      : 1;
__REG32 RX_TO_EN         : 1;
__REG32                  : 1;
__REG32 PACKET_LOST_EN   : 1;
__REG32 RX_NEXT_EN       : 1;
__REG32 RX_DONE_EN       : 1;
__REG32                  : 1;
__REG32 RX_MERR_INT_EN   : 1;
__REG32                  : 5;
__REG32 RX_CURR_DONE_EN  : 1;
__REG32 TX_EMPTY_EN      : 1;
__REG32 TX_FULL_EN       : 1;
__REG32 TX_ENTRY_EN      : 1;
__REG32 TX_TO_EN         : 1;
__REG32                  : 2;
__REG32 TX_NEXT_EN       : 1;
__REG32 TX_DONE_EN       : 1;
__REG32                  : 1;
__REG32 TX_MERR_INT_EN   : 1;
__REG32                  : 2;
__REG32 MAC_8023_INT_EN  : 1;
__REG32                  : 2;
__REG32 TX_CURR_DONE_EN  : 1;
} __enet_ier_bits;

/* DMA Interrupt Status Register (ENET_ISR) */
typedef struct{
__REG32 RX_EMPTY      : 1;
__REG32 RX_FULL       : 1;
__REG32 RX_ENTRY      : 1;
__REG32 RX_TO         : 1;
__REG32               : 1;
__REG32 PACKET_LOST   : 1;
__REG32 RX_NEXT       : 1;
__REG32 RX_DONE       : 1;
__REG32               : 1;
__REG32 RX_MERR_INT   : 1;
__REG32               : 5;
__REG32 RX_CURR_DONE  : 1;
__REG32 TX_EMPTY      : 1;
__REG32 TX_FULL       : 1;
__REG32 TX_ENTRY      : 1;
__REG32 TX_TO         : 1;
__REG32               : 2;
__REG32 TX_NEXT       : 1;
__REG32 TX_DONE       : 1;
__REG32               : 1;
__REG32 TX_MERR_INT   : 1;
__REG32               : 2;
__REG32 MAC_8023_INT  : 1;
__REG32               : 2;
__REG32 TX_CURR_DONE  : 1;
} __enet_isr_bits;

/* Clock Configuration Register (ENET_CCR) */
typedef struct{
__REG32          : 2;
__REG32 SEL_CLK  : 2;
__REG32          :28;
} __enet_ccr_bits;

/* RX Start Register (ENET_RXSTR) */
typedef struct{
__REG32 DMA_EN       : 1;
__REG32              : 1;
__REG32 START_FETCH  : 1;
__REG32              : 2;
__REG32 FILTER_FAIL  : 1;
__REG32 RUNT_FRAME   : 1;
__REG32 COLL_SEEN    : 1;
__REG32 DFETCH_DLY   :16;
__REG32              : 8;
} __enet_rxstr_bits;

/* RX Control Register (ENET_RXCR) */
typedef struct{
__REG32 DMA_XFERCOUNT  :12;
__REG32 CONT_EN        : 1;
__REG32                : 1;
__REG32 NXT_EN         : 1;
__REG32 DLY_EN         : 1;
__REG32                : 1;
__REG32 ENTRY_TRIG     : 5;
__REG32 ADDR_WRAP      :10;
} __enet_rxcr_bits;

/* RX Start Address Register (ENET_RXSAR) */
typedef struct{
__REG32 WRAP_EN   : 1;
__REG32 FIX_ADDR  : 1;
__REG32 RXADDR    :30;
} __enet_rxsar_bits;

/* RX Next Descriptor Address Register (ENET_RXNDAR) */
typedef struct{
__REG32 NPOL_EN   : 1;
__REG32           : 1;
__REG32 DESCADDR  :30;
} __enet_rxndar_bits;

/* RX Current Transfer Count Register (ENET_RXCTCR) */
typedef struct{
__REG32 CXFER  :12;
__REG32        :20;
} __enet_rxctcr_bits;

/* RX Time-Out Register (ENET_RXTOR) */
typedef struct{
__REG32 RXTO   :16;
__REG32        :16;
} __enet_rxtor_bits;


/* RX Status Register (ENET_RXSR) */
typedef struct{
__REG32 EMPTY        : 1;
__REG32 FULL         : 1;
__REG32 ENTRY_T      : 1;
__REG32 DELAY_T      : 1;
__REG32              : 4;
__REG32 IO_POINTER   : 5;
__REG32              : 3;
__REG32 DMA_POINTER  : 5;
__REG32              : 3;
__REG32 ENTRIES      : 6;
__REG32              : 2;
} __enet_rxsr_bits;

/* TX Start Register (ENET_TXSTR) */
typedef struct{
__REG32 DMA_EN       : 1;
__REG32              : 1;
__REG32 START_FETCH  : 1;
__REG32              : 2;
__REG32 UNDER_RUN    : 1;
__REG32              : 2;
__REG32 DFETCH_DLY   :16;
__REG32              : 8;
} __enet_txstr_bits;

/* TX Control Register (ENET_TXCR) */
typedef struct{
__REG32 DMA_XFERCOUNT  :12;
__REG32 CONT_EN        : 1;
__REG32                : 1;
__REG32 NXT_EN         : 1;
__REG32 DLY_EN         : 1;
__REG32                : 1;
__REG32 ENTRY_TRIG     : 5;
__REG32 ADDR_WRAP      :10;
} __enet_txcr_bits;

/* TX Start Address Register (ENET_TXSAR) */
typedef struct{
__REG32 WRAP_EN   : 1;
__REG32 FIX_ADDR  : 1;
__REG32 TXADDR    :30;
} __enet_txsar_bits;

/* TX Next Descriptor Address Register (ENET_TXNDAR) */
typedef struct{
__REG32 NPOL_EN   : 1;
__REG32           : 1;
__REG32 DESCADDR  :30;
} __enet_txndar_bits;

/* TX Current Transfer Count Register (ENET_TXCTCR) */
typedef struct{
__REG32 CXFER  :12;
__REG32        :20;
} __enet_txctcr_bits;

/* TX Time-Out Register (ENET_TXTOR) */
typedef struct{
__REG32 TXTO   :16;
__REG32        :16;
} __enet_txtor_bits;

/* TX Status Register (ENET_TXSR) */
typedef struct{
__REG32 EMPTY        : 1;
__REG32 FULL         : 1;
__REG32 ENTRY_T      : 1;
__REG32 DELAY_T      : 1;
__REG32              : 4;
__REG32 IO_POINTER   : 5;
__REG32              : 3;
__REG32 DMA_POINTER  : 5;
__REG32              : 3;
__REG32 ENTRIES      : 6;
__REG32              : 2;
} __enet_txsr_bits;

/* MAC Control Register (ENET_MCR) */
typedef struct{
__REG32 RCFA  : 1;
__REG32       : 1;
__REG32 RE    : 1;
__REG32 TE    : 1;
__REG32 RVBE  : 1;
__REG32 DCE   : 1;
__REG32 BL    : 2;
__REG32 APR   : 1;
__REG32 RVFF  : 1;
__REG32 DPR   : 1;
__REG32 DBF   : 1;
__REG32 ELC   : 1;
__REG32       : 2;
__REG32 VFM   : 1;
__REG32 PWF   : 1;
__REG32 AFM   : 3;
__REG32 FDM   : 1;
__REG32 LM    : 2;
__REG32 DRO   : 1;
__REG32 PS    : 2;
__REG32       : 4;
__REG32 EN    : 1;
__REG32 RA    : 1;
} __enet_mcr_bits;

/* MII Address Register (ENET_MIIA) */
typedef struct{
__REG32 BUSY   : 1;
__REG32 WR     : 1;
__REG32 PR     : 1;
__REG32        : 3;
__REG32 RADDR  : 5;
__REG32 PADDR  : 5;
__REG32        :16;
} __enet_miia_bits;

/* MII Data Register (ENET_MIID) */
typedef struct{
__REG32 RDATA  :16;
__REG32        :16;
} __enet_miid_bits;

/* MII Control Frame Register (ENET_MCF) */
typedef struct{
__REG32 FCB    : 1;
__REG32 FCE    : 1;
__REG32 PCF    : 1;
__REG32        :13;
__REG32 PTIME  :16;
} __enet_mcf_bits;

/* VLAN1 Register (ENET_VL1) */
typedef struct{
__REG32 VLTAG1  :16;
__REG32 VLID1   :12;
__REG32         : 4;
} __enet_vl1_bits;

/* VLAN2 Register (ENET_VL2) */
typedef struct{
__REG32 VLTAG2  :16;
__REG32 VLID2   :12;
__REG32         : 4;
} __enet_vl2_bits;

/* MAC Transmission Status Register (ENET_MTS) */
typedef struct{
__REG32 FA   : 1;
__REG32      : 1;
__REG32 NC   : 1;
__REG32 LOC  : 1;
__REG32 ED   : 1;
__REG32 LC   : 1;
__REG32 EC   : 1;
__REG32 UR   : 1;
__REG32 DEF  : 1;
__REG32 LCO  : 1;
__REG32 CC   : 4;
__REG32      : 4;
__REG32 BC   :13;
__REG32 PR   : 1;
} __enet_mts_bits;

/* MAC Reception Status Register (ENET_MRS) */
typedef struct{
__REG32 FL   :11;
__REG32      : 2;
__REG32 FCI  : 1;
__REG32 WT   : 1;
__REG32 RF   : 1;
__REG32 OL   : 1;
__REG32 LC   : 1;
__REG32 FT   : 1;
__REG32 ME   : 1;
__REG32 EB   : 1;
__REG32 CE   : 1;
__REG32 VL1  : 1;
__REG32 VL2  : 1;
__REG32 LE   : 1;
__REG32 CF   : 1;
__REG32 UCF  : 1;
__REG32 MCF  : 1;
__REG32 BF   : 1;
__REG32 FF   : 1;
__REG32 PF   : 1;
__REG32 FA   : 1;
} __enet_mrs_bits;


/***************************************************************************
 **
 ** ENET
 **
 ***************************************************************************/
__IO_REG32_BIT(ENET_SCR,            0x7C000000,__READ_WRITE,__enet_scr_bits);
__IO_REG32_BIT(ENET_IER,            0x7C000004,__READ_WRITE,__enet_ier_bits);
__IO_REG32_BIT(ENET_ISR,            0x7C000008,__READ_WRITE,__enet_isr_bits);
__IO_REG32_BIT(ENET_CCR,            0x7C00000C,__READ_WRITE,__enet_ccr_bits);
__IO_REG32_BIT(ENET_RXSTR,          0x7C000010,__READ_WRITE,__enet_rxstr_bits);
__IO_REG32_BIT(ENET_RXCR,           0x7C000014,__READ_WRITE,__enet_rxcr_bits);
__IO_REG32_BIT(ENET_RXSAR,          0x7C000018,__READ_WRITE,__enet_rxsar_bits);
__IO_REG32_BIT(ENET_RXNDAR,         0x7C00001C,__READ_WRITE,__enet_rxndar_bits);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -