MAX32650 Peripheral Driver API
Peripheral Driver API for the MAX32650
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
SPI External Ram (SPIXR)

Modules

 SPIXR_Registers
 

Data Structures

struct  mxc_spixr_cfg_t
 

Enumerations

enum  mxc_spixr_width_t
 
enum  mxc_spixr_mode_t
 

Functions

int MXC_SPIXR_ReadRXFIFO (uint8_t *buf, int len)
 
int MXC_SPIXR_WriteTXFIFO (uint8_t *buf, int len)
 
void MXC_SPIXR_SetSS (void)
 
int MXC_SPIXR_GetSS (void)
 
void MXC_SPIXR_SetSSCtrl (int stayActive)
 
int MXC_SPIXR_GetSSCtrl (void)
 
void MXC_SPIXR_Enable (void)
 
void MXC_SPIXR_Disable (void)
 
int MXC_SPIXR_IsEnabled (void)
 
void MXC_SPIXR_TXFIFOEnable (void)
 
void MXC_SPIXR_TXFIFODisable (void)
 
int MXC_SPIXR_TXFIFOIsEnabled (void)
 
void MXC_SPIXR_DMATXFIFOEnable (void)
 
void MXC_SPIXR_DMATXFIFODisable (void)
 
int MXC_SPIXR_DMATXFIFOIsEnabled (void)
 
void MXC_SPIXR_RXFIFOEnable (void)
 
void MXC_SPIXR_RXFIFODisable (void)
 
int MXC_SPIXR_RXFIFOIsEnabled (void)
 
void MXC_SPIXR_DMARXFIFOEnable (void)
 
void MXC_SPIXR_DMARXFIFODisable (void)
 
int MXC_SPIXR_DMARXFIFOIsEnabled (void)
 
void MXC_SPIXR_ThreeWireModeEnable (void)
 
void MXC_SPIXR_ThreeWireModeDisable (void)
 
int MXC_SPIXR_ThreeWireModeIsEnabled (void)
 
int MXC_SPIXR_GetTXFIFOCount (void)
 
int MXC_SPIXR_GetRXFIFOCount (void)
 
void MXC_SPIXR_TXFIFOClear (void)
 
void MXC_SPIXR_RXFIFOClear (void)
 
int MXC_SPIXR_SetWidth (mxc_spixr_width_t width)
 
int MXC_SPIXR_SetSPIMode (mxc_spixr_mode_t mode)
 
int MXC_SPIXR_SetSSPolarity (int activeLow)
 
void MXC_SPIXR_SetSSTiming (unsigned int ssIActDelay, unsigned int postActive, unsigned int preActive)
 
int MXC_SPIXR_SetFrequency (int hz)
 
int MXC_SPIXR_GetFrequency (void)
 
int MXC_SPIXR_GetIntFlags (void)
 
void MXC_SPIXR_EnableInt (int flags)
 
void MXC_SPIXR_DisableInt (int flags)
 
int MXC_SPIXR_GetWakeUpFlags (void)
 
void MXC_SPIXR_EnableWakeUp (int flags)
 
void MXC_SPIXR_DisableWakeUp (int flags)
 
void MXC_SPIXR_ExMemEnable (void)
 
void MXC_SPIXR_ExMemDisable (void)
 
void MXC_SPIXR_ExMemUseDummy (int delay255)
 
void MXC_SPIXR_ExMemSetWriteCommand (uint8_t command)
 
uint8_t MXC_SPIXR_ExMemGetWriteCommand (void)
 
void MXC_SPIXR_ExMemSetReadCommand (uint8_t command)
 
uint8_t MXC_SPIXR_ExMemGetReadCommand (void)
 
int MXC_SPIXR_Busy (void)
 
int MXC_SPIXR_Init (mxc_spixr_cfg_t *cfg)
 
int MXC_SPIXR_Shutdown (void)
 
void MXC_SPIXR_SendCommand (uint8_t *cmd, uint32_t length, uint32_t tx_num_char)
 

Detailed Description


Data Structure Documentation

◆ mxc_spixr_cfg_t

struct mxc_spixr_cfg_t

Configuration parameters of SPIXR.

Data Fields

uint32_t numbits
 
mxc_spixr_width_t data_width
 
uint32_t ssel_act_1
 
uint32_t ssel_act_2
 
uint32_t ssel_inact
 
uint32_t baud_freq
 

Field Documentation

◆ baud_freq

uint32_t baud_freq

Desired baud rate duty cycle control

◆ data_width

mxc_spixr_width_t data_width

SPI Data width

◆ numbits

uint32_t numbits

Number of Bits per character. In slave mode 9-bit character length is not supported.

◆ ssel_act_1

uint32_t ssel_act_1

Slave Select Action delay 1

◆ ssel_act_2

uint32_t ssel_act_2

Slave Select Action delay 2

◆ ssel_inact

uint32_t ssel_inact

Slave Select Inactive delay

Enumeration Type Documentation

◆ mxc_spixr_mode_t

SPIXR mode.

Note
modes 1 and 2 are not supported

Function Documentation

◆ MXC_SPIXR_Busy()

int MXC_SPIXR_Busy ( void  )

SPI active status.

In Master mode, set when transaction starts, cleared when last bit of last character is acted upon and Slave Select de-assertion would occur.

Returns
0 if inactive, 1 if active

◆ MXC_SPIXR_DisableInt()

void MXC_SPIXR_DisableInt ( int  flags)

Disable SPIXR interrupts.

Parameters
flagsThe flags to disable

◆ MXC_SPIXR_DisableWakeUp()

void MXC_SPIXR_DisableWakeUp ( int  flags)

Enable Wake up for SPIXR.

Parameters
flagsThe flags to disable

◆ MXC_SPIXR_DMARXFIFOIsEnabled()

int MXC_SPIXR_DMARXFIFOIsEnabled ( void  )

Get if RX DMA is enabled.

Returns
1 = enabled, 0 = disabled

◆ MXC_SPIXR_DMATXFIFOIsEnabled()

int MXC_SPIXR_DMATXFIFOIsEnabled ( void  )

Get if TX DMA is enabled.

Returns
1 = enabled, 0 = disabled

◆ MXC_SPIXR_EnableInt()

void MXC_SPIXR_EnableInt ( int  flags)

Enable SPIXR interrupts.

Parameters
flagsThe flags to enable

◆ MXC_SPIXR_EnableWakeUp()

void MXC_SPIXR_EnableWakeUp ( int  flags)

Enable Wake up for SPIXR.

Parameters
flagsThe flags to disable

◆ MXC_SPIXR_ExMemGetReadCommand()

uint8_t MXC_SPIXR_ExMemGetReadCommand ( void  )

Get the read command used for external memory mode.

Returns
the command to be used

◆ MXC_SPIXR_ExMemGetWriteCommand()

uint8_t MXC_SPIXR_ExMemGetWriteCommand ( void  )

Get the write command used for external memory mode.

Returns
the command to be used

◆ MXC_SPIXR_ExMemSetReadCommand()

void MXC_SPIXR_ExMemSetReadCommand ( uint8_t  command)

Set the read command used for external memory mode.

Parameters
commandThe command to be used

◆ MXC_SPIXR_ExMemSetWriteCommand()

void MXC_SPIXR_ExMemSetWriteCommand ( uint8_t  command)

Set the write command used for external memory mode.

Parameters
commandThe command to be used

◆ MXC_SPIXR_ExMemUseDummy()

void MXC_SPIXR_ExMemUseDummy ( int  delay255)

Put 255 characters worth of clocks between address and read phase of external memory transactions.

Parameters
delay255add the delay

◆ MXC_SPIXR_GetFrequency()

int MXC_SPIXR_GetFrequency ( void  )

Get the SPI Frequency.

Returns
The current speed in Hz

◆ MXC_SPIXR_GetIntFlags()

int MXC_SPIXR_GetIntFlags ( void  )

Get the active interrupt flags.

Note
See mxc_spixr_regs_t for a detailed list of flags
Returns
The SPIXR interrupt flags

◆ MXC_SPIXR_GetRXFIFOCount()

int MXC_SPIXR_GetRXFIFOCount ( void  )

Get the number of bytes currently in the RX FIFO.

Returns
The number of bytes currently in the RX FIFO

◆ MXC_SPIXR_GetSS()

int MXC_SPIXR_GetSS ( void  )

Returns the SS line selected.

Returns
The index of the SS pin to use

◆ MXC_SPIXR_GetSSCtrl()

int MXC_SPIXR_GetSSCtrl ( void  )

Get the setting that controls deassertion of the SS line.

Returns
1 to keep the SS line asserted between sequential transmissions

◆ MXC_SPIXR_GetTXFIFOCount()

int MXC_SPIXR_GetTXFIFOCount ( void  )

Get the number of bytes currently in the TX FIFO.

Returns
The number of bytes currently in the TX FIFO

◆ MXC_SPIXR_GetWakeUpFlags()

