RTEMS: bsps/arm/raspberrypi/i2c/i2c.c File Reference

| RTEMS 5.4-rc2

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_path | Path to the bus device file.
  [in] | bus_clock | Bus clock in Hz.

Return values

  0 | Bus registered successfully.
  <0 | Could not register the bus. The return value is a negative errno code.