RTEMS 6.1-rc5
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
spi.c File Reference

Support for the SPI bus on the Raspberry Pi GPIO P1 header (model A/B) and GPIO J8 header on model B+. More...

#include <bsp.h>
#include <bsp/raspberrypi.h>
#include <bsp/gpio.h>
#include <bsp/rpi-gpio.h>
#include <bsp/irq.h>
#include <bsp/spi.h>
#include <assert.h>

Data Structures

struct  rpi_spi_softc_t
 Object containing the SPI bus configuration settings. More...
 
struct  rpi_spi_desc_t
 Object containing the SPI bus description. More...
 

Macros

#define SPI_POLLING(condition)
 

Functions

int rpi_spi_init (bool bidirectional_mode)
 Setups the Raspberry Pi SPI bus (located on the GPIO header) on the "/dev/spi" device file, and registers the bus on the libi2c API.
 

Detailed Description

Support for the SPI bus on the Raspberry Pi GPIO P1 header (model A/B) and GPIO J8 header on model B+.

Macro Definition Documentation

◆ SPI_POLLING

#define SPI_POLLING (   condition)
Value:
while ( condition ) { \
; \
}

Function Documentation

◆ rpi_spi_init()

int rpi_spi_init ( bool  bidirectional_mode)

Setups the Raspberry Pi SPI bus (located on the GPIO header) on the "/dev/spi" device file, and registers the bus on the libi2c API.

Parameters
[in]bidirectional_modeIf TRUE sets the SPI bus to use 2-wire SPI, where the MOSI data line doubles as the slave out (SO) and slave in (SI) data lines. If FALSE the bus defaults to the usual 3-wire SPI, with 2 separate data lines (MOSI and MISO).
Return values
Returnslibi2c bus number.
<0Could not register the bus. See
See also
rtems_libi2c_register_bus().