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

📄 at91sam7x256.h

📁 一个开源的Modbus协议栈
💻 H
📖 第 1 页 / 共 5 页
字号:
// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register -------- 
#define AT91C_SPI_MSTR        ((unsigned int) 0x1 <<  0)        // (SPI) Master/Slave Mode
#define AT91C_SPI_PS          ((unsigned int) 0x1 <<  1)        // (SPI) Peripheral Select
#define 	AT91C_SPI_PS_FIXED                ((unsigned int) 0x0 <<  1)    // (SPI) Fixed Peripheral Select
#define 	AT91C_SPI_PS_VARIABLE             ((unsigned int) 0x1 <<  1)    // (SPI) Variable Peripheral Select
#define AT91C_SPI_PCSDEC      ((unsigned int) 0x1 <<  2)        // (SPI) Chip Select Decode
#define AT91C_SPI_FDIV        ((unsigned int) 0x1 <<  3)        // (SPI) Clock Selection
#define AT91C_SPI_MODFDIS     ((unsigned int) 0x1 <<  4)        // (SPI) Mode Fault Detection
#define AT91C_SPI_LLB         ((unsigned int) 0x1 <<  7)        // (SPI) Clock Selection
#define AT91C_SPI_PCS         ((unsigned int) 0xF << 16)        // (SPI) Peripheral Chip Select
#define AT91C_SPI_DLYBCS      ((unsigned int) 0xFF << 24)       // (SPI) Delay Between Chip Selects
// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register -------- 
#define AT91C_SPI_RD          ((unsigned int) 0xFFFF <<  0)     // (SPI) Receive Data
#define AT91C_SPI_RPCS        ((unsigned int) 0xF << 16)        // (SPI) Peripheral Chip Select Status
// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register -------- 
#define AT91C_SPI_TD          ((unsigned int) 0xFFFF <<  0)     // (SPI) Transmit Data
#define AT91C_SPI_TPCS        ((unsigned int) 0xF << 16)        // (SPI) Peripheral Chip Select Status
// -------- SPI_SR : (SPI Offset: 0x10) Status Register -------- 
#define AT91C_SPI_RDRF        ((unsigned int) 0x1 <<  0)        // (SPI) Receive Data Register Full
#define AT91C_SPI_TDRE        ((unsigned int) 0x1 <<  1)        // (SPI) Transmit Data Register Empty
#define AT91C_SPI_MODF        ((unsigned int) 0x1 <<  2)        // (SPI) Mode Fault Error
#define AT91C_SPI_OVRES       ((unsigned int) 0x1 <<  3)        // (SPI) Overrun Error Status
#define AT91C_SPI_ENDRX       ((unsigned int) 0x1 <<  4)        // (SPI) End of Receiver Transfer
#define AT91C_SPI_ENDTX       ((unsigned int) 0x1 <<  5)        // (SPI) End of Receiver Transfer
#define AT91C_SPI_RXBUFF      ((unsigned int) 0x1 <<  6)        // (SPI) RXBUFF Interrupt
#define AT91C_SPI_TXBUFE      ((unsigned int) 0x1 <<  7)        // (SPI) TXBUFE Interrupt
#define AT91C_SPI_NSSR        ((unsigned int) 0x1 <<  8)        // (SPI) NSSR Interrupt
#define AT91C_SPI_TXEMPTY     ((unsigned int) 0x1 <<  9)        // (SPI) TXEMPTY Interrupt
#define AT91C_SPI_SPIENS      ((unsigned int) 0x1 << 16)        // (SPI) Enable Status
// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register -------- 
// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register -------- 
// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register -------- 
// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register -------- 
#define AT91C_SPI_CPOL        ((unsigned int) 0x1 <<  0)        // (SPI) Clock Polarity
#define AT91C_SPI_NCPHA       ((unsigned int) 0x1 <<  1)        // (SPI) Clock Phase
#define AT91C_SPI_CSAAT       ((unsigned int) 0x1 <<  3)        // (SPI) Chip Select Active After Transfer
#define AT91C_SPI_BITS        ((unsigned int) 0xF <<  4)        // (SPI) Bits Per Transfer
#define 	AT91C_SPI_BITS_8                    ((unsigned int) 0x0 <<  4)  // (SPI) 8 Bits Per transfer
#define 	AT91C_SPI_BITS_9                    ((unsigned int) 0x1 <<  4)  // (SPI) 9 Bits Per transfer
#define 	AT91C_SPI_BITS_10                   ((unsigned int) 0x2 <<  4)  // (SPI) 10 Bits Per transfer
#define 	AT91C_SPI_BITS_11                   ((unsigned int) 0x3 <<  4)  // (SPI) 11 Bits Per transfer
#define 	AT91C_SPI_BITS_12                   ((unsigned int) 0x4 <<  4)  // (SPI) 12 Bits Per transfer
#define 	AT91C_SPI_BITS_13                   ((unsigned int) 0x5 <<  4)  // (SPI) 13 Bits Per transfer
#define 	AT91C_SPI_BITS_14                   ((unsigned int) 0x6 <<  4)  // (SPI) 14 Bits Per transfer
#define 	AT91C_SPI_BITS_15                   ((unsigned int) 0x7 <<  4)  // (SPI) 15 Bits Per transfer
#define 	AT91C_SPI_BITS_16                   ((unsigned int) 0x8 <<  4)  // (SPI) 16 Bits Per transfer
#define AT91C_SPI_SCBR        ((unsigned int) 0xFF <<  8)       // (SPI) Serial Clock Baud Rate
#define AT91C_SPI_DLYBS       ((unsigned int) 0xFF << 16)       // (SPI) Delay Before SPCK
#define AT91C_SPI_DLYBCT      ((unsigned int) 0xFF << 24)       // (SPI) Delay Between Consecutive Transfers

