Generic SPI#


Introduction#

The Generic SPI Master is available in MCU HP peripherals. It provides an I/O interface for a large range of SPI-compatible peripheral devices. SPI is a synchronous four-wire interface made up of two data pins (MOSI and MISO), a device select pin (CSN), and a gated clock pin (SCLK). With two data pins, it supports full-duplex operation with other SPI-compatible devices.

  • Typical SPI-compatible peripheral devices that can be used to interface include: LCD displays, A/D converters, D/A converters, Codecs, Micro-controllers and Flashes.

  • GSPI (General Serial Peripheral Interface) can be used in various applications within embedded systems where high-speed, synchronous serial communication is required. Here are some common areas where GSPI can be employed in embedded systems:

  1. Test and Measurement Equipment

  2. Sensor Interfacing

  3. Display Interfaces

  4. Memory Devices

  5. Communication Interfaces

  6. Motor Control

  7. Audio Processing

  8. Wireless Communication


Configuration#

Configuring GSPI (General Serial Peripheral Interface) in a micro-controller involves several steps, including setting up the peripheral registers, configuring GPIO pins, and selecting the appropriate operating mode and settings.

  • For more information on configuring available parameters refer to the respective peripheral example readme document.


Usage#

The common GSPI functions can be used after the GSPI Structures are specified, passing an instance of sl_gspi_control_config_t. These functions will initiate and configure the GSPI below, which is the flow for implementation.

  1. sl_si91x_gspi_configure_clock

  2. sl_si91x_gspi_init

  3. sl_si91x_gspi_set_configuration

  4. sl_si91x_gspi_register_event_callback

  5. sl_si91x_gspi_send_data

  6. sl_si91x_gspi_deinit

Modules#

sl_gspi_control_config_t

sl_gspi_clock_config_t

sl_gspi_version_t

Enumerations#

enum
SL_GSPI_TRANSFER_COMPLETE = ARM_SPI_EVENT_TRANSFER_COMPLETE
SL_GSPI_DATA_LOST = ARM_SPI_EVENT_DATA_LOST
SL_GSPI_MODE_FAULT = ARM_SPI_EVENT_MODE_FAULT
}

Enumeration for different GSPI callback events.

enum
SL_GSPI_POWER_OFF = ARM_POWER_OFF
SL_GSPI_LOW_POWER = ARM_POWER_LOW
SL_GSPI_FULL_POWER = ARM_POWER_FULL
SL_GSPI_POWER_MODE_LAST
}

Enumeration for GSPI power state.

enum
SL_GSPI_MODE_0 = ARM_SPI_CPOL0_CPHA0
SL_GSPI_MODE_3 = ARM_SPI_CPOL1_CPHA1
}

Enumeration for GSPI clock modes.

enum
SL_GSPI_MASTER_INACTIVE = ARM_SPI_MODE_INACTIVE
SL_GSPI_MASTER_ACTIVE = ARM_SPI_MODE_MASTER
SL_GSPI_MASTER_MODE_LAST
}

Enumeration for GSPI master modes.

enum
SL_GSPI_MASTER_UNUSED = ARM_SPI_SS_MASTER_UNUSED
SL_GSPI_MASTER_SW = ARM_SPI_SS_MASTER_SW
SL_GSPI_MASTER_HW_OUTPUT = ARM_SPI_SS_MASTER_HW_OUTPUT
SL_GSPI_SLAVE_SELECT_MODE_LAST
}

Enumeration for GSPI secondary select mode.

enum
SL_GSPI_MASTER
SL_GSPI_INSTANCE_LAST_ENUM
}

Enumeration for GSPI Master instance, enum for one member, future provision is provided.

enum
GSPI_SLAVE_0
GSPI_SLAVE_1
GSPI_SLAVE_2
GSPI_SLAVE_LAST_ENUM
}

Enumeration for GSPI secondary numbers.

Typedefs#

typedef ARM_SPI_SignalEvent_t

Renamed signal event structure.

typedef ARM_SPI_STATUS

Renamed status structure.

typedef ARM_DRIVER_SPI

Renamed GSPI driver structure.

typedef const void *

Created GSPI handle type.

Variables#

boolean_t

true to enable and false to disable swap read

boolean_t

true to enable and false to disable swap write

uint8_t

Bit width either 8 bit or 16 bit.

uint32_t

Mode 0 or Mode 3 of GSPI.

uint32_t

Secondary select mode either software of hardware output.

uint32_t

Bitrate for setting the clock division factor.

