46 #include "mxc_config.h" 48 #include "spixfc_regs.h" 66 SPIXFC_SSEL0_HIGH = (0x1 << 0),
68 SPIXFC_SSEL1_HIGH = (0x1 << 1),
70 SPIXFC_SSEL2_HIGH = (0x1 << 2),
72 SPIXFC_SSEL3_HIGH = (0x1 << 3),
121 #define SPIXFC_HEADER_DIRECTION_POS 0 122 #define SPIXFC_HEADER_UNITS_POS 2 123 #define SPIXFC_HEADER_SIZE_POS 4 124 #define SPIXFC_HEADER_WIDTH_POS 9 125 #define SPIXFC_HEADER_DEASS_SS_POS 13 132 #define MXC_V_SPIXFC_CONFIG_PAGE_SIZE_4B ((uint32_t)0x00000000UL) 133 #define MXC_V_SPIXFC_CONFIG_PAGE_SIZE_8B ((uint32_t)0x00000001UL) 134 #define MXC_V_SPIXFC_CONFIG_PAGE_SIZE_16B ((uint32_t)0x00000002UL) 135 #define MXC_V_SPIXFC_CONFIG_PAGE_SIZE_32B ((uint32_t)0x00000003UL) 137 #define MXC_S_SPIXFC_CONFIG_PAGE_4B (MXC_V_SPIXFC_CONFIG_PAGE_SIZE_4B << MXC_F_SPIXFC_CONFIG_PAGE_SIZE_POS) 138 #define MXC_S_SPIXFC_CONFIG_PAGE_8B (MXC_V_SPIXFC_CONFIG_PAGE_SIZE_8B << MXC_F_SPIXFC_CONFIG_PAGE_SIZE_POS) 139 #define MXC_S_SPIXFC_CONFIG_PAGE_16B (MXC_V_SPIXFC_CONFIG_PAGE_SIZE_16B << MXC_F_SPIXFC_CONFIG_PAGE_SIZE_POS) 140 #define MXC_S_SPIXFC_CONFIG_PAGE_32B (MXC_V_SPIXFC_CONFIG_PAGE_SIZE_32B << MXC_F_SPIXFC_CONFIG_PAGE_SIZE_POS) 145 SPIXFC_HEADER_DIR_NONE,
146 SPIXFC_HEADER_DIR_TX,
147 SPIXFC_HEADER_DIR_RX,
148 SPIXFC_HEADER_DIR_BOTH,
149 } spixfc_hdr_direction_t;
152 SPIXFC_HEADER_UNITS_BITS,
153 SPIXFC_HEADER_UNITS_BYTES,
154 SPIXFC_HEADER_UNITS_PAGES,
155 } spixfc_hdr_units_t;
158 SPIXFC_HEADER_WIDTH_SINGLE,
159 SPIXFC_HEADER_WIDTH_DUAL,
160 SPIXFC_HEADER_WIDTH_QUAD,
161 SPIXFC_HEADER_WIDTH_INVALID,
162 } spixfc_hdr_width_t;
164 #define SPIXFC_HEADER_DEASS_SS 1 165 #define MAX_SCLK 0x10 166 #define SPIXFC_HEADER_TX_DIR 1 167 #define NOT_HEADER_DATA 0xF000 // 0xF makes sure it is not a header spixfc_width_t width
Number of data lines to use.
Definition: spixfc.h:106
uint8_t mode
SPIXFC mode to use, 0-3.
Definition: spixfc.h:90
void(* callback)(spixfc_req_t *, int)
Callback for asynchronous request.
Definition: spixfc.h:115
uint32_t ssel_pol
Mask of active levels for slave select signals, use spixfc_ssel_t.
Definition: spixfc.h:91
uint8_t deass
De-assert slave select at the end of the transaction.
Definition: spixfc.h:102
int SPIXFC_TransAsync(mxc_spixfc_regs_t *spixfc, spixfc_req_t *req)
Asynchronously read/write SPIXFC data.
int SPIXFC_PrepForSleep(mxc_spixfc_regs_t *spixfc)
Attempt to prepare the SPIXFC for sleep.
SPIXFC configuration type.
Definition: spixfc.h:89
unsigned len
Number of bytes to send.
Definition: spixfc.h:107
uint8_t wait_tx
Wait for the TX FIFO to be empty before returning.
Definition: spixfc.h:103
uint8_t ssel
Slave select number.
Definition: spixfc.h:101
uint32_t baud
Baud rate in Hz.
Definition: spixfc.h:92
1 Data Line.
Definition: spixfc.h:81
spixfc_width_t
Number of data lines to use.
Definition: spixfc.h:80
unsigned read_num
Number of bytes read.
Definition: spixfc.h:108
spixfc_ssel_t
Active levels for slave select lines.
Definition: spixfc.h:65
void SPIXFC_Shutdown(mxc_spixfc_regs_t *spixfc)
Shutdown SPIXFC module.
void SPIXFC_Handler(mxc_spixfc_regs_t *spixfc)
SPIXFC interrupt handler.
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.
unsigned write_num
Number of bytes written.
Definition: spixfc.h:109
int SPIXFC_Trans(mxc_spixfc_regs_t *spixfc, spixfc_req_t *req)
Read/write SPIXFC data.
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.
2 Data Lines (x2).
Definition: spixfc.h:82
int SPIXFC_AbortAsync(mxc_spixfc_regs_t *spixfc, spixfc_req_t *req)
Abort asynchronous request.
SPIXFC Transaction request.
Definition: spixfc.h:100
4 Data Lines (x4).
Definition: spixfc.h:83
uint8_t * rx_data
RX buffer.
Definition: spixfc.h:105
Structure type to access the SPIXFC Registers.
Definition: spixfc_regs.h:88
const uint8_t * tx_data
TX buffer.
Definition: spixfc.h:104