spips
Xilinx SDK Drivers API Documentation
Data Structures | Macros | Typedefs | Functions
xspips.h File Reference

Data Structures

struct  XSpiPs_Config
 
struct  XSpiPs
 

Macros

#define XSpiPs_SetSlaveIdle(InstancePtr, RegisterValue)
 
#define XSpiPs_GetSlaveIdle(InstancePtr)
 
#define XSpiPs_SetTXWatermark(InstancePtr, RegisterValue)
 
#define XSpiPs_GetTXWatermark(InstancePtr)   XSpiPs_In32(((InstancePtr)->Config.BaseAddress) + XSPIPS_TXWR_OFFSET)
 
#define XSpiPs_SetRXWatermark(InstancePtr, RegisterValue)
 
#define XSpiPs_GetRXWatermark(InstancePtr)   XSpiPs_In32(((InstancePtr)->Config.BaseAddress) + XSPIPS_RXWR_OFFSET)
 
#define XSpiPs_Enable(InstancePtr)
 
#define XSpiPs_Disable(InstancePtr)   XSpiPs_Out32(((InstancePtr)->Config.BaseAddress) + XSPIPS_ER_OFFSET, 0U)
 
Configuration options

The following options are supported to enable/disable certain features of an SPI device.

Each of the options is a bit mask, so more than one may be specified.

The Master option configures the SPI device as a master. By default, the device is a slave.

The Active Low Clock option configures the device's clock polarity. Setting this option means the clock is active low and the SCK signal idles high. By default, the clock is active high and SCK idles low.

The Clock Phase option configures the SPI device for one of two transfer formats. A clock phase of 0, the default, means data is valid on the first SCK edge (rising or falling) after the slave select (SS) signal has been asserted. A clock phase of 1 means data is valid on the second SCK edge (rising or falling) after SS has been asserted.

The Slave Select Decode Enable option selects how the SPI_SS_outN are controlled by the SPI Slave Select Decode bits. 0: Use this setting for the standard configuration of up to three slave select outputs. Only one of the three slave select outputs will be low. (Default) 1: Use this setting for the optional configuration of an additional decoder to support 8 slave select outputs. SPI_SS_outN reflects the value in the register.

The SPI Force Slave Select option is used to enable manual control of the signals SPI_SS_outN. 0: The SPI_SS_outN signals are controlled by the SPI controller during transfers. (Default) 1: The SPI_SS_outN signal indicated by the Slave Select Control bit is forced active (driven low) regardless of any transfers in progress.

NOTE: The driver will handle setting and clearing the Slave Select when the user sets the "FORCE_SSELECT_OPTION". Using this option will allow the SPI clock to be set to a faster speed. If the SPI clock is too fast, the processor cannot empty and refill the FIFOs before the TX FIFO is empty When the SPI hardware is controlling the Slave Select signals, this will cause slave to be de-selected and terminate the transfer.

The Manual Start option is used to enable manual control of the Start command to perform data transfer. 0: The Start command is controlled by the SPI controller during transfers(Default). Data transmission starts as soon as there is data in the TXFIFO and stalls when the TXFIFO is empty 1: The Start command must be issued by software to perform data transfer. Bit 15 of Configuration register is used to issue Start command. This bit must be set whenever TXFIFO is filled with new data.

NOTE: The driver will set the Manual Start Enable bit in Configuration Register, if Manual Start option is selected. Software will issue Manual Start command whenever TXFIFO is filled with data. When there is no further data, driver will clear the Manual Start Enable bit.

SPI Clock Prescaler options

The SPI Clock Prescaler Configuration bits are used to program master mode bit rate.

The bit rate can be programmed in divide-by-two decrements from pclk/4 to pclk/256.

Callback events

These constants specify the handler events that are passed to a handler from the driver.

These constants are not bit masks such that only one will be passed at a time to the handler.

Typedefs

typedef void(* XSpiPs_StatusHandler) (void *CallBackRef, u32 StatusEvent, u32 ByteCount)
 

Functions

XSpiPs_ConfigXSpiPs_LookupConfig (u16 DeviceId)
 
s32 XSpiPs_CfgInitialize (XSpiPs *InstancePtr, XSpiPs_Config *ConfigPtr, u32 EffectiveAddr)
 
void XSpiPs_Reset (XSpiPs *InstancePtr)
 
s32 XSpiPs_Transfer (XSpiPs *InstancePtr, u8 *SendBufPtr, u8 *RecvBufPtr, u32 ByteCount)
 
s32 XSpiPs_PolledTransfer (XSpiPs *InstancePtr, u8 *SendBufPtr, u8 *RecvBufPtr, u32 ByteCount)
 
void XSpiPs_SetStatusHandler (XSpiPs *InstancePtr, void *CallBackRef, XSpiPs_StatusHandler FunctionPtr)
 
void XSpiPs_InterruptHandler (XSpiPs *InstancePtr)
 
void XSpiPs_Abort (XSpiPs *InstancePtr)
 
s32 XSpiPs_SetSlaveSelect (XSpiPs *InstancePtr, u8 SlaveSel)
 
u8 XSpiPs_GetSlaveSelect (XSpiPs *InstancePtr)
 
s32 XSpiPs_SelfTest (XSpiPs *InstancePtr)
 
s32 XSpiPs_SetOptions (XSpiPs *InstancePtr, u32 Options)
 
u32 XSpiPs_GetOptions (XSpiPs *InstancePtr)
 
s32 XSpiPs_SetClkPrescaler (XSpiPs *InstancePtr, u8 Prescaler)
 
u8 XSpiPs_GetClkPrescaler (XSpiPs *InstancePtr)
 
s32 XSpiPs_SetDelays (XSpiPs *InstancePtr, u8 DelayNss, u8 DelayBtwn, u8 DelayAfter, u8 DelayInit)
 
void XSpiPs_GetDelays (XSpiPs *InstancePtr, u8 *DelayNss, u8 *DelayBtwn, u8 *DelayAfter, u8 *DelayInit)