RTEMS 6.1-rc7
Loading...
Searching...
No Matches
i2c.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2013 Christian Mauderer. All rights reserved.
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15/* The I2C-module can not run with libi2c. The reason for this is, that libi2c
16 * needs a possibility to generate a stop condition separately. This controller
17 * wants to generate the condition automatically when sending or receiving data.
18 */
19
20#ifndef LIBBSP_ARM_STM32F4_I2C_H
21#define LIBBSP_ARM_STM32F4_I2C_H
22
23#include <rtems.h>
24
25#include <bsp/io.h>
26#include <bsp/stm32f4.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif /* __cplusplus */
31
39typedef struct {
44 uint16_t addr;
46 bool read;
48 size_t len;
50 uint8_t *buf;
52
53typedef struct {
54 volatile stm32f4_i2c *regs;
55 size_t index;
58 rtems_id task_id;
59 uint8_t *data;
60 uint8_t *last;
61 size_t len;
62 bool read;
63 uint8_t addr_with_rw;
65
68
73);
74
78 uint32_t br
79);
80
81extern stm32f4_i2c_bus_entry *const stm32f4_i2c1;
82extern stm32f4_i2c_bus_entry *const stm32f4_i2c2;
83
86#ifdef __cplusplus
87}
88#endif /* __cplusplus */
89
90#endif /* LIBBSP_ARM_STM32F4_I2C_H */
ISR_Vector_number rtems_vector_number
This integer type represents interrupt vector numbers.
Definition: intr.h:102
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
Objects_Id rtems_id
This type represents RTEMS object identifiers.
Definition: types.h:94
rtems_status_code stm32f4_i2c_process_message(stm32f4_i2c_bus_entry *e, stm32f4_i2c_message *msg)
Process a i2c message.
Definition: i2c.c:263
rtems_status_code stm32f4_i2c_init(stm32f4_i2c_bus_entry *e)
Initialise the i2c module.
Definition: i2c.c:210
rtems_status_code stm32f4_i2c_set_bitrate(stm32f4_i2c_bus_entry *e, uint32_t br)
Set another baud rate than the default one.
Definition: i2c.c:44
ssize_t read(int fd, void *buffer, size_t count)
Definition: read.c:46
This header file defines the RTEMS Classic API.
Register definitions.
Definition: b1553brm.c:94
Definition: mutex.h:4
Definition: i2c.h:53
Definition: i2c.h:39
uint16_t addr
The address of the slave without the read write bit. A 7-Bit address should be placed in the bits [6....
Definition: i2c.h:44
uint8_t * buf
Buffer for data.
Definition: i2c.h:50
size_t len
Size of data to read or write.
Definition: i2c.h:48
bool read
Read (true) or write (false) data.
Definition: i2c.h:46
Definition: stm32_i2c.h:27
unsigned e
Definition: tlb.h:13