RTEMS 7.0-rc1
Loading...
Searching...
No Matches
i2c.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0+-with-RTEMS-exception */
2
9/*
10 * Copyright (c) 2013 Christian Mauderer. All rights reserved.
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/* The I2C-module can not run with libi2c. The reason for this is, that libi2c
18 * needs a possibility to generate a stop condition separately. This controller
19 * wants to generate the condition automatically when sending or receiving data.
20 */
21
22#ifndef LIBBSP_ARM_STM32F4_I2C_H
23#define LIBBSP_ARM_STM32F4_I2C_H
24
25#include <rtems.h>
26
27#include <bsp/io.h>
28#include <bsp/stm32f4.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif /* __cplusplus */
33
41typedef struct {
46 uint16_t addr;
48 bool read;
50 size_t len;
52 uint8_t *buf;
54
55typedef struct {
56 volatile stm32f4_i2c *regs;
57 size_t index;
60 rtems_id task_id;
61 uint8_t *data;
62 uint8_t *last;
63 size_t len;
64 bool read;
65 uint8_t addr_with_rw;
67
70
75);
76
80 uint32_t br
81);
82
83extern stm32f4_i2c_bus_entry *const stm32f4_i2c1;
84extern stm32f4_i2c_bus_entry *const stm32f4_i2c2;
85
88#ifdef __cplusplus
89}
90#endif /* __cplusplus */
91
92#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:267
rtems_status_code stm32f4_i2c_init(stm32f4_i2c_bus_entry *e)
Initialise the i2c module.
Definition: i2c.c:214
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:48
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:55
Definition: i2c.h:41
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:46
uint8_t * buf
Buffer for data.
Definition: i2c.h:52
size_t len
Size of data to read or write.
Definition: i2c.h:50
bool read
Read (true) or write (false) data.
Definition: i2c.h:48
Definition: stm32_i2c.h:29