SPI HAL module driver.
More...
|
file | spi.h |
| Serial Peripheral Interface (SPI) Driver API.
|
|
SPI HAL module driver.
Serial Peripheral Interface (SPI) bus driver support.
◆ 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.
◆ 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] | size | The 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-NULL | The new bus control. |
NULL | An 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
-
◆ spi_bus_destroy_and_free()
void spi_bus_destroy_and_free |
( |
spi_bus * |
bus | ) |
|
Destroys a bus control and frees its memory.
- Parameters
-
◆ spi_bus_init()
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
-
- Return values
-
0 | Successful operation. |
-1 | An 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] | bus | The bus control. |
[in] | bus_path | The path to the bus device file. |
- Return values
-
0 | Successful operation. |
-1 | An error occurred. The errno is set to indicate the error. |