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

📄 xsssp.h

📁 优龙YLP270开发板 光盘自带的BIOS和实验例程源码 强烈推荐
💻 H
📖 第 1 页 / 共 2 页
字号:
    VUINT Reserved0[4];
    VUINT SSTO;     // SSP Time Out Register
    VUINT SSPSP;    // SSP Programmable Serial Protocol
} SspRegT;

typedef enum SspFormatE
{
    SspFormat_Spi,
    SspFormat_Ssp,
    SspFormat_Mwire,
    SspFormat_Psp
} SspFormatT;

typedef enum SspClockE
{
    SspOnChipClock,
    SspExtClock
} SspClockT;

typedef enum SspLoopModeE
{
    SspLoopbackOff,
    SspLoopbackOn
} SspLoopModeT;

typedef enum SspPolarSpiE
{
    SpiPolarityLow,
    SpiPolarityHigh
} SspPolarSpiT;

typedef enum SspPhaseSpiE
{
    SpiPhaseOne,
    SpiPhaseHalf
} SspPhaseSpiT;

typedef enum SspDataMwireE
{
    MwireData8,
    MwireData16
} SspDataMwireT;

typedef enum SspFIFOIntE
{
    SspFIFOIntDisabled,
    SspFIFOIntEnabled
} SspFIFOIntT;

typedef enum SspFIFOSpecE
{
    SspFIFOSpecialDisabled,
    SspFIFOSpecialEnabled
} SspFIFOSpecT;

typedef enum SspFIFOtypeE
{
    SspTxFIFO,
    SspRxFIFO
} SspFIFOtypeT;

// SSP devices types
typedef enum SspTypeE
{
    SSP1,
    SSP2,
    SSP3
} SspTypeT;


// SSP configuration structure
// This structure is used by the hardware setup function 
// to configure SSP
typedef struct SspCfgS 
{
    INT dataSize;       // Used to select data size (4 - 16 bit)
    INT frameFormat;    // Used to select SPI(0), SSP(1) or Microwire interface(2)
    INT extClock;       // An external clock is used, if this variable is set to one 
    INT SspExtClockFreq;// If external clock is used this defines ext clock freq.
    INT bitRate;        // Used to select bit rate (7200 - 1843200 bps)
    INT RxIntEnable;    // Rx FIFO level interrupt is enabled, if this is set to one
    INT TxIntEnable;    // Tx FIFO level interrupt is enabled, if this is set to one
    INT loopback;       // The loopback mode is enabled, if this is set to one
    INT polaritySPI;    // If SPI interface was selected, this is used to choose a polarity (0 - low)
    INT phaseSPI;       // If SPI interface was selected, this is used to choose a phase (0 - one cycle at the start)
    INT dataMicroWire;  // If Microwire interface was selected, this is used to choose the data (0 - 8 bit)
    INT thresholdTx;    // Transmit FIFO treshold value minus one
    INT thresholdRx;    // Receive FIFO treshold value minus one
    BOOL enableDMA;     // Enable/Disable DMA
    INT enableSpecial;  // FIFO special function is enabled, if this is set to one
    INT selectFIFO;     // If FIFO special function is enabled (0 - Tx FIFO), (1 - Rx FIFO) 
    INT scmodePsp;      // Serial bit-rate Clock Mode for PSP mode
    INT sfrmpPsp;       // Serial Frame Polarity for PSP mode
    INT etdsPsp;        // End of Transfer Data State for PSP mode
    INT strDlyPsp;      // Start Delay for PSP mode
    INT dmyStrtPsp;     // Dummy Start for PSP mode
    INT sfrmDlyPsp;     // Serial Frame Delay for PSP mode
    INT sfrmWidthPsp;   // Serial Frame Width for PSP mode
    INT dmyStopPsp;     // Dummy Stop for PSP mode
} SspCfgT;                  

// DMA configuration structure
// Used to configure DMA to service SSP
typedef struct SspDmaCfgS {
    UINT descNum;           // Number of the descriptors in the chain
    UINT bufferSize;        // buffer size for each of the descriptors, bytes
    UINT xferLength;        // Total length of the transfer, bytes
    UINT sourceName;        // Name of the source (see xsdma.h)
    UINT targetName;        // Name of the target (see xsdma.h)
    UINT priority;          // Channel's priority
} SspDmaCfgT;

