cpukit/spi: Allow driver specific ioctl

This allows a SPI driver to add a hardware specific ioctl.
This commit is contained in:
Christian Mauderer
2021-01-21 10:17:31 +01:00
parent d9794a1f97
commit b2f265ab9f
2 changed files with 10 additions and 0 deletions
+3
View File
@@ -199,6 +199,8 @@ static int spi_bus_ioctl(
arg,
IOCPARM_LEN(command) / sizeof(struct spi_ioc_transfer)
);
} else if (bus->ioctl != NULL) {
err = (*bus->ioctl)(bus, command, arg);
} else {
err = -EINVAL;
}
@@ -300,6 +302,7 @@ static int spi_bus_do_init(
bus->transfer = spi_bus_transfer_default;
bus->setup = spi_bus_setup_default;
bus->destroy = destroy;
bus->ioctl = NULL;
bus->bits_per_word = 8;
return 0;
+7
View File
@@ -141,6 +141,13 @@ struct spi_bus {
* devices.
*/
uint16_t delay_usecs;
/**
* @brief Driver specific ioctl.
*
* @param[in] bus The bus control.
*/
int (*ioctl)(spi_bus *bus, ioctl_command_t command, void *arg);
};
/**