// *****************************************************************************
//              SOFTWARE API DEFINITION  FOR Usart
// *****************************************************************************
typedef struct _AT91S_USART
{
    AT91_REG        US_CR;      // Control Register
    AT91_REG        US_MR;      // Mode Register
    AT91_REG        US_IER;     // Interrupt Enable Register
    AT91_REG        US_IDR;     // Interrupt Disable Register
    AT91_REG        US_IMR;     // Interrupt Mask Register
    AT91_REG        US_CSR;     // Channel Status Register
    AT91_REG        US_RHR;     // Receiver Holding Register
    AT91_REG        US_THR;     // Transmitter Holding Register
    AT91_REG        US_BRGR;    // Baud Rate Generator Register
    AT91_REG        US_RTOR;    // Receiver Time-out Register
    AT91_REG        US_TTGR;    // Transmitter Time-guard Register
    AT91_REG        Reserved0[5];       // 
    AT91_REG        US_FIDI;    // FI_DI_Ratio Register
    AT91_REG        US_NER;     // Nb Errors Register
    AT91_REG        Reserved1[1];       // 
    AT91_REG        US_IF;      // IRDA_FILTER Register
    AT91_REG        Reserved2[44];      // 
    AT91_REG        US_RPR;     // Receive Pointer Register
    AT91_REG        US_RCR;     // Receive Counter Register
    AT91_REG        US_TPR;     // Transmit Pointer Register
    AT91_REG        US_TCR;     // Transmit Counter Register
    AT91_REG        US_RNPR;    // Receive Next Pointer Register
    AT91_REG        US_RNCR;    // Receive Next Counter Register
    AT91_REG        US_TNPR;    // Transmit Next Pointer Register
    AT91_REG        US_TNCR;    // Transmit Next Counter Register
    AT91_REG        US_PTCR;    // PDC Transfer Control Register
    AT91_REG        US_PTSR;    // PDC Transfer Status Register
} AT91S_USART  , *AT91PS_USART;

// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register -------- 
#define AT91C_US_STTBRK       ((unsigned int) 0x1 <<  9)        // (USART) Start Break
#define AT91C_US_STPBRK       ((unsigned int) 0x1 << 10)        // (USART) Stop Break
#define AT91C_US_STTTO        ((unsigned int) 0x1 << 11)        // (USART) Start Time-out
#define AT91C_US_SENDA        ((unsigned int) 0x1 << 12)        // (USART) Send Address
#define AT91C_US_RSTIT        ((unsigned int) 0x1 << 13)        // (USART) Reset Iterations
#define AT91C_US_RSTNACK      ((unsigned int) 0x1 << 14)        // (USART) Reset Non Acknowledge
#define AT91C_US_RETTO        ((unsigned int) 0x1 << 15)        // (USART) Rearm Time-out
#define AT91C_US_DTREN        ((unsigned int) 0x1 << 16)        // (USART) Data Terminal ready Enable
#define AT91C_US_DTRDIS       ((unsigned int) 0x1 << 17)        // (USART) Data Terminal ready Disable
#define AT91C_US_RTSEN        ((unsigned int) 0x1 << 18)        // (USART) Request to Send enable
#define AT91C_US_RTSDIS       ((unsigned int) 0x1 << 19)        // (USART) Request to Send Disable
// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register -------- 
#define AT91C_US_USMODE       ((unsigned int) 0xF <<  0)        // (USART) Usart mode
#define 	AT91C_US_USMODE_NORMAL               ((unsigned int) 0x0)       // (USART) Normal
#define 	AT91C_US_USMODE_RS485                ((unsigned int) 0x1)       // (USART) RS485
#define 	AT91C_US_USMODE_HWHSH                ((unsigned int) 0x2)       // (USART) Hardware Handshaking
#define 	AT91C_US_USMODE_MODEM                ((unsigned int) 0x3)       // (USART) Modem
#define 	AT91C_US_USMODE_ISO7816_0            ((unsigned int) 0x4)       // (USART) ISO7816 protocol: T = 0
#define 	AT91C_US_USMODE_ISO7816_1            ((unsigned int) 0x6)       // (USART) ISO7816 protocol: T = 1
#define 	AT91C_US_USMODE_IRDA                 ((unsigned int) 0x8)       // (USART) IrDA
#define 	AT91C_US_USMODE_SWHSH                ((unsigned int) 0xC)       // (USART) Software Handshaking
#define AT91C_US_CLKS         ((unsigned int) 0x3 <<  4)        // (USART) Clock Selection (Baud Rate generator Input Clock
#define 	AT91C_US_CLKS_CLOCK                ((unsigned int) 0x0 <<  4)   // (USART) Clock
#define 	AT91C_US_CLKS_FDIV1                ((unsigned int) 0x1 <<  4)   // (USART) fdiv1
#define 	AT91C_US_CLKS_SLOW                 ((unsigned int) 0x2 <<  4)   // (USART) slow_clock (ARM)
#define 	AT91C_US_CLKS_EXT                  ((unsigned int) 0x3 <<  4)   // (USART) External (SCK)
#define AT91C_US_CHRL         ((unsigned int) 0x3 <<  6)        // (USART) Clock Selection (Baud Rate generator Input Clock
#define 	AT91C_US_CHRL_5_BITS               ((unsigned int) 0x0 <<  6)   // (USART) Character Length: 5 bits
#define 	AT91C_US_CHRL_6_BITS               ((unsigned int) 0x1 <<  6)   // (USART) Character Length: 6 bits
#define 	AT91C_US_CHRL_7_BITS               ((unsigned int) 0x2 <<  6)   // (USART) Character Length: 7 bits
#define 	AT91C_US_CHRL_8_BITS               ((unsigned int) 0x3 <<  6)   // (USART) Character Length: 8 bits
#define AT91C_US_SYNC         ((unsigned int) 0x1 <<  8)        // (USART) Synchronous Mode Select
#define AT91C_US_NBSTOP       ((unsigned int) 0x3 << 12)        // (USART) Number of Stop bits
#define 	AT91C_US_NBSTOP_1_BIT                ((unsigned int) 0x0 << 12) // (USART) 1 stop bit
#define 	AT91C_US_NBSTOP_15_BIT               ((unsigned int) 0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits
#define 	AT91C_US_NBSTOP_2_BIT                ((unsigned int) 0x2 << 12) // (USART) 2 stop bits
#define AT91C_US_MSBF         ((unsigned int) 0x1 << 16)        // (USART) Bit Order
#define AT91C_US_MODE9        ((unsigned int) 0x1 << 17)        // (USART) 9-bit Character length
#define AT91C_US_CKLO         ((unsigned int) 0x1 << 18)        // (USART) Clock Output Select
#define AT91C_US_OVER         ((unsigned int) 0x1 << 19)        // (USART) Over Sampling Mode
#define AT91C_US_INACK        ((unsigned int) 0x1 << 20)        // (USART) Inhibit Non Acknowledge
#define AT91C_US_DSNACK       ((unsigned int) 0x1 << 21)        // (USART) Disable Successive NACK
#define AT91C_US_MAX_ITER     ((unsigned int) 0x1 << 24)        // (USART) Number of Repetitions
#define AT91C_US_FILTER       ((unsigned int) 0x1 << 28)        // (USART) Receive Line Filter
// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register -------- 
#define AT91C_US_RXBRK        ((unsigned int) 0x1 <<  2)        // (USART) Break Received/End of Break
#define AT91C_US_TIMEOUT      ((unsigned int) 0x1 <<  8)        // (USART) Receiver Time-out
#define AT91C_US_ITERATION    ((unsigned int) 0x1 << 10)        // (USART) Max number of Repetitions Reached
#define AT91C_US_NACK         ((unsigned int) 0x1 << 13)        // (USART) Non Acknowledge
#define AT91C_US_RIIC         ((unsigned int) 0x1 << 16)        // (USART) Ring INdicator Input Change Flag
#define AT91C_US_DSRIC        ((unsigned int) 0x1 << 17)        // (USART) Data Set Ready Input Change Flag
#define AT91C_US_DCDIC        ((unsigned int) 0x1 << 18)        // (USART) Data Carrier Flag
#define AT91C_US_CTSIC        ((unsigned int) 0x1 << 19)        // (USART) Clear To Send Input Change Flag
// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register -------- 
// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register -------- 
// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register -------- 
#define AT91C_US_RI           ((unsigned int) 0x1 << 20)        // (USART) Image of RI Input
#define AT91C_US_DSR          ((unsigned int) 0x1 << 21)        // (USART) Image of DSR Input
#define AT91C_US_DCD          ((unsigned int) 0x1 << 22)        // (USART) Image of DCD Input
#define AT91C_US_CTS          ((unsigned int) 0x1 << 23)        // (USART) Image of CTS Input

