SPI#

Functions#

int16_t
rsi_frame_read(uint8_t *pkt_buffer)

Reads response for every command and data 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 wlan module.

int16_t
rsi_pre_dsc_rd(uint8_t *dbuf)

Perform a pre-frame decriptor read.

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

Perform frame decriptor and payload read.

int16_t
rsi_spi_frame_dsc_wr(rsi_frame_desc_t *uFrameDscFrame)

Write a Frame descriptor.

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

Perform Frame Data Write.

int16_t
rsi_send_c1c2(uint8_t c1, uint8_t c2)

Send the C1 & C2 commands bytes, should check response for C1 command, if busy, should retry.

int16_t
rsi_send_c3c4(uint8_t c3, uint8_t c4)

The C3 & C4 command bytes to send.

int16_t
rsi_spi_wait_start_token(uint32_t timeout, uint8_t mode)

Loop reading the SPI until a start token, 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 based on selected LOAD_IMAGE.

int16_t
rsi_clear_interrupt(uint8_t interruptClear)

Clear the interrupt register.

int16_t
rsi_device_interrupt_status(uint8_t *int_status)

Return the module SPI interrupt register status.

int16_t
rsi_spi_pkt_len(uint16_t *length)

Return the length of the incoming packet.

int16_t

Configure the module SPI interface to high speed mode.

int16_t

Initialize the wlan module�s Slave SPI interface.

void

Initialize the with modules Slave SPI interface on ulp wakeup.

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

Perform a memory write to the module.

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

Perform a 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)

Reads response for every command and data from the module.

Parameters
[in]pkt_buffer

- pointer to buffer to which packet has to read

Returns

  • 0 - SUCCESS < 0 - FAILURE -1 - SPI busy / Timeout in case of SPI -2 - SPI Failure in case of SPI

Note

  • Enable DEBUG_PACKET_EXCHANGE macro for spi level packet exchange debug prints and MAX_PRINT_PAYLOAD_LEN for configuring no.bytes of payload to print, by default it will print 8 bytes of payload.


Definition at line 67 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 wlan 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

Returns

  • 0 - SUCCESS < 0 - FAILURE -1 - SPI busy / Timeout in case of SPI -2 - SPI Failure in case of SPI

Note

  • Enable DEBUG_PACKET_EXCHANGE macro for spi level packet exchange debug prints and MAX_PRINT_PAYLOAD_LEN for configuring no.bytes of payload to print, by default it will print 8 bytes of payload..


Definition at line 118 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)

Perform a pre-frame decriptor read.

Parameters
[in]dbuf

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

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 164 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)

Perform frame decriptor and payload read.

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 -1 - SPI busy / Timeout \nrsi_spi_frame_data_wr -2 - SPI Failure


Definition at line 225 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 a Frame descriptor.

Parameters
[in]uFrameDscFrame

- Frame descriptor

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 300 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)

Perform Frame Data Write.

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 -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 356 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 & C2 commands bytes, should check response for C1 command, if busy, should retry.

Parameters
[in]c1

- SPI c1 command

[in]c2

- SPI c2 command

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


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

rsi_send_c3c4#

int16_t rsi_send_c3c4 (uint8_t c3, uint8_t c4)

The C3 & C4 command bytes to send.

Parameters
[in]c3

- SPI c3 command bytes to be sent

[in]c4

- SPI c4 command bytes to be sent

  • A succesful rsi_send_c1c2 is required before this function.

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 102 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 reading the SPI until a start token, 0x55, is received.

Parameters
[in]timeout

- Timeout for start token.

[in]mode

- To indicate 8-bit/32-bit mode.

  • Should issue read commands before using this function

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 130 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 -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 179 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 based on selected LOAD_IMAGE.

Parameters
[in]interruptMaskVal

- The value to set the mask register

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 215 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 -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 248 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)

Return the module SPI interrupt register status.

Parameters
[in]int_status

- Pointer to the buffer of data to be read, assumed to be at least a byte

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


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

rsi_spi_pkt_len#

int16_t rsi_spi_pkt_len (uint16_t * length)

Return the length of the incoming packet.

Parameters
[in]length

- Pointer to the buffer of data to write, assumed to be at least 2 bytes long

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 314 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 -1 - SPI busy / Timeout -2 - SPI 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 353 of file driver/device_interface/spi/rsi_spi_functs.c

rsi_spi_iface_init#

int16_t rsi_spi_iface_init (void )

Initialize the wlan module�s Slave SPI interface.

Parameters
[in]

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


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

References SL_PRINTF , and RSI_SUCCESS

rsi_ulp_wakeup_init#

void rsi_ulp_wakeup_init (void )

Initialize the with modules Slave SPI interface on ulp wakeup.

Parameters
[in]

Returns

  • void


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)

Perform a 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

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 56 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)

Perform a 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

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 126 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, addr 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 -1 - SPI busy / Timeout -2 - SPI Failure


Definition at line 53 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, addr 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 -1 - SPI busy / Timeout -2 - SPI Failure


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

Returns

  • 0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure


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

References rsi_send_c1c2 , and RSI_SUCCESS