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

Support for the I2C 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/i2c.h>
#include <assert.h>

Data Structures

struct  rpi_i2c_bus
 Object containing relevant information about an I2C bus. More...
 

Macros

#define TRANSFER_COUNT(buffer_size)   (buffer_size + 0xFFFE) / 0xFFFF
 
#define ADJUST_TRANSFER_SIZE(transfer_count, remaining_bytes)    transfer_count > 1 ? 0xFFFF : (remaining_bytes & 0xFFFF)
 
#define I2C_POLLING(condition)
 

Functions

int rpi_i2c_register_bus (const char *bus_path, uint32_t bus_clock)
 Registers the Raspberry Pi BSC I2C bus with the Linux I2C User-Space API.
 
void rpi_i2c_init (void)
 Setups the Raspberry Pi GPIO header to activate the BSC I2C bus.
 

Detailed Description

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

Macro Definition Documentation

◆ I2C_POLLING

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

Function Documentation

◆ rpi_i2c_register_bus()

int rpi_i2c_register_bus ( const char *  bus_path,
uint32_t  bus_clock 
)

Registers the Raspberry Pi BSC I2C bus with the Linux I2C User-Space API.

Parameters
[in]bus_pathPath to the bus device file.
[in]bus_clockBus clock in Hz.
Return values
0Bus registered successfully.
<0Could not register the bus. The return value is a negative errno code.