📄 cpm2.h
字号:
ushort fen_tfcstat; /* out of sequence TxBD */ ushort fen_tfclen; uint fen_tfcptr; ushort fen_mflr; /* Maximum frame length (1518) */ ushort fen_paddrh; /* MAC address */ ushort fen_paddrm; ushort fen_paddrl; ushort fen_ibdcount; /* Internal BD counter */ ushort fen_ibdstart; /* Internal BD start pointer */ ushort fen_ibdend; /* Internal BD end pointer */ ushort fen_txlen; /* Internal Tx frame length counter */ uint fen_ibdbase[8]; /* Internal use */ uint fen_iaddrh; /* Individual address filter */ uint fen_iaddrl; ushort fen_minflr; /* Minimum frame length (64) */ ushort fen_taddrh; /* Filter transfer MAC address */ ushort fen_taddrm; ushort fen_taddrl; ushort fen_padptr; /* Pointer to pad byte buffer */ ushort fen_cftype; /* control frame type */ ushort fen_cfrange; /* control frame range */ ushort fen_maxb; /* maximum BD count */ ushort fen_maxd1; /* Max DMA1 length (1520) */ ushort fen_maxd2; /* Max DMA2 length (1520) */ ushort fen_maxd; /* internal max DMA count */ ushort fen_dmacnt; /* internal DMA counter */ uint fen_octc; /* Total octect counter */ uint fen_colc; /* Total collision counter */ uint fen_broc; /* Total broadcast packet counter */ uint fen_mulc; /* Total multicast packet count */ uint fen_uspc; /* Total packets < 64 bytes */ uint fen_frgc; /* Total packets < 64 bytes with errors */ uint fen_ospc; /* Total packets > 1518 */ uint fen_jbrc; /* Total packets > 1518 with errors */ uint fen_p64c; /* Total packets == 64 bytes */ uint fen_p65c; /* Total packets 64 < bytes <= 127 */ uint fen_p128c; /* Total packets 127 < bytes <= 255 */ uint fen_p256c; /* Total packets 256 < bytes <= 511 */ uint fen_p512c; /* Total packets 512 < bytes <= 1023 */ uint fen_p1024c; /* Total packets 1024 < bytes <= 1518 */ uint fen_cambuf; /* Internal CAM buffer poiner */ ushort fen_rfthr; /* Received frames threshold */ ushort fen_rfcnt; /* Received frames count */} fcc_enet_t;/* FCC Event/Mask register as used by Ethernet.*/#define FCC_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */#define FCC_ENET_RXC ((ushort)0x0040) /* Control Frame Received */#define FCC_ENET_TXC ((ushort)0x0020) /* Out of seq. Tx sent */#define FCC_ENET_TXE ((ushort)0x0010) /* Transmit Error */#define FCC_ENET_RXF ((ushort)0x0008) /* Full frame received */#define FCC_ENET_BSY ((ushort)0x0004) /* Busy. Rx Frame dropped */#define FCC_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */#define FCC_ENET_RXB ((ushort)0x0001) /* A buffer was received *//* FCC Mode Register (FPSMR) as used by Ethernet.*/#define FCC_PSMR_HBC ((uint)0x80000000) /* Enable heartbeat */#define FCC_PSMR_FC ((uint)0x40000000) /* Force Collision */#define FCC_PSMR_SBT ((uint)0x20000000) /* Stop backoff timer */#define FCC_PSMR_LPB ((uint)0x10000000) /* Local protect. 1 = FDX */#define FCC_PSMR_LCW ((uint)0x08000000) /* Late collision select */#define FCC_PSMR_FDE ((uint)0x04000000) /* Full Duplex Enable */#define FCC_PSMR_MON ((uint)0x02000000) /* RMON Enable */#define FCC_PSMR_PRO ((uint)0x00400000) /* Promiscuous Enable */#define FCC_PSMR_FCE ((uint)0x00200000) /* Flow Control Enable */#define FCC_PSMR_RSH ((uint)0x00100000) /* Receive Short Frames */#define FCC_PSMR_CAM ((uint)0x00000400) /* CAM enable */#define FCC_PSMR_BRO ((uint)0x00000200) /* Broadcast pkt discard */#define FCC_PSMR_ENCRC ((uint)0x00000080) /* Use 32-bit CRC *//* IIC parameter RAM.*/typedef struct iic { ushort iic_rbase; /* Rx Buffer descriptor base address */ ushort iic_tbase; /* Tx Buffer descriptor base address */ u_char iic_rfcr; /* Rx function code */ u_char iic_tfcr; /* Tx function code */ ushort iic_mrblr; /* Max receive buffer length */ uint iic_rstate; /* Internal */ uint iic_rdp; /* Internal */ ushort iic_rbptr; /* Internal */ ushort iic_rbc; /* Internal */ uint iic_rxtmp; /* Internal */ uint iic_tstate; /* Internal */ uint iic_tdp; /* Internal */ ushort iic_tbptr; /* Internal */ ushort iic_tbc; /* Internal */ uint iic_txtmp; /* Internal */} iic_t;/* SPI parameter RAM.*/typedef struct spi { ushort spi_rbase; /* Rx Buffer descriptor base address */ ushort spi_tbase; /* Tx Buffer descriptor base address */ u_char spi_rfcr; /* Rx function code */ u_char spi_tfcr; /* Tx function code */ ushort spi_mrblr; /* Max receive buffer length */ uint spi_rstate; /* Internal */ uint spi_rdp; /* Internal */ ushort spi_rbptr; /* Internal */ ushort spi_rbc; /* Internal */ uint spi_rxtmp; /* Internal */ uint spi_tstate; /* Internal */ uint spi_tdp; /* Internal */ ushort spi_tbptr; /* Internal */ ushort spi_tbc; /* Internal */ uint spi_txtmp; /* Internal */ uint spi_res; /* Tx temp. */ uint spi_res1[4]; /* SDMA temp. */} spi_t;/* SPI Mode register.*/#define SPMODE_LOOP ((ushort)0x4000) /* Loopback */#define SPMODE_CI ((ushort)0x2000) /* Clock Invert */#define SPMODE_CP ((ushort)0x1000) /* Clock Phase */#define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */#define SPMODE_REV ((ushort)0x0400) /* Reversed Data */#define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */#define SPMODE_EN ((ushort)0x0100) /* Enable */#define SPMODE_LENMSK ((ushort)0x00f0) /* character length */#define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */#define SPMODE_LEN(x) ((((x)-1)&0xF)<<4)#define SPMODE_PM(x) ((x) &0xF)#define SPI_EB ((u_char)0x10) /* big endian byte order */#define BD_IIC_START ((ushort)0x0400)/* IDMA parameter RAM*/typedef struct idma { ushort ibase; /* IDMA buffer descriptor table base address */ ushort dcm; /* DMA channel mode */ ushort ibdptr; /* IDMA current buffer descriptor pointer */ ushort dpr_buf; /* IDMA transfer buffer base address */ ushort buf_inv; /* internal buffer inventory */ ushort ss_max; /* steady-state maximum transfer size */ ushort dpr_in_ptr; /* write pointer inside the internal buffer */ ushort sts; /* source transfer size */ ushort dpr_out_ptr; /* read pointer inside the internal buffer */ ushort seob; /* source end of burst */ ushort deob; /* destination end of burst */ ushort dts; /* destination transfer size */ ushort ret_add; /* return address when working in ERM=1 mode */ ushort res0; /* reserved */ uint bd_cnt; /* internal byte count */ uint s_ptr; /* source internal data pointer */ uint d_ptr; /* destination internal data pointer */ uint istate; /* internal state */ u_char res1[20]; /* pad to 64-byte length */} idma_t;/* DMA channel mode bit fields*/#define IDMA_DCM_FB ((ushort)0x8000) /* fly-by mode */#define IDMA_DCM_LP ((ushort)0x4000) /* low priority */#define IDMA_DCM_TC2 ((ushort)0x0400) /* value driven on TC[2] */#define IDMA_DCM_DMA_WRAP_MASK ((ushort)0x01c0) /* mask for DMA wrap */#define IDMA_DCM_DMA_WRAP_64 ((ushort)0x0000) /* 64-byte DMA xfer buffer */#define IDMA_DCM_DMA_WRAP_128 ((ushort)0x0040) /* 128-byte DMA xfer buffer */#define IDMA_DCM_DMA_WRAP_256 ((ushort)0x0080) /* 256-byte DMA xfer buffer */#define IDMA_DCM_DMA_WRAP_512 ((ushort)0x00c0) /* 512-byte DMA xfer buffer */#define IDMA_DCM_DMA_WRAP_1024 ((ushort)0x0100) /* 1024-byte DMA xfer buffer */#define IDMA_DCM_DMA_WRAP_2048 ((ushort)0x0140) /* 2048-byte DMA xfer buffer */#define IDMA_DCM_SINC ((ushort)0x0020) /* source inc addr */#define IDMA_DCM_DINC ((ushort)0x0010) /* destination inc addr */#define IDMA_DCM_ERM ((ushort)0x0008) /* external request mode */#define IDMA_DCM_DT ((ushort)0x0004) /* DONE treatment */#define IDMA_DCM_SD_MASK ((ushort)0x0003) /* mask for SD bit field */#define IDMA_DCM_SD_MEM2MEM ((ushort)0x0000) /* memory-to-memory xfer */#define IDMA_DCM_SD_PER2MEM ((ushort)0x0002) /* peripheral-to-memory xfer */#define IDMA_DCM_SD_MEM2PER ((ushort)0x0001) /* memory-to-peripheral xfer *//* IDMA Buffer Descriptors*/typedef struct idma_bd { uint flags; uint len; /* data length */ uint src; /* source data buffer pointer */ uint dst; /* destination data buffer pointer */} idma_bd_t;/* IDMA buffer descriptor flag bit fields*/#define IDMA_BD_V ((uint)0x80000000) /* valid */#define IDMA_BD_W ((uint)0x20000000) /* wrap */#define IDMA_BD_I ((uint)0x10000000) /* interrupt */#define IDMA_BD_L ((uint)0x08000000) /* last */#define IDMA_BD_CM ((uint)0x02000000) /* continuous mode */#define IDMA_BD_SDN ((uint)0x00400000) /* source done */#define IDMA_BD_DDN ((uint)0x00200000) /* destination done */#define IDMA_BD_DGBL ((uint)0x00100000) /* destination global */#define IDMA_BD_DBO_LE ((uint)0x00040000) /* little-end dest byte order */#define IDMA_BD_DBO_BE ((uint)0x00080000) /* big-end dest byte order */#define IDMA_BD_DDTB ((uint)0x00010000) /* destination data bus */#define IDMA_BD_SGBL ((uint)0x00002000) /* source global */#define IDMA_BD_SBO_LE ((uint)0x00000800) /* little-end src byte order */#define IDMA_BD_SBO_BE ((uint)0x00001000) /* big-end src byte order */#define IDMA_BD_SDTB ((uint)0x00000200) /* source data bus *//* per-channel IDMA registers*/typedef struct im_idma { u_char idsr; /* IDMAn event status register */ u_char res0[3]; u_char idmr; /* IDMAn event mask register */ u_char res1[3];} im_idma_t;/* IDMA event register bit fields*/#define IDMA_EVENT_SC ((unsigned char)0x08) /* stop completed */#define IDMA_EVENT_OB ((unsigned char)0x04) /* out of buffers */#define IDMA_EVENT_EDN ((unsigned char)0x02) /* external DONE asserted */#define IDMA_EVENT_BC ((unsigned char)0x01) /* buffer descriptor complete *//* RISC Controller Configuration Register (RCCR) bit fields*/#define RCCR_TIME ((uint)0x80000000) /* timer enable */#define RCCR_TIMEP_MASK ((uint)0x3f000000) /* mask for timer period bit field */#define RCCR_DR0M ((uint)0x00800000) /* IDMA0 request mode */#define RCCR_DR1M ((uint)0x00400000) /* IDMA1 request mode */#define RCCR_DR2M ((uint)0x00000080) /* IDMA2 request mode */#define RCCR_DR3M ((uint)0x00000040) /* IDMA3 request mode */#define RCCR_DR0QP_MASK ((uint)0x00300000) /* mask for IDMA0 req priority */#define RCCR_DR0QP_HIGH ((uint)0x00000000) /* IDMA0 has high req priority */#define RCCR_DR0QP_MED ((uint)0x00100000) /* IDMA0 has medium req priority */#define RCCR_DR0QP_LOW ((uint)0x00200000) /* IDMA0 has low req priority */#define RCCR_DR1QP_MASK ((uint)0x00030000) /* mask for IDMA1 req priority */#define RCCR_DR1QP_HIGH ((uint)0x00000000) /* IDMA1 has high req priority */#define RCCR_DR1QP_MED ((uint)0x00010000) /* IDMA1 has medium req priority */#define RCCR_DR1QP_LOW ((uint)0x00020000) /* IDMA1 has low req priority */#define RCCR_DR2QP_MASK ((uint)0x00000030) /* mask for IDMA2 req priority */#define RCCR_DR2QP_HIGH ((uint)0x00000000) /* IDMA2 has high req priority */#define RCCR_DR2QP_MED ((uint)0x00000010) /* IDMA2 has medium req priority */#define RCCR_DR2QP_LOW ((uint)0x00000020) /* IDMA2 has low req priority */#define RCCR_DR3QP_MASK ((uint)0x00000003) /* mask for IDMA3 req priority */#define RCCR_DR3QP_HIGH ((uint)0x00000000) /* IDMA3 has high req priority */#define RCCR_DR3QP_MED ((uint)0x00000001) /* IDMA3 has medium req priority */#define RCCR_DR3QP_LOW ((uint)0x00000002) /* IDMA3 has low req priority */#define RCCR_EIE ((uint)0x00080000) /* external interrupt enable */#define RCCR_SCD ((uint)0x00040000) /* scheduler configuration */#define RCCR_ERAM_MASK ((uint)0x0000e000) /* mask for enable RAM microcode */#define RCCR_ERAM_0KB ((uint)0x00000000) /* use 0KB of dpram for microcode */#define RCCR_ERAM_2KB ((uint)0x00002000) /* use 2KB of dpram for microcode */#define RCCR_ERAM_4KB ((uint)0x00004000) /* use 4KB of dpram for microcode */#define RCCR_ERAM_6KB ((uint)0x00006000) /* use 6KB of dpram for microcode */#define RCCR_ERAM_8KB ((uint)0x00008000) /* use 8KB of dpram for microcode */#define RCCR_ERAM_10KB ((uint)0x0000a000) /* use 10KB of dpram for microcode */#define RCCR_ERAM_12KB ((uint)0x0000c000) /* use 12KB of dpram for microcode */#define RCCR_EDM0 ((uint)0x00000800) /* DREQ0 edge detect mode */#define RCCR_EDM1 ((uint)0x00000400) /* DREQ1 edge detect mode */#define RCCR_EDM2 ((uint)0x00000200) /* DREQ2 edge detect mode */#define RCCR_EDM3 ((uint)0x00000100) /* DREQ3 edge detect mode */#define RCCR_DEM01 ((uint)0x00000008) /* DONE0/DONE1 edge detect mode */#define RCCR_DEM23 ((uint)0x00000004) /* DONE2/DONE3 edge detect mode *//*----------------------------------------------------------------------- * CMXFCR - CMX FCC Clock Route Register */#define CMXFCR_FC1 0x40000000 /* FCC1 connection */#define CMXFCR_RF1CS_MSK 0x38000000 /* Receive FCC1 Clock Source Mask */#define CMXFCR_TF1CS_MSK 0x07000000 /* Transmit FCC1 Clock Source Mask */#define CMXFCR_FC2 0x00400000 /* FCC2 connection */#define CMXFCR_RF2CS_MSK 0x00380000 /* Receive FCC2 Clock Source Mask */#define CMXFCR_TF2CS_MSK 0x00070000 /* Transmit FCC2 Clock Source Mask */#define CMXFCR_FC3 0x00004000 /* FCC3 connection */#define CMXFCR_RF3CS_MSK 0x00003800 /* Receive FCC3 Clock Source Mask */#define CMXFCR_TF3CS_MSK 0x00000700 /* Transmit FCC3 Clock Source Mask */#define CMXFCR_RF1CS_BRG5 0x00000000 /* Receive FCC1 Clock Source is BRG5 */#define CMXFCR_RF1CS_BRG6 0x08000000 /* Receive FCC1 Clock Source is BRG6 */#define CMXFCR_RF1CS_BRG7 0x10000000 /* Receive FCC1 Clock Source is BRG7 */#define CMXFCR_RF1CS_BRG8 0x18000000 /* Receive FCC1 Clock Source is BRG8 */#define CMXFCR_RF1CS_CLK9 0x20000000 /* Receive FCC1 Clock Source is CLK9 */#define CMXFCR_RF1CS_CLK10 0x28000000 /* Receive FCC1 Clock Source is CLK10 */#define CMXFCR_RF1CS_CLK11 0x30000000 /* Receive FCC1 Clock Source is CLK11 */#define CMXFCR_RF1CS_CLK12 0x38000000 /* Receive FCC1 Clock Source is CLK12 */#define CMXFCR_TF1CS_BRG5 0x00000000 /* Transmit FCC1 Clock Source is BRG5 */#define CMXFCR_TF1CS_BRG6 0x01000000 /* Transmit FCC1 Clock Source is BRG6 */#define CMXFCR_TF1CS_BRG7 0x02000000 /* Transmit FCC1 Clock Source is BRG7 */#define CMXFCR_TF1CS_BRG8 0x03000000 /* Transmit FCC1 Clock Source is BRG8 */#define CMXFCR_TF1CS_CLK9 0x04000000 /* Transmit FCC1 Clock Source is CLK9 */#define CMXFCR_TF1CS_CLK10 0x05000000 /* Transmit FCC1 Clock Source is CLK10 */#define CMXFCR_TF1CS_CLK11 0x06000000 /* Transmit FCC1 Clock Source is CLK11 */#define CMXFCR_TF1CS_CLK12 0x07000000 /* Transmit FCC1 Clock Source is CLK12 */#define CMXFCR_RF2CS_BRG5 0x00000000 /* Receive FCC2 Clock Source is BRG5 */#define CMXFCR_RF2CS_BRG6 0x00080000 /* Receive FCC2 Clock Source is BRG6 */#define CMXFCR_RF2CS_BRG7 0x00100000 /* Receive FCC2 Clock Source is BRG7 */#define CMXFCR_RF2CS_BRG8 0x00180000 /* Receive FCC2 Clock Source is BRG8 */#define CMXFCR_RF2CS_CLK13 0x00200000 /* Receive FCC2 Clock Source is CLK13 */#define CMXFCR_RF2CS_CLK14 0x00280000 /* Receive FCC2 Clock Source is CLK14 */#define CMXFCR_RF2CS_CLK15 0x00300000 /* Receive FCC2 Clock Source is CLK15 */#define CMXFCR_RF2CS_CLK16 0x00380000 /* Receive FCC2 Clock Source is CLK16 */#define CMXFCR_TF2CS_BRG5 0x00000000 /* Transmit FCC2 Clock Source is BRG5 */#define CMXFCR_TF2CS_BRG6 0x00010000 /* Transmit FCC2 Clock Source is BRG6 */#define CMXFCR_TF2CS_BRG7 0x00020000 /* Transmit FCC2 Clock Source is BRG7 */#define CMXFCR_TF2CS_BRG8 0x00030000 /* Transmit FCC2 Clock Source is BRG8 */#define CMXFCR_TF2CS_CLK13 0x00040000 /* Transmit FCC2 Clock Source is CLK13 */#define CMXFCR_TF2CS_CLK14 0x00050000 /* Transmit FCC2 Clock Source is CLK14 */#define CMXFCR_TF2CS_CLK15 0x00060000 /* Transmit FCC2 Clock Source is CLK15 */#define CMXFCR_TF2CS_CLK16 0x00070000 /* Transmit FCC2 Clock Source is CLK16 */#define CMXFCR_RF3CS_BRG5 0x00000000 /* Receive FCC3 Clock Source is BRG5 */#define CMXFCR_RF3CS_BRG6 0x00000800 /* Receive FCC3 Clock Source is BRG6 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -