MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
SPI External Flash Controller (SPIXFC)

Modules

 SPIXFC_Registers
 Registers, Bit Masks and Bit Positions for the SPIXFC Peripheral Module.
 

Data Structures

struct  spixfc_cfg_t
 SPIXFC configuration type. More...
 
struct  spixfc_req_t
 SPIXFC Transaction request. More...
 

Macros

#define SPIXFC_HEADER_DIRECTION_POS   0
 Defining all the bit positions for the 16-BIT Header.
 
#define SPIXFC_HEADER_UNITS_POS   2
 
#define SPIXFC_HEADER_SIZE_POS   4
 
#define SPIXFC_HEADER_WIDTH_POS   9
 
#define SPIXFC_HEADER_DEASS_SS_POS   13
 
#define MXC_V_SPIXFC_CONFIG_PAGE_SIZE_4B   ((uint32_t)0x00000000UL)
 Page Size and their positions.
 
#define MXC_V_SPIXFC_CONFIG_PAGE_SIZE_8B   ((uint32_t)0x00000001UL)
 
#define MXC_V_SPIXFC_CONFIG_PAGE_SIZE_16B   ((uint32_t)0x00000002UL)
 
#define MXC_V_SPIXFC_CONFIG_PAGE_SIZE_32B   ((uint32_t)0x00000003UL)
 
#define MXC_S_SPIXFC_CONFIG_PAGE_4B   (MXC_V_SPIXFC_CONFIG_PAGE_SIZE_4B << MXC_F_SPIXFC_CONFIG_PAGE_SIZE_POS)
 
#define MXC_S_SPIXFC_CONFIG_PAGE_8B   (MXC_V_SPIXFC_CONFIG_PAGE_SIZE_8B << MXC_F_SPIXFC_CONFIG_PAGE_SIZE_POS)
 
#define MXC_S_SPIXFC_CONFIG_PAGE_16B   (MXC_V_SPIXFC_CONFIG_PAGE_SIZE_16B << MXC_F_SPIXFC_CONFIG_PAGE_SIZE_POS)
 
#define MXC_S_SPIXFC_CONFIG_PAGE_32B   (MXC_V_SPIXFC_CONFIG_PAGE_SIZE_32B << MXC_F_SPIXFC_CONFIG_PAGE_SIZE_POS)
 
#define SPIXFC_HEADER_DEASS_SS   1
 
#define MAX_SCLK   0x10
 
#define SPIXFC_HEADER_TX_DIR   1
 
#define NOT_HEADER_DATA   0xF000
 

Enumerations

enum  spixfc_ssel_t {
  SPIXFC_SSEL0_HIGH = (0x1 << 0),
  SPIXFC_SSEL0_LOW = 0,
  SPIXFC_SSEL1_HIGH = (0x1 << 1),
  SPIXFC_SSEL1_LOW = 0,
  SPIXFC_SSEL2_HIGH = (0x1 << 2),
  SPIXFC_SSEL2_LOW = 0,
  SPIXFC_SSEL3_HIGH = (0x1 << 3),
  SPIXFC_SSEL3_LOW = 0
}
 Active levels for slave select lines.
 
enum  spixfc_width_t {
  SPIXFC_WIDTH_1 = 0,
  SPIXFC_WIDTH_2 = 1,
  SPIXFC_WIDTH_4 = 2
}
 Number of data lines to use. More...
 
enum  spixfc_hdr_direction_t {
  SPIXFC_HEADER_DIR_NONE,
  SPIXFC_HEADER_DIR_TX,
  SPIXFC_HEADER_DIR_RX,
  SPIXFC_HEADER_DIR_BOTH
}
 
enum  spixfc_hdr_units_t {
  SPIXFC_HEADER_UNITS_BITS,
  SPIXFC_HEADER_UNITS_BYTES,
  SPIXFC_HEADER_UNITS_PAGES
}
 
enum  spixfc_hdr_width_t {
  SPIXFC_HEADER_WIDTH_SINGLE,
  SPIXFC_HEADER_WIDTH_DUAL,
  SPIXFC_HEADER_WIDTH_QUAD,
  SPIXFC_HEADER_WIDTH_INVALID
}
 

Functions

int SPIXFC_Init (mxc_spixfc_regs_t *spixfc, const spixfc_cfg_t *cfg, const sys_cfg_spixfc_t *sys_cfg)
 Initialize SPIXFC module and setup the GPIO pins. More...
 
void SPIXFC_Shutdown (mxc_spixfc_regs_t *spixfc)
 Shutdown SPIXFC module. More...
 
int SPIXFC_Clocks (mxc_spixfc_regs_t *spixfc, uint32_t len, uint8_t ssel, uint8_t deass)
 Send Clock cycles on SCK without reading or writing. More...
 
int SPIXFC_Trans (mxc_spixfc_regs_t *spixfc, spixfc_req_t *req)
 Read/write SPIXFC data. More...
 
int SPIXFC_TransAsync (mxc_spixfc_regs_t *spixfc, spixfc_req_t *req)
 Asynchronously read/write SPIXFC data. More...
 
int SPIXFC_AbortAsync (mxc_spixfc_regs_t *spixfc, spixfc_req_t *req)
 Abort asynchronous request. More...
 
void SPIXFC_Handler (mxc_spixfc_regs_t *spixfc)
 SPIXFC interrupt handler. More...
 
int SPIXFC_PrepForSleep (mxc_spixfc_regs_t *spixfc)
 Attempt to prepare the SPIXFC for sleep. More...
 

Detailed Description

Enumeration Type Documentation

◆ spixfc_width_t

Enumerator
SPIXFC_WIDTH_1 

1 Data Line.

SPIXFC_WIDTH_2 

2 Data Lines (x2).

SPIXFC_WIDTH_4 

4 Data Lines (x4).

Function Documentation

◆ SPIXFC_Init()

int SPIXFC_Init ( mxc_spixfc_regs_t spixfc,
const spixfc_cfg_t cfg,
const sys_cfg_spixfc_t *  sys_cfg 
)
Parameters
spixfcPointer to SPIXFC regs.
cfgPointer to SPIXFC configuration.
sys_cfgPointer to system configuration object
Returns
E_NO_ERROR If everything is successful.

◆ SPIXFC_Shutdown()

void SPIXFC_Shutdown ( mxc_spixfc_regs_t spixfc)
Parameters
spixfcPointer to SPIXFC regs.

◆ SPIXFC_Clocks()

int SPIXFC_Clocks ( mxc_spixfc_regs_t spixfc,
uint32_t  len,
uint8_t  ssel,
uint8_t  deass 
)
Parameters
spixfcPointer to SPIXFC regs.
lenNumber of clock cycles to send.
sselSlave select number.
deassDe-assert slave select at the end of the transaction.
Returns
Cycles transacted if everything is successful, error if unsuccessful.

◆ SPIXFC_Trans()

int SPIXFC_Trans ( mxc_spixfc_regs_t spixfc,
spixfc_req_t *  req 
)

Will block until transaction is complete.

Parameters
spixfcPointer to SPIXFC regs.
reqRequest for a SPIXFC transaction.
Note
Callback is ignored.
Returns
Bytes transacted if everything is successful, error if unsuccessful.

◆ SPIXFC_TransAsync()

int SPIXFC_TransAsync ( mxc_spixfc_regs_t spixfc,
spixfc_req_t *  req 
)
Parameters
spixfcPointer to SPIXFC regs.
reqRequest for a SPIXFC transaction.
Note
Request struct must remain allocated until callback.
Returns
E_NO_ERROR If function is successful.
Error Code Non-zero error code if unsuccessful.

◆ SPIXFC_AbortAsync()

int SPIXFC_AbortAsync ( mxc_spixfc_regs_t spixfc,
spixfc_req_t *  req 
)
Parameters
spixfcPointer to SPIXFC regs.
reqPointer to request for a SPIXFC transaction.
Returns
E_NO_ERROR Push buttons initialized successfully.
Error Code Non-zero error code if unsuccessful.
E_NO_ERROR if request aborted, error if unsuccessful.

◆ SPIXFC_Handler()

void SPIXFC_Handler ( mxc_spixfc_regs_t spixfc)

This function should be called by the application from the interrupt handler if SPIXFC interrupts are enabled. Alternately, this function can be periodically called by the application if SPIXFC interrupts are disabled.

Parameters
spixfcBase address of the SPIXFC module.

◆ SPIXFC_PrepForSleep()

int SPIXFC_PrepForSleep ( mxc_spixfc_regs_t spixfc)
Parameters
spixfcPointer to SPIXFC regs.
Returns
E_NO_ERROR if ready to sleep, E_BUSY if not ready for sleep.