SPI#

Functions#

int16_t
rsi_frame_read(uint8_t *pkt_buffer)

Read response for every command and data sent from the module.

int16_t
rsi_frame_write(rsi_frame_desc_t *uFrameDscFrame, uint8_t *payloadparam, uint16_t size_param)

Process a command to the module.

int16_t
rsi_pre_dsc_rd(uint8_t *dbuf)

Read a pre-frame descriptor.

int16_t
rsi_pkt_rd(uint8_t *buf, uint16_t dummy_len, uint16_t total_len)

Read frame descriptor and payload.

int16_t
rsi_spi_frame_dsc_wr(rsi_frame_desc_t *uFrameDscFrame)

Write the frame descriptor.

int16_t
rsi_spi_frame_data_wr(uint16_t bufLen, uint8_t *dBuf, uint16_t tbufLen, uint8_t *tBuf)

Write frame data.

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.

int16_t
rsi_send_c3c4(uint8_t c3, uint8_t c4)

Send the C3 and C4 commands.

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.

int16_t
rsi_set_intr_mask(uint8_t interruptMask)

Set the interrupt mask register of the module.

int16_t
rsi_set_intr_type(uint32_t interruptMaskVal)

Set the interrupt type of the module.

int16_t
rsi_clear_interrupt(uint8_t interruptClear)

Clear the interrupt register.

int16_t
rsi_device_interrupt_status(uint8_t *int_status)

Read the SPI interrupt register status.

int16_t
rsi_spi_pkt_len(uint16_t *length)

Read the length of the incoming packet to the module.

int16_t

Configure the module SPI interface to high speed mode.

int16_t

Initialize the SPI secondary device interface of the module.

int16_t

Initialize the SPI secondary device interface of the module on ULP wakeup.

int16_t
rsi_mem_wr(uint32_t addr, uint16_t len, uint8_t *dBuf)

Memory write to the module.

int16_t
rsi_mem_rd(uint32_t addr, uint16_t len, uint8_t *dBuf)

Memory read from the module.

int16_t
rsi_reg_rd(uint8_t regAddr, uint8_t *dBuf)

Read from a register in the module from the address specified.

int16_t
rsi_reg_rd2(uint8_t regAddr, uint16_t *dBuf)

Read from a register in the wlan module from the address specified.

int16_t
rsi_reg_wr(uint8_t regAddr, uint8_t *dBuf)

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.

Parameters
[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.


Definition at line 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.

Parameters
[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.


Definition at line 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.

Parameters
[in]dbuf

- Pointer to the buffer into which pre-decriptor has to be read

Returns

  • 0 - Success

  • Non-Zero value - Failure


Definition at line 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.

Parameters
[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


Definition at line 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.

Parameters
[in]uFrameDscFrame

- Frame descriptor

Returns

  • 0 - Success

  • Non-Zero value - Failure


Definition at line 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.

Parameters
[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


Definition at line 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.

Parameters
[in]c1

- SPI c1 command

[in]c2

- SPI c2 command

Returns

  • 0 - Success

  • Non-Zero value - Failure


Definition at line 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.

Parameters
[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


Definition at line 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.

Parameters
[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


Definition at line 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.

Parameters
[in]interruptMask

- The value to set the mask register to

Returns

  • 0 - Success

  • Non-Zero value - Failure


Definition at line 175 of file driver/device_interface/spi/rsi_spi_functs.c

References rsi_mem_wr , and RSI_SUCCESS

rsi_set_intr_type#

int16_t rsi_set_intr_type (uint32_t interruptMaskVal)

Set the interrupt type of the module.

Parameters
[in]interruptMaskVal

- The value to set the mask register

Returns

  • 0 - Success

  • Non-Zero value - Failure


Definition at line 210 of file driver/device_interface/spi/rsi_spi_functs.c

References rsi_mem_rd , rsi_mem_wr , and RSI_SUCCESS

rsi_clear_interrupt#

int16_t rsi_clear_interrupt (uint8_t interruptClear)

Clear the interrupt register.

Parameters
[in]interruptClear

- The value to set the interrupt clear register to

Returns

  • 0 - Success

  • Non-Zero value - Failure


Definition at line 242 of file driver/device_interface/spi/rsi_spi_functs.c

References rsi_mem_wr , and RSI_SUCCESS

rsi_device_interrupt_status#

int16_t rsi_device_interrupt_status (uint8_t * int_status)

Read the SPI interrupt register status.

Parameters
[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


Definition at line 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.

Parameters
[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


Definition at line 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.

Parameters
[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.


Definition at line 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.

Parameters
[in]

Returns

  • 0 - Success

  • Non-Zero value - Failure


Definition at line 53 of file driver/device_interface/spi/rsi_spi_iface_init.c

References SL_PRINTF , and RSI_SUCCESS

rsi_ulp_wakeup_init#

int16_t rsi_ulp_wakeup_init (void )

Initialize the SPI secondary device interface of the module on ULP wakeup.

Parameters
[in]

Returns

  • 0 - Success

  • Non-Zero value - Failure


Definition at line 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.

Parameters
[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


Definition at line 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.

Parameters
[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


Definition at line 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.

Parameters
[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


Definition at line 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.

Parameters
[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


Definition at line 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.

Parameters
[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


Definition at line 139 of file driver/device_interface/spi/rsi_spi_reg_rd_wr.c

References rsi_send_c1c2 , and RSI_SUCCESS