RTEMS  5.1
i2c.h
Go to the documentation of this file.
1 
7 /*
8  * Copyright (c) 2013 Christian Mauderer. All rights reserved.
9  *
10  * embedded brains GmbH
11  * Obere Lagerstr. 30
12  * 82178 Puchheim
13  * Germany
14  * <rtems@embedded-brains.de>
15  *
16  * The license and distribution terms for this file may be
17  * found in the file LICENSE in this distribution or at
18  * http://www.rtems.org/license/LICENSE.
19  */
20 
21 /* The I2C-module can not run with libi2c. The reason for this is, that libi2c
22  * needs a possibility to generate a stop condition separately. This controller
23  * wants to generate the condition automatically when sending or receiving data.
24  */
25 
26 #ifndef LIBBSP_ARM_STM32F4_I2C_H
27 #define LIBBSP_ARM_STM32F4_I2C_H
28 
29 #include <rtems.h>
30 
31 #include <bsp/io.h>
32 #include <bsp/stm32f4.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37 
45 typedef struct {
50  uint16_t addr;
52  bool read;
54  size_t len;
56  uint8_t *buf;
58 
59 typedef struct {
60  volatile stm32f4_i2c *regs;
61  size_t index;
62  rtems_vector_number vector;
64  rtems_id task_id;
65  uint8_t *data;
66  uint8_t *last;
67  size_t len;
68  bool read;
69  uint8_t addr_with_rw;
71 
74 
79 );
80 
84  uint32_t br
85 );
86 
87 extern stm32f4_i2c_bus_entry *const stm32f4_i2c1;
88 extern stm32f4_i2c_bus_entry *const stm32f4_i2c2;
89 
92 #ifdef __cplusplus
93 }
94 #endif /* __cplusplus */
95 
96 #endif /* LIBBSP_ARM_STM32F4_I2C_H */
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:50
Register definitions.
ssize_t read(int fd, void *buffer, size_t count)
Definition: read.c:27
size_t len
Size of data to read or write.
Definition: i2c.h:54
Definition: stm32_i2c.h:33
rtems_status_code stm32f4_i2c_process_message(stm32f4_i2c_bus_entry *e, stm32f4_i2c_message *msg)
Process a i2c message.
Definition: i2c.c:269
Definition: i2c.h:45
uint8_t * buf
Buffer for data.
Definition: i2c.h:56
bool read
Read (true) or write (false) data.
Definition: i2c.h:52
ISR_Vector_number rtems_vector_number
Control block type used to manage the vectors.
Definition: intr.h:47
rtems_status_code
Classic API Status.
Definition: status.h:43
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:50
Definition: b1553brm.c:75
rtems_status_code stm32f4_i2c_init(stm32f4_i2c_bus_entry *e)
Initialise the i2c module.
Definition: i2c.c:216
Definition: i2c.h:59
unsigned e
Definition: tlb.h:223
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
Definition: mutex.h:4