uint8_t

SoC PLL count value.

uint16_t

Int PLL control value.

uint32_t

Intf PLL clock frequency.

uint32_t

Intf PLL reference clock frequency.

uint32_t

SoC PLL clock frequency.

uint32_t

SoC PLL reference clock frequency.

uint16_t

Clock Division Factor.

uint8_t

Release version number.

uint8_t

sqa version number

uint8_t

dev version number

Functions#

sl_status_t
sl_si91x_gspi_configure_clock(sl_gspi_clock_config_t *clock_configuration)

This API will configure the clock for GSPI module.

sl_status_t
sl_si91x_gspi_init(sl_gspi_instance_t instance, sl_gspi_handle_t *gspi_handle)

This API will initializes the GSPI.

sl_status_t
sl_si91x_gspi_deinit(sl_gspi_handle_t gspi_handle)

This API will Uninitialize the GSPI.

sl_status_t
sl_si91x_gspi_set_configuration(sl_gspi_handle_t gspi_handle, sl_gspi_control_config_t *control_configuration)

This API will be used to configure the GSPI module.

sl_status_t
sl_si91x_gspi_receive_data(sl_gspi_handle_t gspi_handle, void *data, uint32_t data_length)

This API will receives data from the secondary device.

sl_status_t
sl_si91x_gspi_send_data(sl_gspi_handle_t gspi_handle, const void *data, uint32_t data_length)

This API will Send data to the secondary device.

sl_status_t
sl_si91x_gspi_transfer_data(sl_gspi_handle_t gspi_handle, const void *data_out, void *data_in, uint32_t data_length)

This API will Send and receive data to the secondary device simultaneously.

sl_status_t
sl_si91x_gspi_set_master_state(sl_gspi_handle_t gspi_handle, boolean_t value)

This API will set the master state as active or de-active.

sl_status_t
sl_si91x_gspi_register_event_callback(sl_gspi_handle_t gspi_handle, sl_gspi_signal_event_t callback_event)

This API will Register the user callback function.

void

This API will Un-register the user callback function.

This API will Gets the GSPI version.

sl_si91x_gspi_get_status(sl_gspi_handle_t gspi_handle)

This API will Get the transfer status GSPI.

uint32_t
sl_si91x_gspi_get_rx_data_count(sl_gspi_handle_t gspi_handle)

This API will Get data receive count of the GSPI.

uint32_t

This API will Get the transmit data count of GSPI.

int32_t
sl_si91x_gspi_get_clock_division_factor(sl_gspi_handle_t gspi_handle)

This API will fetch the clock division factor.

uint32_t

This API will Fetch the frame length, i.e., bit width.

__STATIC_INLINE sl_status_t

This API will Set the secondary number in multi-secondary operation.

Enumeration Documentation#

gspi_event_typedef_t#

gspi_event_typedef_t

Enumeration for different GSPI callback events.

Enumerator
SL_GSPI_TRANSFER_COMPLETE

Transfer complete event.

SL_GSPI_DATA_LOST

Data lost event.

SL_GSPI_MODE_FAULT

Mode fault event.


Definition at line 56 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_gspi_power_state_t#

sl_gspi_power_state_t

Enumeration for GSPI power state.

Enumerator
SL_GSPI_POWER_OFF

Power mode OFF.

SL_GSPI_LOW_POWER

Low power mode.

SL_GSPI_FULL_POWER

Full power mode.

SL_GSPI_POWER_MODE_LAST

Last member of enum for validation.


Definition at line 63 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

clock_mode_typedef_t#

clock_mode_typedef_t

Enumeration for GSPI clock modes.

Enumerator
SL_GSPI_MODE_0

Mode 0 CPOL0_CPHA0.

SL_GSPI_MODE_3

Mode 1 CPOL1_CPHA1.


Definition at line 71 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

master_mode_typedef_t#

master_mode_typedef_t

Enumeration for GSPI master modes.

Enumerator
SL_GSPI_MASTER_INACTIVE

Master mode inactive.

SL_GSPI_MASTER_ACTIVE

Master mode active.

SL_GSPI_MASTER_MODE_LAST

Last member of enum for validation.


Definition at line 77 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

slave_select_mode_typedef_t#

slave_select_mode_typedef_t

Enumeration for GSPI secondary select mode.

Enumerator
SL_GSPI_MASTER_UNUSED

Master unused mode.

SL_GSPI_MASTER_SW

Master software mode.

SL_GSPI_MASTER_HW_OUTPUT

