Generic SPI#

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 slave 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 Slave 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.

Functions#

sl_status_t
sl_si91x_gspi_configure_clock(sl_gspi_clock_config_t *clock_configuration)

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

sl_status_t
sl_si91x_gspi_init(sl_gspi_instance_t instance, sl_gspi_handle_t *gspi_handle)

Initialize the GSPI.

sl_status_t
sl_si91x_gspi_deinit(sl_gspi_handle_t gspi_handle)

Uninitialize the GSPI.

sl_status_t
sl_si91x_gspi_configure_power_mode(sl_gspi_handle_t gspi_handle, sl_gspi_power_state_t state)

Change the power mode of GSPI, the supported modes are.

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

Receive data from the slave device.

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

Send data to the slave 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)

Send and receive data to the slave device simultaneously.

sl_status_t
sl_si91x_gspi_set_master_state(sl_gspi_handle_t gspi_handle, boolean_t value)

Set main state i.e., activate/de-activate the main.

sl_status_t
sl_si91x_gspi_register_event_callback(sl_gspi_handle_t gspi_handle, sl_gspi_signal_event_t callback_event)

Register the user callback function.

void

Un-register the user callback function.

Get the release, sqa and dev version of GSPI.

sl_si91x_gspi_get_status(sl_gspi_handle_t gspi_handle)

Get the transfer status GSPI.

uint32_t
sl_si91x_gspi_get_rx_data_count(sl_gspi_handle_t gspi_handle)

Get data receive count of the GSPI.

uint32_t

Get the transmit data count of GSPI.

int32_t
sl_si91x_gspi_get_clock_division_factor(sl_gspi_handle_t gspi_handle)

Fetch the clock division factor.

uint32_t

Fetch the frame length i.e., bit width.

__STATIC_INLINE sl_status_t

Set the slave number in multi-slave 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/siwx917_soc/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/siwx917_soc/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/siwx917_soc/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/siwx917_soc/drivers/unified_api/inc/sl_si91x_gspi.h

slave_select_mode_typedef_t#

slave_select_mode_typedef_t

Enumeration for GSPI slave 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/siwx917_soc/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/siwx917_soc/drivers/unified_api/inc/sl_si91x_gspi.h

sl_gspi_slave_number_t#

sl_gspi_slave_number_t

Enumeration for GSPI Slave 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/siwx917_soc/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/siwx917_soc/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/siwx917_soc/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/siwx917_soc/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/siwx917_soc/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)

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

Parameters
N/Aclock_configuration

Pointer to the clock configuration structure

Returns

  • status 0 if successful, else error code SL_STATUS_OK (0x0000) - Success SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid SL_STATUS_FAIL (0x0001) - The function is failed SL_STATUS_NOT_INITIALIZED (0x0011) - Clock is not initialized


Definition at line 147 of file components/siwx917_soc/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)

Initialize the GSPI.

Parameters
[in]instance

GSPI Instance.

[in]gspi_handle

Double Pointer to the GSPI driver handle

If the DMA is enabled, it also initializes the DMA. Pass the address of the pointer for storing the GSPI master handle, which can be used in future for other function calls.

Returns

  • status 0 if successful, else error code SL_STATUS_OK (0x0000) - Success SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 164 of file components/siwx917_soc/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)

Uninitialize the GSPI.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle

If the DMA is enabled, it also uninitializes the DMA.

Returns

  • status 0 if successful, else error code SL_STATUS_OK (0x0000) - Success SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer


Definition at line 177 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_configure_power_mode#

sl_status_t sl_si91x_gspi_configure_power_mode (sl_gspi_handle_t gspi_handle, sl_gspi_power_state_t state)

Change the power mode of GSPI, the supported modes are.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle

[in]state

pointer to the configuration structure

  • POWER_OFF

  • FULL_POWER

Returns

  • status 0 if successful, else error code SL_STATUS_OK (0x0000) - Success SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid SL_STATUS_FAIL (0x0001) - The function is failed SL_STATUS_NOT_SUPPORTED (0x000F) - Parameter is not supported


Definition at line 196 of file components/siwx917_soc/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)
Parameters
N/Agspi_handle
N/Acontrol_configuration

Definition at line 224 of file components/siwx917_soc/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)

Receive data from the slave device.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle

[in]data

pointer to the variable which will store the received data

[in]data_length

(uint32_t) number of data items to receive

Returns

  • status 0 if successful, else error code SL_STATUS_OK (0x0000) - Success SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid SL_STATUS_FAIL (0x0001) - The function is failed SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 246 of file components/siwx917_soc/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)

Send data to the slave device.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle

[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

Returns

  • status 0 if successful, else error code SL_STATUS_OK (0x0000) - Success SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid SL_STATUS_FAIL (0x0001) - The function is failed SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 267 of file components/siwx917_soc/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)

Send and receive data to the slave device simultaneously.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle

[in]data_out

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

[in]data_in

pointer to the variable which will store the received data

[in]data_length

(uint32_t) number of data items to receive

Returns

  • status 0 if successful, else error code SL_STATUS_OK (0x0000) - Success SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid SL_STATUS_FAIL (0x0001) - The function is failed SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 289 of file components/siwx917_soc/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)

Set main state i.e., activate/de-activate the main.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle

[in]value

(boolean_t) Enable or Disable

Returns

  • status 0 if successful, else error code SL_STATUS_OK (0x0000) - Success SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer SL_STATUS_BUSY (0x0004) - Driver is busy SL_STATUS_INVALID_MODE (0x0024) - Mode is invalid (Fails to activate master)


Definition at line 309 of file components/siwx917_soc/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)

Register the user callback function.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle

[in]callback_event

Pointer to the function which needs to be called at the time of interrupt

Returns

  • status 0 if successful, else error code SL_STATUS_OK (0x0000) - Success SL_STATUS_NULL_POINTER (0x0022) - The parameter is null pointer SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 321 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_unregister_event_callback#

void sl_si91x_gspi_unregister_event_callback (void )

Un-register the user callback function.

Parameters
[in]

Returns

  • none


Definition at line 331 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_get_version#

sl_gspi_version_t sl_si91x_gspi_get_version (void )

Get the release, sqa and dev version of GSPI.

Parameters
[in]

Returns


Definition at line 340 of file components/siwx917_soc/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)

Get the transfer status GSPI.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle

Returns

  • sl_gspi_status_t type structure


Definition at line 353 of file components/siwx917_soc/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)

Get data receive count of the GSPI.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle

Returns

  • uint32_t value of the RX data count


Definition at line 366 of file components/siwx917_soc/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 )

Get the transmit data count of GSPI.

Parameters
[in]

Pointer to the GSPI driver handle

Returns

  • uint32_t value of the tx data count


Definition at line 379 of file components/siwx917_soc/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)

Fetch the clock division factor.

Parameters
[in]gspi_handle

Pointer to the GSPI driver handle

Returns

  • factor(int32_t) The value of clock division factor


Definition at line 387 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_gspi.h

sl_si91x_gspi_get_frame_length#

uint32_t sl_si91x_gspi_get_frame_length (void )

Fetch the frame length i.e., bit width.

Parameters
[in]

Returns

  • frame_length (uint32_t) The value of frame length


Definition at line 395 of file components/siwx917_soc/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)

Set the slave number in multi-slave operation.

Parameters
[in]number

Slave number

For single slave also, this API needs to be called before transferring the data

Returns

  • none


Definition at line 405 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_gspi.h