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

SPI HAL module driver. More...

Modules

 Linux SPI User-Space API
 RTEMS port of Linux SPI user-space API.
 
 SPI Exported Constants
 
 SPI Exported Macros
 
 SPI Exported Types
 
 SPI Private Macros
 
 SPI_Exported_Functions
 

Files

file  spi.h
 Serial Peripheral Interface (SPI) Driver API.
 

Data Structures

struct  spi_bus
 SPI bus control. More...
 

Macros

#define SPI_BUS_OBTAIN   _IO(SPI_IOC_MAGIC, 13)
 Obtains the bus.
 
#define SPI_BUS_RELEASE   _IO(SPI_IOC_MAGIC, 23)
 Releases the bus.
 

Functions

int spi_bus_init (spi_bus *bus)
 Initializes a bus control.
 
spi_busspi_bus_alloc_and_init (size_t size)
 Allocates a bus control from the heap and initializes it.
 
void spi_bus_destroy (spi_bus *bus)
 Destroys a bus control.
 
void spi_bus_destroy_and_free (spi_bus *bus)
 Destroys a bus control and frees its memory.
 
int spi_bus_register (spi_bus *bus, const char *bus_path)
 Registers a bus control.
 

Detailed Description

SPI HAL module driver.

Serial Peripheral Interface (SPI) bus driver support.

Macro Definition Documentation

◆ SPI_BUS_OBTAIN

#define SPI_BUS_OBTAIN   _IO(SPI_IOC_MAGIC, 13)

Obtains the bus.

This command has no argument.

◆ SPI_BUS_RELEASE

#define SPI_BUS_RELEASE   _IO(SPI_IOC_MAGIC, 23)

Releases the bus.

This command has no argument.

Function Documentation

◆ spi_bus_alloc_and_init()

spi_bus * spi_bus_alloc_and_init ( size_t  size)

Allocates a bus control from the heap and initializes it.

After a sucessful allocation and initialization the bus control must be destroyed via spi_bus_destroy_and_free(). A registered bus control will be automatically destroyed in case the device file is unlinked. Make sure to call spi_bus_destroy_and_free() in a custom destruction handler.

Parameters
[in]sizeThe size of the bus control. This enables the addition of bus controller specific data to the base bus control. The bus control is zero initialized.
Return values
non-NULLThe new bus control.
NULLAn error occurred. The errno is set to indicate the error.
See also
spi_bus_register()

◆ spi_bus_destroy()

void spi_bus_destroy ( spi_bus bus)

Destroys a bus control.

Parameters
[in]busThe bus control.

◆ spi_bus_destroy_and_free()

void spi_bus_destroy_and_free ( spi_bus bus)

Destroys a bus control and frees its memory.

Parameters
[in]busThe bus control.

◆ spi_bus_init()

int spi_bus_init ( spi_bus bus)

Initializes a bus control.

After a sucessful initialization the bus control must be destroyed via spi_bus_destroy(). A registered bus control will be automatically destroyed in case the device file is unlinked. Make sure to call spi_bus_destroy() in a custom destruction handler.

Parameters
[in]busThe bus control.
Return values
0Successful operation.
-1An error occurred. The errno is set to indicate the error.
See also
spi_bus_register()

◆ spi_bus_register()

int spi_bus_register ( spi_bus bus,
const char *  bus_path 
)

Registers a bus control.

This function claims ownership of the bus control regardless if the registration is successful or not.

Parameters
[in]busThe bus control.
[in]bus_pathThe path to the bus device file.
Return values
0Successful operation.
-1An error occurred. The errno is set to indicate the error.