int MXC_SPIXR_GetWakeUpFlags ( void  )

Get the active wake up flags.

Note
See mxc_spixr_regs_t for a detailed list of flags
Returns
The SPIXR wake up flags

◆ MXC_SPIXR_Init()

int MXC_SPIXR_Init ( mxc_spixr_cfg_t cfg)

Initialize the SPI RAM XIP Data module.

Parameters
cfginitialize SPIXR parameters
Returns
E_NO_ERROR if the SPIXR is initialized successfully, error if unsuccessful.

◆ MXC_SPIXR_IsEnabled()

int MXC_SPIXR_IsEnabled ( void  )

Get if SPIXR is enabled.

Returns
1 = enabled, 0 = disabled

◆ MXC_SPIXR_ReadRXFIFO()

int MXC_SPIXR_ReadRXFIFO ( uint8_t *  buf,
int  len 
)

Unloads bytes from the FIFO.

Parameters
bufThe buffer to read the data into
lenThe number of bytes to read
Returns
E_NULL_PTR if NULL buffer passed, E_NO_ERROR otherwise

◆ MXC_SPIXR_RXFIFOIsEnabled()

int MXC_SPIXR_RXFIFOIsEnabled ( void  )

Get if RXFIFO is enabled.

Returns
1 = enabled, 0 = disabled

◆ MXC_SPIXR_SendCommand()

void MXC_SPIXR_SendCommand ( uint8_t *  cmd,
uint32_t  length,
uint32_t  tx_num_char 
)

Send a SPI formatted instruction to external RAM.

Parameters
cmdArray of instructions to send
lengthnumber of bytes to send
tx_num_charnumber of bytes to send

◆ MXC_SPIXR_SetFrequency()

int MXC_SPIXR_SetFrequency ( int  hz)

Set the SPI Frequency.

Parameters
hzThe requested SCLK frequency
Returns
The actual speed set in Hz

◆ MXC_SPIXR_SetSPIMode()

int MXC_SPIXR_SetSPIMode ( mxc_spixr_mode_t  mode)

Set the SPI Mode used.

Parameters
modeThe mode to be used
Returns
E_NO_ERROR if successful, E_BAD_PARAM otherwise.

◆ MXC_SPIXR_SetSSCtrl()

void MXC_SPIXR_SetSSCtrl ( int  stayActive)

Control the deassertion of the SS line.

Parameters
stayActiveKeep the SS line asserted between sequential transmissions

◆ MXC_SPIXR_SetSSPolarity()

int MXC_SPIXR_SetSSPolarity ( int  activeLow)

Set the active state of the SS line.

Parameters
activeLowMake the slave select line active low
Returns
E_NO_ERROR

◆ MXC_SPIXR_SetSSTiming()

void MXC_SPIXR_SetSSTiming ( unsigned int  ssIActDelay,
unsigned int  postActive,
unsigned int  preActive 
)

Set the SS Timing Parameters.

Note
All timing is in units of system clocks
Parameters
ssIActDelayDelay between end of transaction and start of next
postActiveTime after last SCLK that SS remains active
preActiveTime after SS becomes active until first SCLK

◆ MXC_SPIXR_SetWidth()

int MXC_SPIXR_SetWidth ( mxc_spixr_width_t  width)

Set the SPI Width used.

Parameters
widthThe width to be used
Returns
E_NO_ERROR if successful, E_BAD_PARAM otherwise.

◆ MXC_SPIXR_Shutdown()

int MXC_SPIXR_Shutdown ( void  )

Shut Down the SPI RAM XIP Data Module.

Returns
E_NO_ERROR if the SPIXR is shutdown successfully, error if unsuccessful.

◆ MXC_SPIXR_ThreeWireModeIsEnabled()

int MXC_SPIXR_ThreeWireModeIsEnabled ( void  )

Get if three wire mode is enabled.

Returns
1 = enabled, 0 = disabled

◆ MXC_SPIXR_TXFIFOIsEnabled()

int MXC_SPIXR_TXFIFOIsEnabled ( void  )

Get if TXFIFO is enabled.

Returns
1 = enabled, 0 = disabled

◆ MXC_SPIXR_WriteTXFIFO()

int MXC_SPIXR_WriteTXFIFO ( uint8_t *  buf,
int  len 
)

Loads bytes into the FIFO.

Parameters
bufThe buffer containing data to write
lenThe number of bytes to write
Returns
E_NULL_PTR if NULL buffer passed, E_NO_ERROR otherwise