// DMA Interrupt status structure
typedef struct SspDmaStatusS {
    INT busErrorIntCount;
    INT endIntCount;
    INT startIntCount;
    INT stopIntCount;
} SspDmaStatusT;

// Interrupt status structure
typedef struct SspIntStatusS {
    INT endErrorIntCount;
    INT txUnderunIntCount;
    INT rxAbortIntCount;
    INT frameErrorIntCount;
} SspIntStatusT;
                                
// SSP interface
typedef UINT32 (*SspSetupT) (void * ctxP);
typedef INT (*SspCleanupT) (void * ctxP);
typedef UINT32 (*SspLoopbackT) (void * ctxP, INT data);
typedef INT (*SspWriteT) (void * ctxP, UINT16 *buf, INT len);
typedef INT (*SspStatusT) (void * ctxP);
typedef INT (*SspReadT) (void * ctxP, UINT16 *buf, INT len);
typedef INT (*SspReadRawT) (void * ctxP, UINT16 *buf, INT len);
typedef INT (*SspClearRxT) (void * ctxP);
typedef INT (*SspClearTxT) (void * ctxP);
typedef void (*SspDmaIntHandlerT) (void *, UINT32);
typedef void (*SspIntHandlerT) (void *);

// SSP Context Structure
typedef struct SspContextS {
    SspRegT * regsP;                    // Pointer to SSP's register base
    SspCfgT * cfgP;                     // Pointer to SSP's confiquration structure
    UINT32 loggedError;                 // Used to report tests and drivers errors
    SspDmaStatusT * dmaTxIntStatusP;    // Pointer to DMA Tx Interrupt status structure
    SspDmaStatusT * dmaRxIntStatusP;    // Pointer to DMA Rx Interrupt status structure
    SspIntStatusT * intStatusP;         // Pointer to the Interrupt status structure
    SspTypeT type;                      // Used to pass the SSP ID
    UINT errorID;                       // Used to pass the SSP's error ID
    INT dmaRxChannel;                   // DMA channel used to transfer data from SSP to memory 
    INT dmaTxChannel;                   // DMA channel used to transfer data from memory to SSP 
    INT xferTxComplete;                 // Used by the dma interrupt handler to inform the test about Tx xfer completion
    INT xferRxComplete;                 // Used by the dma interrupt handler to inform the test about Rx xfer completion
    SspDmaCfgT * dmaTxCfgP;             // Pointer to DMA Tx configuration structure
    SspDmaCfgT * dmaRxCfgP;             // Pointer to DMA Rx configuration structure
    SspSetupT setupSspFnP;              // Pointer to SSP's hardware setup function 
    SspCleanupT shutdownSspFnP;         // Pointer to SSP's cleanup function
    SspLoopbackT loopbackSspFnP;        // Pointer to SSP's loopback function    
    SspWriteT writeSspFnP;              // Pointer to SSP's write function
    SspStatusT statusSspFnP;            // Pointer to SSP's status function
    SspReadT readSspFnP;                // Pointer to SSP's read function
    SspReadRawT readRawSspFnP;          // Pointer to SSP's read raw function
    SspClearTxT clearTxSspFnP;          // Pointer to SSP's clear Tx. FIFO function
    SspClearRxT clearRxSspFnP;          // Pointer to SSP's clear Rx. FIFO function
    SspDmaIntHandlerT intHandlerDmaTxFnP; // Pointer to SSP's DMA Tx int. handler
    SspDmaIntHandlerT intHandlerDmaRxFnP; // Pointer to SSP's DMA Rx int. handler
    SspIntHandlerT intHandlerSspFnP;      // Pointer to SSP's interrupt handler
} SspContextT;

/*
************************************************************************************
*                            GLOBAL VARIABLES 
************************************************************************************
*/

EXTRN SspContextT SspSerialPort;
EXTRN SspContextT SspSerialPort2;
EXTRN SspContextT SspSerialPort3;

/*
************************************************************************************
*                            FUNCTION PROTOTYPES 
************************************************************************************
*/

void XsSspSWInit (SspTypeT device);





#endif  /* _xsssp_h */

⌨️ 快捷键说明

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