RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
atsam-i2c.h
1/*
2 * Copyright (c) 2016 embedded brains GmbH. All rights reserved.
3 *
4 * embedded brains GmbH
5 * Dornierstr. 4
6 * 82178 Puchheim
7 * Germany
8 * <info@embedded-brains.de>
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#ifndef LIBBSP_ARM_ATSAM_ATSAM_I2C_H
16#define LIBBSP_ARM_ATSAM_ATSAM_I2C_H
17
18#include <libchip/chip.h>
19#include <libchip/include/pio.h>
20
21#include <bsp.h>
22#include <rtems/thread.h>
23#include <dev/i2c/i2c.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif /* __cplusplus */
28
29#define TWI_AMOUNT_PINS 2
30
31typedef struct {
32 i2c_bus base;
33 Twihs *regs;
34
35 /* First message and number of messages that have to be processed. */
36 i2c_msg *msgs;
37 uint32_t msg_todo;
38
39 /* Information about the current transfer. */
40 bool stop_request;
41 uint32_t current_msg_todo;
42 uint8_t *current_msg_byte;
43
44 /* Error information that can be returned to the task */
45 uint32_t err;
46
47 uint32_t output_clock;
51
52int i2c_bus_register_atsam(
53 const char *bus_path,
54 Twihs *register_base,
56 const Pin pins[TWI_AMOUNT_PINS]
57);
58
59#ifdef __cplusplus
60}
61#endif /* __cplusplus */
62
63#endif /* LIBBSP_ARM_ATSAM_ATSAM_I2C_H */
Inter-Integrated Circuit (I2C) Driver API.
ISR_Vector_number rtems_vector_number
Control block type used to manage the vectors.
Definition: intr.h:47
Twihs hardware registers.
Definition: component_twihs.h:41
Definition: pio.h:172
Definition: atsam-i2c.h:31
I2C bus control.
Definition: i2c.h:110
I2C transfer message.
Definition: i2c.h:138
Definition: thread.h:221