SPI#
Functions#
Reads response for every command and data from the module.
Process a command to the wlan module.
Perform a pre-frame decriptor read.
Perform frame decriptor and payload read.
Write a Frame descriptor.
Perform Frame Data Write.
Send the C1 & C2 commands bytes, should check response for C1 command, if busy, should retry.
The C3 & C4 command bytes to send.
Loop reading the SPI until a start token, 0x55, is received.
Set the INTERRUPT MASK REGISTER of the module.
Set the INTERRUPT TYPE of the module based on selected LOAD_IMAGE.
Clear the interrupt register.
Return the module SPI interrupt register status.
Return the length of the incoming packet.
Configure the module SPI interface to high speed mode.
Initialize the wlan module�s Slave SPI interface.
Initialize the with modules Slave SPI interface on ulp wakeup.
Perform a memory write to the module.
Perform a 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)
Reads response for every command and data from the module.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t * | [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.
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
rsi_frame_desc_t * | [in] | uFrameDscFrame | - Frame descriptor |
uint8_t * | [in] | payloadparam | - Pointer to the command payload parameter structure |
uint16_t | [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..
rsi_pre_dsc_rd#
int16_t rsi_pre_dsc_rd (uint8_t * dbuf)
Perform a pre-frame decriptor read.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t * | [in] | dbuf | - Pointer to the buffer into which pre-decriptor has to be read |
Returns
0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t * | [in] | buf | - Pointer to the buffer into which decriptor and payload has to be read |
uint16_t | [in] | dummy_len | - Number of dummy bytes which can be discarded |
uint16_t | [in] | total_len | - Number of bytes to be read |
Returns
0 - SUCCESS -1 - SPI busy / Timeout \nrsi_spi_frame_data_wr -2 - SPI Failure
rsi_spi_frame_dsc_wr#
int16_t rsi_spi_frame_dsc_wr (rsi_frame_desc_t * uFrameDscFrame)
Write a Frame descriptor.
Type | Direction | Argument Name | Description |
---|---|---|---|
rsi_frame_desc_t * | [in] | uFrameDscFrame | - Frame descriptor |
Returns
0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | [in] | bufLen | - Length of the data buffer to write |
uint8_t * | [in] | dBuf | - Pointer to the buffer of data to write |
uint16_t | [in] | tbufLen | - Length of the data fragment to write |
uint8_t * | [in] | tBuf | - Pointer to the buffer of data fragment to write |
Returns
0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | c1 | - SPI c1 command |
uint8_t | [in] | c2 | - SPI c2 command |
Returns
0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure
rsi_send_c3c4#
int16_t rsi_send_c3c4 (uint8_t c3, uint8_t c4)
The C3 & C4 command bytes to send.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | c3 | - SPI c3 command bytes to be sent |
uint8_t | [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
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | timeout | - Timeout for start token. |
uint8_t | [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
rsi_set_intr_mask#
int16_t rsi_set_intr_mask (uint8_t interruptMask)
Set the INTERRUPT MASK REGISTER of the module.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | interruptMask | - The value to set the mask register to |
Returns
0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | interruptMaskVal | - The value to set the mask register |
Returns
0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure
rsi_clear_interrupt#
int16_t rsi_clear_interrupt (uint8_t interruptClear)
Clear the interrupt register.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | interruptClear | - The value to set the interrupt clear register to |
Returns
0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure
rsi_device_interrupt_status#
int16_t rsi_device_interrupt_status (uint8_t * int_status)
Return the module SPI interrupt register status.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t * | [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
rsi_spi_pkt_len#
int16_t rsi_spi_pkt_len (uint16_t * length)
Return the length of the incoming packet.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t * | [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
rsi_spi_high_speed_enable#
int16_t rsi_spi_high_speed_enable (void )
Configure the module SPI interface to high speed mode.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | [in] |
Returns
0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure
rsi_spi_iface_init#
int16_t rsi_spi_iface_init (void )
Initialize the wlan module�s Slave SPI interface.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | [in] |
Returns
0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure
rsi_ulp_wakeup_init#
void rsi_ulp_wakeup_init (void )
Initialize the with modules Slave SPI interface on ulp wakeup.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | [in] |
Returns
void
rsi_mem_wr#
int16_t rsi_mem_wr (uint32_t addr, uint16_t len, uint8_t * dBuf)
Perform a memory write to the module.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | addr | - Address to write to |
uint16_t | [in] | len | - Number of bytes to write |
uint8_t * | [in] | dBuf | - Pointer to the buffer of data to write |
Returns
0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure
rsi_mem_rd#
int16_t rsi_mem_rd (uint32_t addr, uint16_t len, uint8_t * dBuf)
Perform a memory read from the module.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | addr | - Address to read from |
uint16_t | [in] | len | - Number of bytes to read |
uint8_t * | [in] | dBuf | - Pointer to the buffer to receive the data into |
Returns
0 - SUCCESS -1 - SPI busy / Timeout -2 - SPI Failure
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | regAddr | - Address of spi register to read, addr is 6-bits, upper 2 bits must be cleared |
uint8_t * | [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
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | regAddr | - Address of spi register to read, addr is 6-bits, upper 2 bits must be cleared |
uint16_t * | [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
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | regAddr | - Address of spi register to be written |
uint8_t * | [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