Master hardware output mode.

SL_GSPI_SLAVE_SELECT_MODE_LAST

Last member of enum for validation.


Definition at line 84 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_gspi_instance_t#

sl_gspi_instance_t

Enumeration for GSPI Master instance, enum for one member, future provision is provided.

Enumerator
SL_GSPI_MASTER

GSPI Master Instance.

SL_GSPI_INSTANCE_LAST_ENUM

Last member of enum for validation.


Definition at line 92 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_gspi_slave_number_t#

sl_gspi_slave_number_t

Enumeration for GSPI secondary numbers.

Enumerator
GSPI_SLAVE_0

Slave No. 1.

GSPI_SLAVE_1

Slave No. 2.

GSPI_SLAVE_2

Slave No. 2.

GSPI_SLAVE_LAST_ENUM

Last member of enum for validation.


Definition at line 98 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

Typedef Documentation#

sl_gspi_signal_event_t#

typedef ARM_SPI_SignalEvent_t sl_gspi_signal_event_t

Renamed signal event structure.


Definition at line 50 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_gspi_status_t#

typedef ARM_SPI_STATUS sl_gspi_status_t

Renamed status structure.


Definition at line 51 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_gspi_driver_t#

typedef ARM_DRIVER_SPI sl_gspi_driver_t

Renamed GSPI driver structure.


Definition at line 52 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_gspi_handle_t#

typedef const void* sl_gspi_handle_t

Created GSPI handle type.


Definition at line 53 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

Variable Documentation#

swap_read#

boolean_t sl_gspi_control_config_t::swap_read

true to enable and false to disable swap read


Definition at line 107 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

swap_write#

boolean_t sl_gspi_control_config_t::swap_write

true to enable and false to disable swap write


Definition at line 108 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

bit_width#

uint8_t sl_gspi_control_config_t::bit_width

Bit width either 8 bit or 16 bit.


Definition at line 109 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

clock_mode#

uint32_t sl_gspi_control_config_t::clock_mode

Mode 0 or Mode 3 of GSPI.


Definition at line 110 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

slave_select_mode#

uint32_t sl_gspi_control_config_t::slave_select_mode

Secondary select mode either software of hardware output.


Definition at line 111 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

bitrate#

uint32_t sl_gspi_control_config_t::bitrate

Bitrate for setting the clock division factor.


Definition at line 112 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

soc_pll_mm_count_value#

uint8_t sl_gspi_clock_config_t::soc_pll_mm_count_value

SoC PLL count value.


Definition at line 117 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

intf_pll_500_control_value#

uint16_t sl_gspi_clock_config_t::intf_pll_500_control_value

Int PLL control value.


Definition at line 118 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

intf_pll_clock#

uint32_t sl_gspi_clock_config_t::intf_pll_clock

Intf PLL clock frequency.


Definition at line 119 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

intf_pll_reference_clock#

uint32_t sl_gspi_clock_config_t::intf_pll_reference_clock

Intf PLL reference clock frequency.


Definition at line 120 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

soc_pll_clock#

uint32_t sl_gspi_clock_config_t::soc_pll_clock

SoC PLL clock frequency.


Definition at line 121 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

soc_pll_reference_clock#

uint32_t sl_gspi_clock_config_t::soc_pll_reference_clock

SoC PLL reference clock frequency.


Definition at line 122 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

division_factor#

uint16_t sl_gspi_clock_config_t::division_factor

Clock Division Factor.


Definition at line 123 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

release#

uint8_t sl_gspi_version_t::release

Release version number.


Definition at line 128 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

major#

uint8_t sl_gspi_version_t::major

sqa version number


Definition at line 129 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

minor#

uint8_t sl_gspi_version_t::minor

dev version number


Definition at line 130 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

Function Documentation#

sl_si91x_gspi_configure_clock#

sl_status_t sl_si91x_gspi_configure_clock (sl_gspi_clock_config_t * clock_configuration)

This API will configure the clock for GSPI module.

Parameters
N/Aclock_configuration

Pointer to the clock configuration structure sl_gspi_clock_config_t

Set the clock for the GSPI peripheral, Configures the PLL clock and SOC clock with the value set by the user in the clock configuration structure. Returns

  • status

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_FAIL (0x0001) - The function has failed

    • SL_STATUS_NOT_INITIALIZED (0x0011) - Clock is not initialized


Definition at line 148 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_init#

sl_status_t sl_si91x_gspi_init (sl_gspi_instance_t instance, sl_gspi_handle_t * gspi_handle)

