RTEMS: bsps/arm/raspberrypi/include/bsp/i2c.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
i2c.h
Go to the documentation of this file.
1
9/*
10 * Copyright (c) 2014-2015 Andre Marques <andre.lousa.marques at gmail.com>
11 *
12 * The license and distribution terms for this file may be
13 * found in the file LICENSE in this distribution or at
14 * http://www.rtems.org/license/LICENSE.
15 */
16
17#ifndef LIBBSP_ARM_RASPBERRYPI_I2C_H
18#define LIBBSP_ARM_RASPBERRYPI_I2C_H
19
20#include <dev/i2c/i2c.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif /* __cplusplus */
25
37#define BSC_CORE_CLK_HZ 150000000
38
44#define DEFAULT_BUS_CLOCK 100000
45
57extern void rpi_i2c_init(void);
58
70extern int rpi_i2c_register_bus(
71 const char *bus_path,
72 uint32_t bus_clock
73);
74
82static inline int rpi_setup_i2c_bus(void)
83{
84 rpi_i2c_init();
85
86 return rpi_i2c_register_bus("/dev/i2c", DEFAULT_BUS_CLOCK);
87}
88
91#ifdef __cplusplus
92}
93#endif /* __cplusplus */
94
95#endif /* LIBBSP_ARM_RASPBERRYPI_I2C_H */
DEFAULT_BUS_CLOCK
#define DEFAULT_BUS_CLOCK
Default bus clock.
Definition: i2c.h:44
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.
Definition: i2c.c:364
rpi_i2c_init
void rpi_i2c_init(void)
Setups the Raspberry Pi GPIO header to activate the BSC I2C bus.
Definition: i2c.c:416
i2c.h
Inter-Integrated Circuit (I2C) Driver API.