How to include chip select in SPI device drivers?

André Marques andre.lousa.marques at
Sun Jun 5 23:22:17 UTC 2016

Hello Jan,

Às 23:29 de 04-06-2016, Jan Sommer escreveu:
> Hello,
> I was wondering if there is a "standard" way for setting/clearing the chip select pin when writing an SPI device driver.
> I checked the example drivers in the libchip directory and the example of André Marques, but didn't really find anything.
> So far, I had the idea to pass 2 functions (CS_enable, CS_disable) to the device driver to have it BSP-agnostic because setting GPIOs is handled differently for different BSPs, but any suggestions are welcome.
> Best regards,
>     Jan
> _______________________________________________
> users mailing list
> users at

SPI device drivers using the libi2c API can call the 
rtems_libi2c_send_addr to address a slave device via the chip select.

I have a simple SPI device driver at

For more examples have a look for files including rtems/libi2c.h on the 
RTEMS tree. Note that you will also find I2C drivers using this API, so 
you have to filter those.

For documentation you can check the libi2c header file, as it is more 
complete than its doxygen.

Anyway, I believe there was a desire to move SPI support to another API, 
as it happened with I2C.

--André Marques

More information about the users mailing list