This API will initializes the GSPI.

Parameters
[in]instance

GSPI Instance. sl_gspi_instance_t

[in]gspi_handle

Double Pointer to the GSPI driver handle sl_gspi_handle_t

as partof GSPI initialization if the DMA is enabled, it also initializes the DMA module. Passing the address of the pointer for storing the GSPI master handle, which can be used in the future for other function calls.

Returns

  • status

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 165 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_deinit#

sl_status_t sl_si91x_gspi_deinit (sl_gspi_handle_t gspi_handle)

This API will Uninitialize the GSPI.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle sl_gspi_handle_t

This will Uninitialize the GSPI and if the DMA is enabled, it also uninitializes the DMA module.

Returns

  • status

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer

Note

  • When GSPI module is used in combination with other peripherals, while deinitializing in the application, refer to the notes below:

    1. Whenever sl_si91x_gspi_deinit() gets called, it will disable the clock for the peripheral. To power off the peripheral we have to power down the power domain (PERI_EFUSE) which contains different peripherals mentioned below. i.e USART, UART, I2C, SSI Master, SSI Slave, Generic-SPI Master, I2S Master, I2S Slave, Micro-DMA Controller, Config Timer, Random-Number Generator, CRC Accelerator, SIO, QEI, MCPWM and EFUSE. Use below API to power down the particular power domain if other periherals are not being used: sl_si91x_peri_efuse_power_down(power_down);

    2. A few peripherals (ULP Peripherals, UULP Peripherals, GPDMA and SDIO-SPI) have separate domains; those can be powered down indepedently. For additional details, refer to the Power architecture section in the Hardware Reference Manual. Here ULP_UART has a separate power domain ULPSS_PWRGATE_ULP_UART, which can be powered down independently. Refer to rsi_power_save.h file for all power gates definitions.


Definition at line 191 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_set_configuration#

sl_status_t sl_si91x_gspi_set_configuration (sl_gspi_handle_t gspi_handle, sl_gspi_control_config_t * control_configuration)

This API will be used to configure the GSPI module.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle sl_gspi_handle_t

[in]control_configuration

pointer to the configuration structure sl_gspi_control_config_t

The GSPI control and configuration options are listed below:

  • The configurations are listed below:

    • swap_read (enable/disable)

    • swap_write (enable/disable)

    • bit_width (1-16 bits)

    • clock_mode (mode0/mode3)

    • slave_select_mode (hw_output/sw)

    • bitrate Note

      • Swap Read and Swap Write can be used only if the bit_width is configured as 16.

      Returns

      • status

        • SL_STATUS_OK (0x0000) - Success

        • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer

        • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

        • SL_STATUS_FAIL (0x0001) - The function has failed

        • SL_STATUS_NOT_SUPPORTED (0x000F) - Parameter is not supported

        • SL_STATUS_BUSY (0x0004) - Driver is busy

        • SL_STATUS_INVALID_MODE (0x0024) - Secondary select Mode is invalid

        • SL_STATUS_INVALID_TYPE (0x0026) - SPI frame format is not valid

        • SL_STATUS_INVALID_RANGE (0x0028) - Data bits (frame length) are not in range


Definition at line 221 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_receive_data#

sl_status_t sl_si91x_gspi_receive_data (sl_gspi_handle_t gspi_handle, void * data, uint32_t data_length)

This API will receives data from the secondary device.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle sl_gspi_handle_t

[in]data

pointer to the variable that will store the received data

[in]data_length

(uint32_t) number of data items to receive

If DMA is enabled, it configures the DMA channel and required parameters. When the received data is equal to data_length passed in this function, a callback event is generated which can be registered using sl_si91x_gspi_register_event_callback

Returns

  • status

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_FAIL (0x0001) - The function has failed

    • SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 245 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_send_data#

sl_status_t sl_si91x_gspi_send_data (sl_gspi_handle_t gspi_handle, const void * data, uint32_t data_length)

This API will Send data to the secondary device.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle ( sl_gspi_handle_t)

[in]data

const pointer to the variable that has data which needs to be sent

[in]data_length

(uint32_t) number of data items to send

If DMA is enabled, it configures the DMA channel and required parameters. When the send data is equal to data_length passed in this function, a callback event is generated which can be registered using sl_si91x_gspi_register_event_callback

Returns

  • status

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_FAIL (0x0001) - The function has failed

    • SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 268 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_transfer_data#

