RTEMS: bsps/arm/atsam/include/bsp/atsam-i2c.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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
31 typedef 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;
48 rtems_binary_semaphore sem;
49 rtems_vector_number irq;
50} atsam_i2c_bus;
51
52int i2c_bus_register_atsam(
53 const char *bus_path,
54 Twihs *register_base,
55 rtems_vector_number irq,
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 */
i2c.h
Inter-Integrated Circuit (I2C) Driver API.
rtems_vector_number
ISR_Vector_number rtems_vector_number
Control block type used to manage the vectors.
Definition: intr.h:47
pio.h
Twihs
Twihs hardware registers.
Definition: component_twihs.h:41
_Pin
Definition: pio.h:172
atsam_i2c_bus
Definition: atsam-i2c.h:31
i2c_bus
I2C bus control.
Definition: i2c.h:110
i2c_msg
I2C transfer message.
Definition: i2c.h:138
rtems_binary_semaphore
Definition: thread.h:221