RTEMS 6.1-rc4
Loading...
Searching...
No Matches
Modules | Files | Data Structures | Macros | Typedefs | Functions

A simple SPI bus driver that just uses GPIO pins. More...

Modules

 RTEMSDeviceIMXSPIGPIO
 A SPI bus driver that uses the i.MX/i.MXRT GPIO pins.
 

Files

file  spi-gpio.h
 This header file provides the interfaces of RTEMSDeviceSPIGPIO.
 
file  spi-gpio.c
 This file provides the implementation of RTEMSDeviceSPIGPIO.
 

Data Structures

struct  spi_gpio_params
 Parameters for the driver. More...
 

Macros

#define SPI_GPIO_MAX_CS   4
 

Typedefs

typedef void() spi_gpio_set_pin_fn(void *arg, bool level)
 Type of the functions that set pins.
 
typedef bool() spi_gpio_get_pin_fn(void *arg)
 Type of the functions that read pins.
 

Functions

rtems_status_code spi_gpio_init (const char *device, const struct spi_gpio_params *params)
 

Detailed Description

A simple SPI bus driver that just uses GPIO pins.

Implements a SPI that is emulated by toggling GPIO pins. Callbacks are used to set or get the pins so that it can be easily adapted to various GPIO controllers.

NOTE: This driver is slow! If you need performance: Don't use it. The intended use case is (for example) a one time configuration of some SPI peripheral.

The driver will just work as fast as it can. Setting a speed limit is currently not supported.

Typedef Documentation

◆ spi_gpio_get_pin_fn

typedef bool() spi_gpio_get_pin_fn(void *arg)

Type of the functions that read pins.

Get current level of GPIO pin. Should return either 0 for low or anything else for high. arg is an application specific parameter.

◆ spi_gpio_set_pin_fn

typedef void() spi_gpio_set_pin_fn(void *arg, bool level)

Type of the functions that set pins.

Set a GPIO pin to level. level is false for low or true for high. arg is an application specific parameter.

Function Documentation

◆ spi_gpio_init()

rtems_status_code spi_gpio_init ( const char *  device,
const struct spi_gpio_params params 
)

Register a new SPI GPIO instance at the device path device.

To save memory, params will be used directly. Make sure that the structure remains valid during the complete application run time.

Returns
RTEMS_SUCCESSFUL if registering the bus worked or an error code if it didn't.