// *****************************************************************************
//              SOFTWARE API DEFINITION  FOR Synchronous Serial Controller Interface
// *****************************************************************************
typedef struct _AT91S_SSC
{
    AT91_REG        SSC_CR;     // Control Register
    AT91_REG        SSC_CMR;    // Clock Mode Register
    AT91_REG        Reserved0[2];       // 
    AT91_REG        SSC_RCMR;   // Receive Clock ModeRegister
    AT91_REG        SSC_RFMR;   // Receive Frame Mode Register
    AT91_REG        SSC_TCMR;   // Transmit Clock Mode Register
    AT91_REG        SSC_TFMR;   // Transmit Frame Mode Register
    AT91_REG        SSC_RHR;    // Receive Holding Register
    AT91_REG        SSC_THR;    // Transmit Holding Register
    AT91_REG        Reserved1[2];       // 
    AT91_REG        SSC_RSHR;   // Receive Sync Holding Register
    AT91_REG        SSC_TSHR;   // Transmit Sync Holding Register
    AT91_REG        Reserved2[2];       // 
    AT91_REG        SSC_SR;     // Status Register
    AT91_REG        SSC_IER;    // Interrupt Enable Register
    AT91_REG        SSC_IDR;    // Interrupt Disable Register
    AT91_REG        SSC_IMR;    // Interrupt Mask Register
    AT91_REG        Reserved3[44];      // 
    AT91_REG        SSC_RPR;    // Receive Pointer Register
    AT91_REG        SSC_RCR;    // Receive Counter Register
    AT91_REG        SSC_TPR;    // Transmit Pointer Register
    AT91_REG        SSC_TCR;    // Transmit Counter Register
    AT91_REG        SSC_RNPR;   // Receive Next Pointer Register
    AT91_REG        SSC_RNCR;   // Receive Next Counter Register
    AT91_REG        SSC_TNPR;   // Transmit Next Pointer Register
    AT91_REG        SSC_TNCR;   // Transmit Next Counter Register
    AT91_REG        SSC_PTCR;   // PDC Transfer Control Register
    AT91_REG        SSC_PTSR;   // PDC Transfer Status Register
}

⌨️ 快捷键说明

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