SPI#
Functions#
Read response for every command and data sent from the module.
Process a command to the module.
Read a pre-frame descriptor.
Read frame descriptor and payload.
Write the frame descriptor.
Write frame data.
Send the C1 and C2 commands. Check response for C1 command, if busy, should retry.
Send the C3 and C4 commands.
Loop read the SPI until a start token (i.e., 0x55) is received.
Set the interrupt mask register of the module.
Set the interrupt type of the module.
Clear the interrupt register.
Read the SPI interrupt register status.
Read the length of the incoming packet to the module.
Configure the module SPI interface to high speed mode.
Initialize the SPI secondary device interface of the module.
Initialize the SPI secondary device interface of the module on ULP wakeup.
Memory write to the module.
Memory read from the module.
Read from a register in the module from the address specified.
Read from a register in the wlan module from the address specified.
Write to a register in the module with an address specified.
Function Documentation#
rsi_frame_read#
int16_t rsi_frame_read (uint8_t * pkt_buffer)
Read response for every command and data sent from the module.
[in] | pkt_buffer | - pointer to buffer to which packet has to be read |
This API reads the frame from the host interface.
Returns
0 - Success
Non-Zero Failure - Failure
Note
Enable DEBUG_PACKET_EXCHANGE macro for SPI level packet exchange debug prints and MAX_PRINT_PAYLOAD_LEN for configuring number of bytes of payload to print, by default it will print 8 bytes of payload.
66
of file driver/device_interface/spi/rsi_spi_frame_rd_wr.c
rsi_frame_write#
int16_t rsi_frame_write (rsi_frame_desc_t * uFrameDscFrame, uint8_t * payloadparam, uint16_t size_param)
Process a command to the module.
[in] | uFrameDscFrame | - Frame descriptor |
[in] | payloadparam | - Pointer to the command payload parameter structure |
[in] | size_param | - Size of the payload for the command |
This API writes the frame to the host interface.
Returns
0 - Success
Non-Zero value - Failure
Note
Enable DEBUG_PACKET_EXCHANGE macro for SPI level packet exchange debug prints and MAX_PRINT_PAYLOAD_LEN for configuring number of bytes of payload to print, by default it will print 8 bytes of payload.
116
of file driver/device_interface/spi/rsi_spi_frame_rd_wr.c
rsi_pre_dsc_rd#
int16_t rsi_pre_dsc_rd (uint8_t * dbuf)
Read a pre-frame descriptor.
[in] | dbuf | - Pointer to the buffer into which pre-decriptor has to be read |
Returns
0 - Success
Non-Zero value - Failure
161
of file driver/device_interface/spi/rsi_spi_frame_rd_wr.c
rsi_pkt_rd#
int16_t rsi_pkt_rd (uint8_t * buf, uint16_t dummy_len, uint16_t total_len)
Read frame descriptor and payload.
[in] | buf | - Pointer to the buffer into which decriptor and payload has to be read |
[in] | dummy_len | - Number of dummy bytes which can be discarded |
[in] | total_len | - Number of bytes to be read |
Returns
0 - Success
Non-Zero value - Failure
220
of file driver/device_interface/spi/rsi_spi_frame_rd_wr.c
rsi_spi_frame_dsc_wr#
int16_t rsi_spi_frame_dsc_wr (rsi_frame_desc_t * uFrameDscFrame)
Write the frame descriptor.
[in] | uFrameDscFrame | - Frame descriptor |
Returns
0 - Success
Non-Zero value - Failure
294
of file driver/device_interface/spi/rsi_spi_frame_rd_wr.c
rsi_spi_frame_data_wr#
int16_t rsi_spi_frame_data_wr (uint16_t bufLen, uint8_t * dBuf, uint16_t tbufLen, uint8_t * tBuf)
Write frame data.
[in] | bufLen | - Length of the data buffer to write |
[in] | dBuf | - Pointer to the buffer of data to write |
[in] | tbufLen | - Length of the data fragment to write |
[in] | tBuf | - Pointer to the buffer of data fragment to write |
Returns
0 - Success
Non-Zero value - Failure
349
of file driver/device_interface/spi/rsi_spi_frame_rd_wr.c
rsi_send_c1c2#
int16_t rsi_send_c1c2 (uint8_t c1, uint8_t c2)
Send the C1 and C2 commands. Check response for C1 command, if busy, should retry.
[in] | c1 | - SPI c1 command |
[in] | c2 | - SPI c2 command |
Returns
0 - Success
Non-Zero value - Failure
53
of file driver/device_interface/spi/rsi_spi_functs.c
rsi_send_c3c4#
int16_t rsi_send_c3c4 (uint8_t c3, uint8_t c4)
Send the C3 and C4 commands.
[in] | c3 | - SPI c3 command bytes to be sent |
[in] | c4 | - SPI c4 command bytes to be sent |
Returns
0 - Success
Non-Zero value - Failure
Note
A succesful rsi_send_c1c2() is required before this function.
100
of file driver/device_interface/spi/rsi_spi_functs.c
rsi_spi_wait_start_token#
int16_t rsi_spi_wait_start_token (uint32_t timeout, uint8_t mode)
Loop read the SPI until a start token (i.e., 0x55) is received.
[in] | timeout | - Timeout for start token. |
[in] | mode | - To indicate 8-bit/32-bit mode. |
Returns
0 - Success
Non-Zero value - Failure
Note
Should issue read commands before using this function
127
of file driver/device_interface/spi/rsi_spi_functs.c
rsi_set_intr_mask#
int16_t rsi_set_intr_mask (uint8_t interruptMask)
Set the interrupt mask register of the module.
[in] | interruptMask | - The value to set the mask register to |
Returns
0 - Success
Non-Zero value - Failure
175
of file driver/device_interface/spi/rsi_spi_functs.c
rsi_set_intr_type#
int16_t rsi_set_intr_type (uint32_t interruptMaskVal)
Set the interrupt type of the module.
[in] | interruptMaskVal | - The value to set the mask register |
Returns
0 - Success
Non-Zero value - Failure
210
of file driver/device_interface/spi/rsi_spi_functs.c
rsi_clear_interrupt#
int16_t rsi_clear_interrupt (uint8_t interruptClear)
Clear the interrupt register.
[in] | interruptClear | - The value to set the interrupt clear register to |
Returns
0 - Success
Non-Zero value - Failure
242
of file driver/device_interface/spi/rsi_spi_functs.c
rsi_device_interrupt_status#
int16_t rsi_device_interrupt_status (uint8_t * int_status)
Read the SPI interrupt register status.
[in] | int_status | - Pointer to the buffer of data to be read, assumed to be at least a byte |
This API reads the status register of the host interface layer to validate the interrupt received.
Returns
0 - Success
Non-Zero value - Failure
273
of file driver/device_interface/spi/rsi_spi_functs.c
rsi_spi_pkt_len#
int16_t rsi_spi_pkt_len (uint16_t * length)
Read the length of the incoming packet to the module.
[in] | length | - Pointer to the buffer of data to write, assumed to be at least 2 bytes long |
Returns
0 - Success
Non-Zero value - Failure
306
of file driver/device_interface/spi/rsi_spi_functs.c
rsi_spi_high_speed_enable#
int16_t rsi_spi_high_speed_enable (void )
Configure the module SPI interface to high speed mode.
[in] |
Returns
0 - Success
Non-Zero value - Failure
Note
This API should be called only if the SPI clock frequency is more than 25 MHz and shouldn't be called otherwise.
SPI initialization has to be done in low-speed mode. After device SPI is configured to high-speed mode using this API,
rsi_switch_to_high_clk_freq() will be executed to configure the host SPI to a frequency that is more than 25 MHz.
The latter API has to be ported by the user to implement the host clock switch.
344
of file driver/device_interface/spi/rsi_spi_functs.c
rsi_spi_iface_init#
int16_t rsi_spi_iface_init (void )
Initialize the SPI secondary device interface of the module.
[in] |
Returns
0 - Success
Non-Zero value - Failure
53
of file driver/device_interface/spi/rsi_spi_iface_init.c
rsi_ulp_wakeup_init#
int16_t rsi_ulp_wakeup_init (void )
Initialize the SPI secondary device interface of the module on ULP wakeup.
[in] |
Returns
0 - Success
Non-Zero value - Failure
98
of file driver/device_interface/spi/rsi_spi_iface_init.c
rsi_mem_wr#
int16_t rsi_mem_wr (uint32_t addr, uint16_t len, uint8_t * dBuf)
Memory write to the module.
[in] | addr | - Address to write to |
[in] | len | - Number of bytes to write |
[in] | dBuf | - Pointer to the buffer of data to write |
This API writes contents of dBuf buffer to the device memory address addr for the length len.
Returns
0 - Success
Non-Zero value - Failure
55
of file driver/device_interface/spi/rsi_spi_mem_rd_wr.c
rsi_mem_rd#
int16_t rsi_mem_rd (uint32_t addr, uint16_t len, uint8_t * dBuf)
Memory read from the module.
[in] | addr | - Address to read from |
[in] | len | - Number of bytes to read |
[in] | dBuf | - Pointer to the buffer to receive the data into |
This API reads the device memory contents present at the address addr into the dBuf buffer for the length len.
Returns
0 - Success
Non-Zero value - Failure
124
of file driver/device_interface/spi/rsi_spi_mem_rd_wr.c
rsi_reg_rd#
int16_t rsi_reg_rd (uint8_t regAddr, uint8_t * dBuf)
Read from a register in the module from the address specified.
[in] | regAddr | - Address of SPI register to read, address is 6-bits, upper 2 bits must be cleared |
[in] | dBuf | - Pointer to the buffer of data to write, assumed to be at least 2 bytes long |
This API reads the content of the host interface register regAddr to the buffer dBuf.
Returns
0 - Success
Non-Zero value - Failure
52
of file driver/device_interface/spi/rsi_spi_reg_rd_wr.c
rsi_reg_rd2#
int16_t rsi_reg_rd2 (uint8_t regAddr, uint16_t * dBuf)
Read from a register in the wlan module from the address specified.
[in] | regAddr | - Address of SPI register to read, address is 6-bits, upper 2 bits must be cleared |
[in] | dBuf | - Pointer to the buffer of data to write, assumed to be at least 2 bytes long |
Returns
0 - Success
Non-Zero value - Failure
94
of file driver/device_interface/spi/rsi_spi_reg_rd_wr.c
rsi_reg_wr#
int16_t rsi_reg_wr (uint8_t regAddr, uint8_t * dBuf)
Write to a register in the module with an address specified.
[in] | regAddr | - Address of SPI register to be written |
[in] | dBuf | - Pointer to the buffer of data to write, assumed to be at least 2 bytes long |
This API writes the content provided by dBuf to the host interface register regAddr.
Returns
0 - Success
Non-Zero value - Failure
139
of file driver/device_interface/spi/rsi_spi_reg_rd_wr.c