sl_status_t sl_si91x_gspi_transfer_data (sl_gspi_handle_t gspi_handle, const void * data_out, void * data_in, uint32_t data_length)

This API will Send and receive data to the secondary device simultaneously.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle ( sl_gspi_handle_t)

[in]data_out

const pointer to the variable that has data which needs to be sent

[in]data_in

pointer to the variable that will store the received data

[in]data_length

(uint32_t) number of data items to receive

If DMA is enabled, it configures the DMA channel and required parameters. When the received data and send data is equal to data_length passed in this function, a callback event is generated which can be registered using sl_si91x_gspi_register_event_callback.

Returns

  • status

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_FAIL (0x0001) - The function has failed

    • SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 292 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_set_master_state#

sl_status_t sl_si91x_gspi_set_master_state (sl_gspi_handle_t gspi_handle, boolean_t value)

This API will set the master state as active or de-active.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle ( sl_gspi_handle_t)

[in]value

(boolean_t) Enable or Disable

Set the main state, i.e., activate/de-activate. If the master is not required in the application for a specific time, it can be turned on/off in runtime by using this API.

Returns

  • status

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer

    • SL_STATUS_BUSY (0x0004) - Driver is busy

    • SL_STATUS_INVALID_MODE (0x0024) - Mode is invalid (Fails to activate master)


Definition at line 314 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_register_event_callback#

sl_status_t sl_si91x_gspi_register_event_callback (sl_gspi_handle_t gspi_handle, sl_gspi_signal_event_t callback_event)

This API will Register the user callback function.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle ( sl_gspi_handle_t)

[in]callback_event

Pointer to the function that needs to be called at the time of interrupt ( sl_gspi_signal_event_t)

At the time of events, the function passed in the parameter is called with the respective event as the parameter. Before calling this function again, it is mandatory to call the sl_si91x_gspi_unregister_event_callback function to unregister the callback, otherwise it returns SL_STATUS_BUSY error code. Returns

  • status

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer

    • SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 331 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_unregister_event_callback#

void sl_si91x_gspi_unregister_event_callback (void )

This API will Un-register the user callback function.

Parameters
[in]

Note

  • It is mandatory to call this function before registering the callback again.

Returns

  • none


Definition at line 342 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_get_version#

sl_gspi_version_t sl_si91x_gspi_get_version (void )

This API will Gets the GSPI version.

Parameters
[in]

This will read the current API vesion of GSPI and It returns same. Returns


Definition at line 351 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_get_status#

sl_gspi_status_t sl_si91x_gspi_get_status (sl_gspi_handle_t gspi_handle)

This API will Get the transfer status GSPI.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle ( sl_gspi_handle_t)

It returns the sl_gspi_status_t type structure. The members are:


Definition at line 367 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_get_rx_data_count#

uint32_t sl_si91x_gspi_get_rx_data_count (sl_gspi_handle_t gspi_handle)

This API will Get data receive count of the GSPI.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle ( sl_gspi_handle_t)

If a receive operation is started, this function can be used to get number of data bytes received.

Returns

  • uint32_t value of the RX data count


Definition at line 380 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_get_tx_data_count#

uint32_t sl_si91x_gspi_get_tx_data_count (void )

This API will Get the transmit data count of GSPI.

Parameters
[in]

Pointer to the GSPI driver handle ( sl_gspi_handle_t)

If a send operation is started, this function can be used to get number of data bytes sent.

Returns

  • uint32_t value of the tx data count


Definition at line 394 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_get_clock_division_factor#

int32_t sl_si91x_gspi_get_clock_division_factor (sl_gspi_handle_t gspi_handle)

This API will fetch the clock division factor.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle ( sl_gspi_handle_t)

The clock division factor is calculated on the based of peripheral clock configured. It decides the baud rate of GSPI. Returns

  • factor (int32_t) The value of the clock division factor


Definition at line 404 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_get_frame_length#

uint32_t sl_si91x_gspi_get_frame_length (void )

This API will Fetch the frame length, i.e., bit width.

Parameters
[in]

This will get the frame length and the frame length ranges between 1 and 15.

Returns

  • frame_length (uint32_t) The value of the frame length


Definition at line 415 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_set_slave_number#

__STATIC_INLINE sl_status_t sl_si91x_gspi_set_slave_number (uint8_t number)

This API will Set the secondary number in multi-secondary operation.

Parameters
[in]number

Secondary number ( sl_gspi_slave_number_t)

For a single secondary also, this API needs to be called before transferring the data.

Returns

  • none


Definition at line 427 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_gspi.h