RTEMS: bsps/arm/altera-cyclone-v/include/bsp/alt_i2c.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
alt_i2c.h
Go to the documentation of this file.
1
7/******************************************************************************
8*
9* Copyright 2013 Altera Corporation. All Rights Reserved.
10*
11* Redistribution and use in source and binary forms, with or without
12* modification, are permitted provided that the following conditions are met:
13*
14* 1. Redistributions of source code must retain the above copyright notice,
15* this list of conditions and the following disclaimer.
16*
17* 2. Redistributions in binary form must reproduce the above copyright notice,
18* this list of conditions and the following disclaimer in the documentation
19* and/or other materials provided with the distribution.
20*
21* 3. The name of the author may not be used to endorse or promote products
22* derived from this software without specific prior written permission.
23*
24* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR
25* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO
27* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
29* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
33* OF SUCH DAMAGE.
34*
35******************************************************************************/
36
41#ifndef __ALT_I2C_H__
42#define __ALT_I2C_H__
43
44#include "hwlib.h"
45#include "alt_clock_manager.h"
46#include "socal/alt_i2c.h"
47#include "socal/alt_rstmgr.h"
48#include "socal/hps.h"
49#include "socal/socal.h"
50
51#ifdef __cplusplus
52extern "C"
53{
54#endif /* __cplusplus */
55
56/******************************************************************************/
96/******************************************************************************/
101 typedef enum ALT_I2C_TRANSFER_TYPE_e
102{
103 ALT_I2C_TRANSFER_NONE = 0,
104 ALT_I2C_TRANSFER_START = 1,
105 ALT_I2C_TRANSFER_COMPLETE = 2,
106 ALT_I2C_TRANSFER_READ = 3,
107 ALT_I2C_TRANSFER_WRITE = 4,
108}
109ALT_I2C_TRANSFER_TYPE_t;
110
111
112/*
113 * A pointer or handle to the I2C controller device instance. The ALT_I2C_DEV_t is
114 * initialized by a call to alt_i2c_init() and subsequently used by the other I2C
115 * controller API functions as a reference to a specific device.
116 *
117 * \internal
118 * ALT_I2C_DEV_t may be a struct or reference to an opaque data
119 * structure. Whatever "internal" type is suited to the needs of the
120 * implementation.
121 * \endinternal
122 */
123 typedef struct ALT_I2C_DEV_s
124{
125 void * location;
126 alt_freq_t clock_freq;
127 uint32_t last_target;
128}
129 ALT_I2C_DEV_t;
130
134 typedef enum ALT_I2C_CTLR_e
135{
136 ALT_I2C_I2C0 = (int)ALT_I2C0_OFST,
137 ALT_I2C_I2C1 = (int)ALT_I2C1_OFST,
138 ALT_I2C_I2C2 = (int)ALT_I2C2_OFST,
139 ALT_I2C_I2C3 = (int)ALT_I2C3_OFST,
140} ALT_I2C_CTLR_t;
141
149 typedef enum ALT_I2C_MODE_e
150{
151 ALT_I2C_MODE_SLAVE = ALT_I2C_CON_MST_MOD_E_DIS,
152 ALT_I2C_MODE_MASTER = ALT_I2C_CON_MST_MOD_E_EN
153} ALT_I2C_MODE_t;
154
168 typedef enum ALT_I2C_SPEED_e
169{
170 ALT_I2C_SPEED_STANDARD = ALT_I2C_CON_SPEED_E_STANDARD,
172 ALT_I2C_SPEED_FAST = ALT_I2C_CON_SPEED_E_FAST
174} ALT_I2C_SPEED_t;
175
184 typedef enum ALT_I2C_ADDR_MODE_e
185{
186 ALT_I2C_ADDR_MODE_7_BIT = ALT_I2C_TAR_IC_10BITADDR_MST_E_START7,
188 ALT_I2C_ADDR_MODE_10_BIT = ALT_I2C_TAR_IC_10BITADDR_MST_E_START10
190} ALT_I2C_ADDR_MODE_t;
191
195 typedef enum ALT_I2C_STATUS_e
196{
197 ALT_I2C_STATUS_RX_UNDER = 1UL << 0,
205 ALT_I2C_STATUS_RX_OVER = 1UL << 1,
216 ALT_I2C_STATUS_RX_FULL = 1UL << 2,
227 ALT_I2C_STATUS_TX_OVER = 1UL << 3,
236 ALT_I2C_STATUS_TX_EMPTY = 1UL << 4,
250 ALT_I2C_STATUS_RD_REQ = 1UL << 5,
264 ALT_I2C_STATUS_TX_ABORT = 1UL << 6,
284 ALT_I2C_STATUS_RX_DONE = 1UL << 7,
292 ALT_I2C_STATUS_ACTIVITY = 1UL << 8,
309 ALT_I2C_STATUS_STOP_DET = 1UL << 9,
315 ALT_I2C_STATUS_START_DET = 1UL << 10,
321 ALT_I2C_STATUS_INT_CALL = 1UL << 11,
330 ALT_I2C_STATUS_INT_ALL = 0xFFF,
340} ALT_I2C_STATUS_t;
341
353 typedef enum ALT_I2C_TX_ABORT_CAUSE_e
354{
355 ALT_I2C_TX_ABORT_CAUSE_7B_ADDR_NOACK = 1UL << 0,
364 ALT_I2C_TX_ABORT_CAUSE_10ADDR1_NOACK = 1UL << 1,
373 ALT_I2C_TX_ABORT_CAUSE_10ADDR2_NOACK = 1UL << 2,
382 ALT_I2C_TX_ABORT_CAUSE_TXDATA_NOACK = 1UL << 3,
392 ALT_I2C_TX_ABORT_CAUSE_GCALL_NOACK = 1UL << 4,
400 ALT_I2C_TX_ABORT_CAUSE_GCALL_RD = 1UL << 5,
409 ALT_I2C_TX_ABORT_CAUSE_HS_ACKDET = 1UL << 6,
416 ALT_I2C_TX_ABORT_CAUSE_SBYTE_ACKDET = 1UL << 7,
423 ALT_I2C_TX_ABORT_CAUSE_HS_NORSTRT = 1UL << 8,
433 ALT_I2C_TX_ABORT_CAUSE_SBYTE_NORSTRT = 1UL << 9,
453 ALT_I2C_TX_ABORT_CAUSE_10B_RD_NORSTRT = 1UL << 10,
461 ALT_I2C_TX_ABORT_CAUSE_MST_DIS = 1UL << 11,
468 ALT_I2C_TX_ABORT_CAUSE_ARB_LOST = 1UL << 12,
478 ALT_I2C_TX_ABORT_CAUSE_SLVFLUSH_TXFIFO = 1UL << 13,
487 ALT_I2C_TX_ABORT_CAUSE_SLV_ARBLOST = 1UL << 14,
503 ALT_I2C_TX_ABORT_CAUSE_SLVRD_INTX = 1UL << 15
512} ALT_I2C_TX_ABORT_CAUSE_t;
513
527 typedef struct ALT_I2C_MASTER_CONFIG_s
528{
529 ALT_I2C_ADDR_MODE_t addr_mode;
533 bool restart_enable;
548 ALT_I2C_SPEED_t speed_mode;
551 uint16_t ss_scl_hcnt;
555 uint16_t ss_scl_lcnt;
559 uint16_t fs_scl_hcnt;
563 uint16_t fs_scl_lcnt;
567 uint8_t fs_spklen;
573} ALT_I2C_MASTER_CONFIG_t;
574
579 typedef struct ALT_I2C_SLAVE_CONFIG_s
580{
581 ALT_I2C_ADDR_MODE_t addr_mode;
584 uint32_t addr;
588 bool nack_enable;
602} ALT_I2C_SLAVE_CONFIG_t;
603
626 ALT_STATUS_CODE alt_i2c_init(const ALT_I2C_CTLR_t i2c, ALT_I2C_DEV_t *i2c_dev);
627
648 ALT_STATUS_CODE alt_i2c_reset(ALT_I2C_DEV_t * i2c_dev);
649
666 ALT_STATUS_CODE alt_i2c_uninit(ALT_I2C_DEV_t *i2c_dev);
667
692 ALT_STATUS_CODE alt_i2c_disable(ALT_I2C_DEV_t *i2c_dev);
693
707 ALT_STATUS_CODE alt_i2c_enable(ALT_I2C_DEV_t *i2c_dev);
708
722 ALT_STATUS_CODE alt_i2c_is_enabled(ALT_I2C_DEV_t *i2c_dev);
723
741 ALT_STATUS_CODE alt_i2c_master_config_get(ALT_I2C_DEV_t *i2c_dev,
742 ALT_I2C_MASTER_CONFIG_t* cfg);
743
761 ALT_STATUS_CODE alt_i2c_master_config_set(ALT_I2C_DEV_t *i2c_dev,
762 const ALT_I2C_MASTER_CONFIG_t* cfg);
763
780 ALT_STATUS_CODE alt_i2c_master_config_speed_get(ALT_I2C_DEV_t *i2c_dev,
781 const ALT_I2C_MASTER_CONFIG_t* cfg,
782 uint32_t * speed_in_hz);
783
803 ALT_STATUS_CODE alt_i2c_master_config_speed_set(ALT_I2C_DEV_t *i2c_dev,
804 ALT_I2C_MASTER_CONFIG_t * cfg,
805 uint32_t speed_in_hz);
806
810#define alt_i2c_cfg_to_speed(i2c_dev, speed_in_hz, cfg) alt_i2c_master_config_speed_get((i2c_dev), (cfg), (speed_in_hz))
811
815#define alt_i2c_speed_to_cfg(i2c_dev, speed_in_hz, cfg) alt_i2c_master_config_speed_set((i2c_dev), (cfg), (speed_in_hz))
816
834 ALT_STATUS_CODE alt_i2c_slave_config_get(ALT_I2C_DEV_t *i2c_dev,
835 ALT_I2C_SLAVE_CONFIG_t* cfg);
836
854 ALT_STATUS_CODE alt_i2c_slave_config_set(ALT_I2C_DEV_t *i2c_dev,
855 const ALT_I2C_SLAVE_CONFIG_t* cfg);
856
889 ALT_STATUS_CODE alt_i2c_sda_hold_time_get(ALT_I2C_DEV_t *i2c_dev,
890 uint16_t *hold_time);
891
909 ALT_STATUS_CODE alt_i2c_sda_hold_time_set(ALT_I2C_DEV_t *i2c_dev,
910 const uint16_t hold_time);
911
930 ALT_STATUS_CODE alt_i2c_op_mode_get(ALT_I2C_DEV_t *i2c_dev,
931 ALT_I2C_MODE_t* mode);
932
948 ALT_STATUS_CODE alt_i2c_op_mode_set(ALT_I2C_DEV_t *i2c_dev,
949 const ALT_I2C_MODE_t mode);
950
968 ALT_STATUS_CODE alt_i2c_is_busy(ALT_I2C_DEV_t *i2c_dev);
969
995 ALT_STATUS_CODE alt_i2c_read(ALT_I2C_DEV_t *i2c_dev, uint8_t *val);
996
1022 ALT_STATUS_CODE alt_i2c_write(ALT_I2C_DEV_t *i2c_dev, const uint8_t val);
1023
1046 ALT_STATUS_CODE alt_i2c_slave_receive(ALT_I2C_DEV_t *i2c_dev,
1047 uint8_t *data);
1048
1071 ALT_STATUS_CODE alt_i2c_slave_transmit(ALT_I2C_DEV_t *i2c_dev,
1072 const uint8_t data);
1073
1130 ALT_STATUS_CODE alt_i2c_slave_bulk_transmit(ALT_I2C_DEV_t *i2c_dev,
1131 const void * data,
1132 const size_t size);
1133
1148 ALT_STATUS_CODE alt_i2c_master_target_get(ALT_I2C_DEV_t * i2c_dev, uint32_t * target_addr);
1149
1169 ALT_STATUS_CODE alt_i2c_master_target_set(ALT_I2C_DEV_t * i2c_dev, uint32_t target_addr);
1170
1224 ALT_STATUS_CODE alt_i2c_master_transmit(ALT_I2C_DEV_t *i2c_dev,
1225 const void * data,
1226 const size_t size,
1227 const bool issue_restart,
1228 const bool issue_stop);
1229
1291 ALT_STATUS_CODE alt_i2c_master_receive(ALT_I2C_DEV_t *i2c_dev,
1292 void * data,
1293 const size_t size,
1294 const bool issue_restart,
1295 const bool issue_stop);
1296
1344 ALT_STATUS_CODE alt_i2c_issue_read(ALT_I2C_DEV_t *i2c_dev,
1345 const bool issue_restart,
1346 const bool issue_stop);
1347
1397 ALT_STATUS_CODE alt_i2c_issue_write(ALT_I2C_DEV_t *i2c_dev,
1398 const uint8_t value,
1399 const bool issue_restart,
1400 const bool issue_stop);
1401
1402/******************************************************************************/
1481 ALT_STATUS_CODE alt_i2c_master_general_call(ALT_I2C_DEV_t *i2c_dev,
1482 const void * data,
1483 const size_t size,
1484 const bool issue_restart,
1485 const bool issue_stop);
1486
1502 ALT_STATUS_CODE alt_i2c_general_call_ack_disable(ALT_I2C_DEV_t *i2c_dev);
1503
1518 ALT_STATUS_CODE alt_i2c_general_call_ack_enable(ALT_I2C_DEV_t *i2c_dev);
1519
1534 ALT_STATUS_CODE alt_i2c_general_call_ack_is_enabled(ALT_I2C_DEV_t *i2c_dev);
1535
1538/******************************************************************************/
1592 ALT_STATUS_CODE alt_i2c_int_status_get(ALT_I2C_DEV_t *i2c_dev,
1593 uint32_t *status);
1594
1617 ALT_STATUS_CODE alt_i2c_int_raw_status_get(ALT_I2C_DEV_t *i2c_dev,
1618 uint32_t *status);
1619
1641 ALT_STATUS_CODE alt_i2c_int_clear(ALT_I2C_DEV_t *i2c_dev, const uint32_t mask);
1642
1670 ALT_STATUS_CODE alt_i2c_int_disable(ALT_I2C_DEV_t *i2c_dev, const uint32_t mask);
1671
1699 ALT_STATUS_CODE alt_i2c_int_enable(ALT_I2C_DEV_t *i2c_dev, const uint32_t mask);
1700
1724 ALT_STATUS_CODE alt_i2c_tx_abort_cause_get(ALT_I2C_DEV_t *i2c_dev,
1725 ALT_I2C_TX_ABORT_CAUSE_t *cause);
1726
1729/******************************************************************************/
1747#define ALT_I2C_RX_FIFO_NUM_ENTRIES 64
1748
1762 ALT_STATUS_CODE alt_i2c_rx_fifo_is_empty(ALT_I2C_DEV_t *i2c_dev);
1763
1777 ALT_STATUS_CODE alt_i2c_rx_fifo_is_full(ALT_I2C_DEV_t *i2c_dev);
1778
1795 ALT_STATUS_CODE alt_i2c_rx_fifo_level_get(ALT_I2C_DEV_t *i2c_dev,
1796 uint32_t *num_entries);
1797
1814 ALT_STATUS_CODE alt_i2c_rx_fifo_threshold_get(ALT_I2C_DEV_t *i2c_dev,
1815 uint8_t *threshold);
1816
1833 ALT_STATUS_CODE alt_i2c_rx_fifo_threshold_set(ALT_I2C_DEV_t *i2c_dev,
1834 const uint8_t threshold);
1835
1838/******************************************************************************/
1856#define ALT_I2C_TX_FIFO_NUM_ENTRIES 64
1857
1871 ALT_STATUS_CODE alt_i2c_tx_fifo_is_empty(ALT_I2C_DEV_t *i2c_dev);
1872
1886 ALT_STATUS_CODE alt_i2c_tx_fifo_is_full(ALT_I2C_DEV_t *i2c_dev);
1887
1904 ALT_STATUS_CODE alt_i2c_tx_fifo_level_get(ALT_I2C_DEV_t *i2c_dev,
1905 uint32_t *num_entries);
1906
1923 ALT_STATUS_CODE alt_i2c_tx_fifo_threshold_get(ALT_I2C_DEV_t *i2c_dev,
1924 uint8_t *threshold);
1925
1942 ALT_STATUS_CODE alt_i2c_tx_fifo_threshold_set(ALT_I2C_DEV_t *i2c_dev,
1943 const uint8_t threshold);
1944
1947/******************************************************************************/
1979 ALT_STATUS_CODE alt_i2c_rx_dma_threshold_get(ALT_I2C_DEV_t * i2c_dev, uint8_t * threshold);
1980
1993 ALT_STATUS_CODE alt_i2c_rx_dma_threshold_set(ALT_I2C_DEV_t * i2c_dev, uint8_t threshold);
1994
2007 ALT_STATUS_CODE alt_i2c_tx_dma_threshold_get(ALT_I2C_DEV_t * i2c_dev, uint8_t * threshold);
2008
2021 ALT_STATUS_CODE alt_i2c_tx_dma_threshold_set(ALT_I2C_DEV_t * i2c_dev, uint8_t threshold);
2022
2027#ifdef __cplusplus
2028}
2029#endif /* __cplusplus */
2030#endif /* __ALT_I2C_H__ */
alt_clock_manager.h
alt_rstmgr.h
alt_i2c_tx_dma_threshold_set
ALT_STATUS_CODE alt_i2c_tx_dma_threshold_set(ALT_I2C_DEV_t *i2c_dev, uint8_t threshold)
Definition: alt_i2c.c:1996
alt_i2c_rx_dma_threshold_set
ALT_STATUS_CODE alt_i2c_rx_dma_threshold_set(ALT_I2C_DEV_t *i2c_dev, uint8_t threshold)
Definition: alt_i2c.c:1968
alt_i2c_rx_dma_threshold_get
ALT_STATUS_CODE alt_i2c_rx_dma_threshold_get(ALT_I2C_DEV_t *i2c_dev, uint8_t *threshold)
Definition: alt_i2c.c:1957
alt_i2c_tx_dma_threshold_get
ALT_STATUS_CODE alt_i2c_tx_dma_threshold_get(ALT_I2C_DEV_t *i2c_dev, uint8_t *threshold)
Definition: alt_i2c.c:1985
alt_i2c_general_call_ack_enable
ALT_STATUS_CODE alt_i2c_general_call_ack_enable(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:1528
alt_i2c_general_call_ack_disable
ALT_STATUS_CODE alt_i2c_general_call_ack_disable(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:1490
alt_i2c_general_call_ack_is_enabled
ALT_STATUS_CODE alt_i2c_general_call_ack_is_enabled(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:1566
alt_i2c_master_general_call
ALT_STATUS_CODE alt_i2c_master_general_call(ALT_I2C_DEV_t *i2c_dev, const void *data, const size_t size, const bool issue_restart, const bool issue_stop)
Definition: alt_i2c.c:1456
alt_i2c_int_raw_status_get
ALT_STATUS_CODE alt_i2c_int_raw_status_get(ALT_I2C_DEV_t *i2c_dev, uint32_t *status)
Definition: alt_i2c.c:1607
alt_i2c_int_status_get
ALT_STATUS_CODE alt_i2c_int_status_get(ALT_I2C_DEV_t *i2c_dev, uint32_t *status)
Definition: alt_i2c.c:1590
alt_i2c_int_enable
ALT_STATUS_CODE alt_i2c_int_enable(ALT_I2C_DEV_t *i2c_dev, const uint32_t mask)
Definition: alt_i2c.c:1703
alt_i2c_tx_abort_cause_get
ALT_STATUS_CODE alt_i2c_tx_abort_cause_get(ALT_I2C_DEV_t *i2c_dev, ALT_I2C_TX_ABORT_CAUSE_t *cause)
Definition: alt_i2c.c:1720
alt_i2c_int_clear
ALT_STATUS_CODE alt_i2c_int_clear(ALT_I2C_DEV_t *i2c_dev, const uint32_t mask)
Definition: alt_i2c.c:1624
alt_i2c_int_disable
ALT_STATUS_CODE alt_i2c_int_disable(ALT_I2C_DEV_t *i2c_dev, const uint32_t mask)
Definition: alt_i2c.c:1687
alt_i2c_rx_fifo_threshold_set
ALT_STATUS_CODE alt_i2c_rx_fifo_threshold_set(ALT_I2C_DEV_t *i2c_dev, const uint8_t threshold)
Definition: alt_i2c.c:1810
alt_i2c_rx_fifo_level_get
ALT_STATUS_CODE alt_i2c_rx_fifo_level_get(ALT_I2C_DEV_t *i2c_dev, uint32_t *num_entries)
Definition: alt_i2c.c:1778
alt_i2c_rx_fifo_threshold_get
ALT_STATUS_CODE alt_i2c_rx_fifo_threshold_get(ALT_I2C_DEV_t *i2c_dev, uint8_t *threshold)
Definition: alt_i2c.c:1794
alt_i2c_rx_fifo_is_full
ALT_STATUS_CODE alt_i2c_rx_fifo_is_full(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:1758
alt_i2c_rx_fifo_is_empty
ALT_STATUS_CODE alt_i2c_rx_fifo_is_empty(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:1738
alt_i2c_sda_hold_time_get
ALT_STATUS_CODE alt_i2c_sda_hold_time_get(ALT_I2C_DEV_t *i2c_dev, uint16_t *hold_time)
Definition: alt_i2c.c:626
alt_i2c_sda_hold_time_set
ALT_STATUS_CODE alt_i2c_sda_hold_time_set(ALT_I2C_DEV_t *i2c_dev, const uint16_t hold_time)
Definition: alt_i2c.c:643
alt_i2c_tx_fifo_threshold_set
ALT_STATUS_CODE alt_i2c_tx_fifo_threshold_set(ALT_I2C_DEV_t *i2c_dev, const uint8_t threshold)
Definition: alt_i2c.c:1920
alt_i2c_tx_fifo_is_full
ALT_STATUS_CODE alt_i2c_tx_fifo_is_full(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:1868
alt_i2c_tx_fifo_level_get
ALT_STATUS_CODE alt_i2c_tx_fifo_level_get(ALT_I2C_DEV_t *i2c_dev, uint32_t *num_entries)
Definition: alt_i2c.c:1888
alt_i2c_tx_fifo_is_empty
ALT_STATUS_CODE alt_i2c_tx_fifo_is_empty(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:1848
alt_i2c_tx_fifo_threshold_get
ALT_STATUS_CODE alt_i2c_tx_fifo_threshold_get(ALT_I2C_DEV_t *i2c_dev, uint8_t *threshold)
Definition: alt_i2c.c:1904
ALT_I2C_CTLR_e
ALT_I2C_CTLR_e
Definition: alt_i2c.h:135
alt_i2c_slave_bulk_transmit
ALT_STATUS_CODE alt_i2c_slave_bulk_transmit(ALT_I2C_DEV_t *i2c_dev, const void *data, const size_t size)
Definition: alt_i2c.c:859
alt_i2c_master_transmit
ALT_STATUS_CODE alt_i2c_master_transmit(ALT_I2C_DEV_t *i2c_dev, const void *data, const size_t size, const bool issue_restart, const bool issue_stop)
Definition: alt_i2c.c:1048
ALT_I2C_STATUS_e
ALT_I2C_STATUS_e
Definition: alt_i2c.h:196
alt_i2c_write
ALT_STATUS_CODE alt_i2c_write(ALT_I2C_DEV_t *i2c_dev, const uint8_t val)
Definition: alt_i2c.c:803
ALT_I2C_MODE_t
enum ALT_I2C_MODE_e ALT_I2C_MODE_t
alt_i2c_issue_write
ALT_STATUS_CODE alt_i2c_issue_write(ALT_I2C_DEV_t *i2c_dev, const uint8_t value, const bool issue_restart, const bool issue_stop)
Definition: alt_i2c.c:1382
alt_i2c_slave_config_get
ALT_STATUS_CODE alt_i2c_slave_config_get(ALT_I2C_DEV_t *i2c_dev, ALT_I2C_SLAVE_CONFIG_t *cfg)
Definition: alt_i2c.c:545
alt_i2c_slave_transmit
ALT_STATUS_CODE alt_i2c_slave_transmit(ALT_I2C_DEV_t *i2c_dev, const uint8_t data)
Definition: alt_i2c.c:848
ALT_I2C_TX_ABORT_CAUSE_t
enum ALT_I2C_TX_ABORT_CAUSE_e ALT_I2C_TX_ABORT_CAUSE_t
ALT_I2C_TX_ABORT_CAUSE_e
ALT_I2C_TX_ABORT_CAUSE_e
Definition: alt_i2c.h:354
alt_i2c_master_config_get
ALT_STATUS_CODE alt_i2c_master_config_get(ALT_I2C_DEV_t *i2c_dev, ALT_I2C_MASTER_CONFIG_t *cfg)
Definition: alt_i2c.c:379
alt_i2c_op_mode_get
ALT_STATUS_CODE alt_i2c_op_mode_get(ALT_I2C_DEV_t *i2c_dev, ALT_I2C_MODE_t *mode)
Definition: alt_i2c.c:681
ALT_I2C_STATUS_t
enum ALT_I2C_STATUS_e ALT_I2C_STATUS_t
alt_i2c_read
ALT_STATUS_CODE alt_i2c_read(ALT_I2C_DEV_t *i2c_dev, uint8_t *val)
Definition: alt_i2c.c:783
alt_i2c_is_busy
ALT_STATUS_CODE alt_i2c_is_busy(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:763
alt_i2c_enable
ALT_STATUS_CODE alt_i2c_enable(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:298
alt_i2c_init
ALT_STATUS_CODE alt_i2c_init(const ALT_I2C_CTLR_t i2c, ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:176
ALT_I2C_TRANSFER_TYPE_t
enum ALT_I2C_TRANSFER_TYPE_e ALT_I2C_TRANSFER_TYPE_t
alt_i2c_is_enabled
ALT_STATUS_CODE alt_i2c_is_enabled(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:366
ALT_I2C_SPEED_t
enum ALT_I2C_SPEED_e ALT_I2C_SPEED_t
ALT_I2C_ADDR_MODE_t
enum ALT_I2C_ADDR_MODE_e ALT_I2C_ADDR_MODE_t
alt_i2c_master_target_set
ALT_STATUS_CODE alt_i2c_master_target_set(ALT_I2C_DEV_t *i2c_dev, uint32_t target_addr)
Definition: alt_i2c.c:899
alt_i2c_master_config_speed_get
ALT_STATUS_CODE alt_i2c_master_config_speed_get(ALT_I2C_DEV_t *i2c_dev, const ALT_I2C_MASTER_CONFIG_t *cfg, uint32_t *speed_in_hz)
Definition: alt_i2c.c:480
ALT_I2C_ADDR_MODE_e
ALT_I2C_ADDR_MODE_e
Definition: alt_i2c.h:185
alt_i2c_master_target_get
ALT_STATUS_CODE alt_i2c_master_target_get(ALT_I2C_DEV_t *i2c_dev, uint32_t *target_addr)
Definition: alt_i2c.c:887
ALT_I2C_MASTER_CONFIG_t
struct ALT_I2C_MASTER_CONFIG_s ALT_I2C_MASTER_CONFIG_t
alt_i2c_slave_receive
ALT_STATUS_CODE alt_i2c_slave_receive(ALT_I2C_DEV_t *i2c_dev, uint8_t *data)
Definition: alt_i2c.c:825
alt_i2c_master_receive
ALT_STATUS_CODE alt_i2c_master_receive(ALT_I2C_DEV_t *i2c_dev, void *data, const size_t size, const bool issue_restart, const bool issue_stop)
Definition: alt_i2c.c:1226
ALT_I2C_TRANSFER_TYPE_e
ALT_I2C_TRANSFER_TYPE_e
Definition: alt_i2c.h:102
alt_i2c_master_config_speed_set
ALT_STATUS_CODE alt_i2c_master_config_speed_set(ALT_I2C_DEV_t *i2c_dev, ALT_I2C_MASTER_CONFIG_t *cfg, uint32_t speed_in_hz)
Definition: alt_i2c.c:504
ALT_I2C_MODE_e
ALT_I2C_MODE_e
Definition: alt_i2c.h:150
alt_i2c_disable
ALT_STATUS_CODE alt_i2c_disable(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:317
alt_i2c_issue_read
ALT_STATUS_CODE alt_i2c_issue_read(ALT_I2C_DEV_t *i2c_dev, const bool issue_restart, const bool issue_stop)
Definition: alt_i2c.c:1419
ALT_I2C_SPEED_e
ALT_I2C_SPEED_e
Definition: alt_i2c.h:169
ALT_I2C_CTLR_t
enum ALT_I2C_CTLR_e ALT_I2C_CTLR_t
alt_i2c_master_config_set
ALT_STATUS_CODE alt_i2c_master_config_set(ALT_I2C_DEV_t *i2c_dev, const ALT_I2C_MASTER_CONFIG_t *cfg)
Definition: alt_i2c.c:407
alt_i2c_uninit
ALT_STATUS_CODE alt_i2c_uninit(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:271
alt_i2c_reset
ALT_STATUS_CODE alt_i2c_reset(ALT_I2C_DEV_t *i2c_dev)
Definition: alt_i2c.c:213
ALT_I2C_SLAVE_CONFIG_t
struct ALT_I2C_SLAVE_CONFIG_s ALT_I2C_SLAVE_CONFIG_t
alt_i2c_slave_config_set
ALT_STATUS_CODE alt_i2c_slave_config_set(ALT_I2C_DEV_t *i2c_dev, const ALT_I2C_SLAVE_CONFIG_t *cfg)
Definition: alt_i2c.c:567
alt_i2c_op_mode_set
ALT_STATUS_CODE alt_i2c_op_mode_set(ALT_I2C_DEV_t *i2c_dev, const ALT_I2C_MODE_t mode)
Definition: alt_i2c.c:708
ALT_I2C_I2C2
@ ALT_I2C_I2C2
Definition: alt_i2c.h:138
ALT_I2C_I2C1
@ ALT_I2C_I2C1
Definition: alt_i2c.h:137
ALT_I2C_I2C0
@ ALT_I2C_I2C0
Definition: alt_i2c.h:136
ALT_I2C_I2C3
@ ALT_I2C_I2C3
Definition: alt_i2c.h:139
ALT_I2C_STATUS_ACTIVITY
@ ALT_I2C_STATUS_ACTIVITY
Definition: alt_i2c.h:292
ALT_I2C_STATUS_START_DET
@ ALT_I2C_STATUS_START_DET
Definition: alt_i2c.h:315
ALT_I2C_STATUS_TX_ABORT
@ ALT_I2C_STATUS_TX_ABORT
Definition: alt_i2c.h:264
ALT_I2C_STATUS_RX_OVER
@ ALT_I2C_STATUS_RX_OVER
Definition: alt_i2c.h:205
ALT_I2C_STATUS_TX_OVER
@ ALT_I2C_STATUS_TX_OVER
Definition: alt_i2c.h:227
ALT_I2C_STATUS_TX_EMPTY
@ ALT_I2C_STATUS_TX_EMPTY
Definition: alt_i2c.h:236
ALT_I2C_STATUS_RX_UNDER
@ ALT_I2C_STATUS_RX_UNDER
Definition: alt_i2c.h:197
ALT_I2C_STATUS_RX_DONE
@ ALT_I2C_STATUS_RX_DONE
Definition: alt_i2c.h:284
ALT_I2C_STATUS_INT_CALL
@ ALT_I2C_STATUS_INT_CALL
Definition: alt_i2c.h:321
ALT_I2C_STATUS_INT_ALL
@ ALT_I2C_STATUS_INT_ALL
Definition: alt_i2c.h:330
ALT_I2C_STATUS_RD_REQ
@ ALT_I2C_STATUS_RD_REQ
Definition: alt_i2c.h:250
ALT_I2C_STATUS_STOP_DET
@ ALT_I2C_STATUS_STOP_DET
Definition: alt_i2c.h:309
ALT_I2C_STATUS_RX_FULL
@ ALT_I2C_STATUS_RX_FULL
Definition: alt_i2c.h:216
ALT_I2C_TX_ABORT_CAUSE_10ADDR2_NOACK
@ ALT_I2C_TX_ABORT_CAUSE_10ADDR2_NOACK
Definition: alt_i2c.h:373
ALT_I2C_TX_ABORT_CAUSE_MST_DIS
@ ALT_I2C_TX_ABORT_CAUSE_MST_DIS
Definition: alt_i2c.h:461
ALT_I2C_TX_ABORT_CAUSE_SLVRD_INTX
@ ALT_I2C_TX_ABORT_CAUSE_SLVRD_INTX
Definition: alt_i2c.h:503
ALT_I2C_TX_ABORT_CAUSE_GCALL_RD
@ ALT_I2C_TX_ABORT_CAUSE_GCALL_RD
Definition: alt_i2c.h:400
ALT_I2C_TX_ABORT_CAUSE_ARB_LOST
@ ALT_I2C_TX_ABORT_CAUSE_ARB_LOST
Definition: alt_i2c.h:468
ALT_I2C_TX_ABORT_CAUSE_HS_NORSTRT
@ ALT_I2C_TX_ABORT_CAUSE_HS_NORSTRT
Definition: alt_i2c.h:423
ALT_I2C_TX_ABORT_CAUSE_TXDATA_NOACK
@ ALT_I2C_TX_ABORT_CAUSE_TXDATA_NOACK
Definition: alt_i2c.h:382
ALT_I2C_TX_ABORT_CAUSE_HS_ACKDET
@ ALT_I2C_TX_ABORT_CAUSE_HS_ACKDET
Definition: alt_i2c.h:409
ALT_I2C_TX_ABORT_CAUSE_SLV_ARBLOST
@ ALT_I2C_TX_ABORT_CAUSE_SLV_ARBLOST
Definition: alt_i2c.h:487
ALT_I2C_TX_ABORT_CAUSE_10ADDR1_NOACK
@ ALT_I2C_TX_ABORT_CAUSE_10ADDR1_NOACK
Definition: alt_i2c.h:364
ALT_I2C_TX_ABORT_CAUSE_SBYTE_NORSTRT
@ ALT_I2C_TX_ABORT_CAUSE_SBYTE_NORSTRT
Definition: alt_i2c.h:433
ALT_I2C_TX_ABORT_CAUSE_SBYTE_ACKDET
@ ALT_I2C_TX_ABORT_CAUSE_SBYTE_ACKDET
Definition: alt_i2c.h:416
ALT_I2C_TX_ABORT_CAUSE_SLVFLUSH_TXFIFO
@ ALT_I2C_TX_ABORT_CAUSE_SLVFLUSH_TXFIFO
Definition: alt_i2c.h:478
ALT_I2C_TX_ABORT_CAUSE_7B_ADDR_NOACK
@ ALT_I2C_TX_ABORT_CAUSE_7B_ADDR_NOACK
Definition: alt_i2c.h:355
ALT_I2C_TX_ABORT_CAUSE_GCALL_NOACK
@ ALT_I2C_TX_ABORT_CAUSE_GCALL_NOACK
Definition: alt_i2c.h:392
ALT_I2C_TX_ABORT_CAUSE_10B_RD_NORSTRT
@ ALT_I2C_TX_ABORT_CAUSE_10B_RD_NORSTRT
Definition: alt_i2c.h:453
ALT_I2C_ADDR_MODE_10_BIT
@ ALT_I2C_ADDR_MODE_10_BIT
Definition: alt_i2c.h:188
ALT_I2C_ADDR_MODE_7_BIT
@ ALT_I2C_ADDR_MODE_7_BIT
Definition: alt_i2c.h:186
ALT_I2C_TRANSFER_READ
@ ALT_I2C_TRANSFER_READ
Definition: alt_i2c.h:106
ALT_I2C_TRANSFER_NONE
@ ALT_I2C_TRANSFER_NONE
Definition: alt_i2c.h:103
ALT_I2C_TRANSFER_WRITE
@ ALT_I2C_TRANSFER_WRITE
Definition: alt_i2c.h:107
ALT_I2C_TRANSFER_COMPLETE
@ ALT_I2C_TRANSFER_COMPLETE
Definition: alt_i2c.h:105
ALT_I2C_TRANSFER_START
@ ALT_I2C_TRANSFER_START
Definition: alt_i2c.h:104
ALT_I2C_MODE_SLAVE
@ ALT_I2C_MODE_SLAVE
Definition: alt_i2c.h:151
ALT_I2C_MODE_MASTER
@ ALT_I2C_MODE_MASTER
Definition: alt_i2c.h:152
ALT_I2C_SPEED_FAST
@ ALT_I2C_SPEED_FAST
Definition: alt_i2c.h:172
ALT_I2C_SPEED_STANDARD
@ ALT_I2C_SPEED_STANDARD
Definition: alt_i2c.h:170
alt_freq_t
uint32_t alt_freq_t
Definition: alt_clock_manager.h:66
hps.h
hwlib.h
ALT_STATUS_CODE
int32_t ALT_STATUS_CODE
Definition: hwlib.h:60
alt_i2c.h
socal.h
ALT_I2C_DEV_s
Definition: alt_i2c.h:124
ALT_I2C_DEV_s::last_target
uint32_t last_target
Definition: alt_i2c.h:127
ALT_I2C_DEV_s::location
void * location
Definition: alt_i2c.h:125
ALT_I2C_DEV_s::clock_freq
alt_freq_t clock_freq
Definition: alt_i2c.h:126
ALT_I2C_MASTER_CONFIG_s
Definition: alt_i2c.h:528
ALT_I2C_MASTER_CONFIG_s::ss_scl_hcnt
uint16_t ss_scl_hcnt
Definition: alt_i2c.h:551
ALT_I2C_MASTER_CONFIG_s::ss_scl_lcnt
uint16_t ss_scl_lcnt
Definition: alt_i2c.h:555
ALT_I2C_MASTER_CONFIG_s::speed_mode
ALT_I2C_SPEED_t speed_mode
Definition: alt_i2c.h:548
ALT_I2C_MASTER_CONFIG_s::fs_scl_hcnt
uint16_t fs_scl_hcnt
Definition: alt_i2c.h:559
ALT_I2C_MASTER_CONFIG_s::addr_mode
ALT_I2C_ADDR_MODE_t addr_mode
Definition: alt_i2c.h:529
ALT_I2C_MASTER_CONFIG_s::fs_spklen
uint8_t fs_spklen
Definition: alt_i2c.h:567
ALT_I2C_MASTER_CONFIG_s::restart_enable
bool restart_enable
Definition: alt_i2c.h:533
ALT_I2C_MASTER_CONFIG_s::fs_scl_lcnt
uint16_t fs_scl_lcnt
Definition: alt_i2c.h:563
ALT_I2C_SLAVE_CONFIG_s
Definition: alt_i2c.h:580
ALT_I2C_SLAVE_CONFIG_s::nack_enable
bool nack_enable
Definition: alt_i2c.h:588
ALT_I2C_SLAVE_CONFIG_s::addr_mode
ALT_I2C_ADDR_MODE_t addr_mode
Definition: alt_i2c.h:581
ALT_I2C_SLAVE_CONFIG_s::addr
uint32_t addr
Definition: alt_i2c.h:584
i2c_dev
I2C slave device control.
Definition: i2c.h:292
i2c
Definition: 8xx_immap.h:216