File indexing completed on 2025-05-11 08:23:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef LIBBSP_ARM_STM32F4_I2C_H
0021 #define LIBBSP_ARM_STM32F4_I2C_H
0022
0023 #include <rtems.h>
0024
0025 #include <bsp/io.h>
0026 #include <bsp/stm32f4.h>
0027
0028 #ifdef __cplusplus
0029 extern "C" {
0030 #endif
0031
0032
0033
0034
0035
0036
0037
0038
0039 typedef struct {
0040
0041
0042
0043
0044 uint16_t addr;
0045
0046 bool read;
0047
0048 size_t len;
0049
0050 uint8_t *buf;
0051 } stm32f4_i2c_message;
0052
0053 typedef struct {
0054 volatile stm32f4_i2c *regs;
0055 size_t index;
0056 rtems_vector_number vector;
0057 rtems_id mutex;
0058 rtems_id task_id;
0059 uint8_t *data;
0060 uint8_t *last;
0061 size_t len;
0062 bool read;
0063 uint8_t addr_with_rw;
0064 } stm32f4_i2c_bus_entry;
0065
0066
0067 rtems_status_code stm32f4_i2c_init(stm32f4_i2c_bus_entry *e);
0068
0069
0070 rtems_status_code stm32f4_i2c_process_message(
0071 stm32f4_i2c_bus_entry *e,
0072 stm32f4_i2c_message *msg
0073 );
0074
0075
0076 rtems_status_code stm32f4_i2c_set_bitrate(
0077 stm32f4_i2c_bus_entry *e,
0078 uint32_t br
0079 );
0080
0081 extern stm32f4_i2c_bus_entry *const stm32f4_i2c1;
0082 extern stm32f4_i2c_bus_entry *const stm32f4_i2c2;
0083
0084
0085
0086 #ifdef __cplusplus
0087 }
0088 #endif
0089
0090 #endif