RV32 SoC DS UG
High-Perf RV32 SoC DS UG
RV64 SoC DS UG API and Examples
Embedded IDE UG
Loading...
Searching...
No Matches
Register Definitions

Overview

Register bitmasks and offsets.

I2C Mode Control Register Bitmasks

#define I2C_MODE_CPOL   (1 << 0)
 I2C Clock Polarity Mask.
#define I2C_MODE_CPHA   (1 << 1)
 I2C Clock Phase Mask.

I2C TX/RX and Status Register Bitmasks

#define I2C_TX_VALUE   (0xFF)
 Mask for TX value.
#define I2C_TX_VALID   (1 << 8)
 Mask for TX valid bit.
#define I2C_TX_ENABLE   (1 << 9)
 Mask for Enable TX.
#define I2C_TX_REPEAT   (1 << 10)
 Mask for Repeat TX.
#define I2C_TX_DISABLE_ON_DATA_CONFLICT   (1 << 11)
 Mask for Disable TX on data conflict.
#define I2C_RX_VALUE   (0xFF)
 Mask for RX value.
#define I2C_RX_VALID   (1 << 8)
 Mask for RX valid bit.
#define I2C_RX_LISTEN   (1 << 9)
 Mask for RX listen mode.

I2C Master/Slave Status Register Bitmasks

#define I2C_MASTER_BUSY   (1 << 0)
 Mask for Master Busy.
#define I2C_MASTER_START   (1 << 4)
 Mask for Master Start.
#define I2C_MASTER_STOP   (1 << 5)
 Mask for Master Stop.
#define I2C_MASTER_DROP   (1 << 6)
 Mask for Master Drop.
#define I2C_MASTER_RECOVER   (1 << 7)
 Mask for Master Recover.
#define I2C_MASTER_START_DROPPED   (1 << 9)
 Mask for Master Start Dropped.
#define I2C_MASTER_STOP_DROPPED   (1 << 10)
 Mask for Master Stop Dropped.
#define I2C_MASTER_RECOVER_DROPPED   (1 << 11)
 Mask for Master Recover Dropped.
#define I2C_SLAVE_STATUS_IN_FRAME   (1 << 0)
 Mask for the transaction is in progress.
#define I2C_SLAVE_STATUS_SDA   (1 << 1)
 Mask for Slave's current state of SDA Line.
#define I2C_SLAVE_STATUS_SCL   (1 << 2)
 Mask for Slave's current state of SCL Line.
#define I2C_SLAVE_OVERRIDE_SDA   (1 << 1)
 Mask for Force Slave SDA line.
#define I2C_SLAVE_OVERRIDE_SCL   (1 << 2)
 Mask for Force Slave SCL line.

I2C Filter Configuration Bitmasks

#define I2C_FILTER_7_BITS   (0)
 Filter setting for 7 bits.
#define I2C_FILTER_10_BITS   (1 << 14)
 Filter setting for 10 bits.
#define I2C_FILTER_ENABLE   (1 << 15)
 Filter Enable.

I2C Read/Write Definitions

#define I2C_READ   0x01
 Indicate Read Transcation.
#define I2C_WRITE   0x00
 Indicate Write Transcation.

I2C TX and Check Macro

#define TX_AND_CHECK(inst, byte)
 Transmits a single byte over the I2C bus and waits for an ACK response.

Macro Definition Documentation

◆ I2C_FILTER_10_BITS

#define I2C_FILTER_10_BITS   (1 << 14)

#include <i2c.h>

Filter setting for 10 bits.

Definition at line 121 of file i2c.h.

◆ I2C_FILTER_7_BITS

#define I2C_FILTER_7_BITS   (0)

#include <i2c.h>

Filter setting for 7 bits.

Definition at line 120 of file i2c.h.

◆ I2C_FILTER_ENABLE

#define I2C_FILTER_ENABLE   (1 << 15)

#include <i2c.h>

Filter Enable.

Definition at line 122 of file i2c.h.

◆ I2C_MASTER_BUSY

#define I2C_MASTER_BUSY   (1 << 0)

#include <i2c.h>

Mask for Master Busy.

Definition at line 102 of file i2c.h.

◆ I2C_MASTER_DROP

#define I2C_MASTER_DROP   (1 << 6)

#include <i2c.h>

Mask for Master Drop.

Definition at line 105 of file i2c.h.

◆ I2C_MASTER_RECOVER

#define I2C_MASTER_RECOVER   (1 << 7)

#include <i2c.h>

Mask for Master Recover.

Definition at line 106 of file i2c.h.

◆ I2C_MASTER_RECOVER_DROPPED

#define I2C_MASTER_RECOVER_DROPPED   (1 << 11)

#include <i2c.h>

Mask for Master Recover Dropped.

Definition at line 109 of file i2c.h.

◆ I2C_MASTER_START

#define I2C_MASTER_START   (1 << 4)

#include <i2c.h>

Mask for Master Start.

Definition at line 103 of file i2c.h.

◆ I2C_MASTER_START_DROPPED

#define I2C_MASTER_START_DROPPED   (1 << 9)

#include <i2c.h>

Mask for Master Start Dropped.

Definition at line 107 of file i2c.h.

◆ I2C_MASTER_STOP

#define I2C_MASTER_STOP   (1 << 5)

#include <i2c.h>

Mask for Master Stop.

Definition at line 104 of file i2c.h.

◆ I2C_MASTER_STOP_DROPPED

#define I2C_MASTER_STOP_DROPPED   (1 << 10)

#include <i2c.h>

Mask for Master Stop Dropped.

Definition at line 108 of file i2c.h.

◆ I2C_MODE_CPHA

#define I2C_MODE_CPHA   (1 << 1)

#include <i2c.h>

I2C Clock Phase Mask.

Definition at line 83 of file i2c.h.

◆ I2C_MODE_CPOL

#define I2C_MODE_CPOL   (1 << 0)

#include <i2c.h>

I2C Clock Polarity Mask.

Definition at line 82 of file i2c.h.

◆ I2C_READ

#define I2C_READ   0x01

#include <i2c.h>

Indicate Read Transcation.

Definition at line 128 of file i2c.h.

◆ I2C_RX_LISTEN

#define I2C_RX_LISTEN   (1 << 9)

#include <i2c.h>

Mask for RX listen mode.

Definition at line 96 of file i2c.h.

◆ I2C_RX_VALID

#define I2C_RX_VALID   (1 << 8)

#include <i2c.h>

Mask for RX valid bit.

Definition at line 95 of file i2c.h.

◆ I2C_RX_VALUE

#define I2C_RX_VALUE   (0xFF)

#include <i2c.h>

Mask for RX value.

Definition at line 94 of file i2c.h.

◆ I2C_SLAVE_OVERRIDE_SCL

#define I2C_SLAVE_OVERRIDE_SCL   (1 << 2)

#include <i2c.h>

Mask for Force Slave SCL line.

Definition at line 114 of file i2c.h.

◆ I2C_SLAVE_OVERRIDE_SDA

#define I2C_SLAVE_OVERRIDE_SDA   (1 << 1)

#include <i2c.h>

Mask for Force Slave SDA line.

Definition at line 113 of file i2c.h.

◆ I2C_SLAVE_STATUS_IN_FRAME

#define I2C_SLAVE_STATUS_IN_FRAME   (1 << 0)

#include <i2c.h>

Mask for the transaction is in progress.

Definition at line 110 of file i2c.h.

◆ I2C_SLAVE_STATUS_SCL

#define I2C_SLAVE_STATUS_SCL   (1 << 2)

#include <i2c.h>

Mask for Slave's current state of SCL Line.

Definition at line 112 of file i2c.h.

◆ I2C_SLAVE_STATUS_SDA

#define I2C_SLAVE_STATUS_SDA   (1 << 1)

#include <i2c.h>

Mask for Slave's current state of SDA Line.

Definition at line 111 of file i2c.h.

◆ I2C_TX_DISABLE_ON_DATA_CONFLICT

#define I2C_TX_DISABLE_ON_DATA_CONFLICT   (1 << 11)

#include <i2c.h>

Mask for Disable TX on data conflict.

Definition at line 93 of file i2c.h.

◆ I2C_TX_ENABLE

#define I2C_TX_ENABLE   (1 << 9)

#include <i2c.h>

Mask for Enable TX.

Definition at line 91 of file i2c.h.

◆ I2C_TX_REPEAT

#define I2C_TX_REPEAT   (1 << 10)

#include <i2c.h>

Mask for Repeat TX.

Definition at line 92 of file i2c.h.

◆ I2C_TX_VALID

#define I2C_TX_VALID   (1 << 8)

#include <i2c.h>

Mask for TX valid bit.

Definition at line 90 of file i2c.h.

◆ I2C_TX_VALUE

#define I2C_TX_VALUE   (0xFF)

#include <i2c.h>

Mask for TX value.

Definition at line 89 of file i2c.h.

◆ I2C_WRITE

#define I2C_WRITE   0x00

#include <i2c.h>

Indicate Write Transcation.

Definition at line 129 of file i2c.h.

◆ TX_AND_CHECK

#define TX_AND_CHECK ( inst,
byte )

#include <i2c.h>

Value:
do { \
i2c_sendTxByte(inst, (byte)); \
i2c_sendNackBlocking(inst); \
i2c_waitRxAck(inst); \
} while(0)

Transmits a single byte over the I2C bus and waits for an ACK response.

Parameters
instPointer to I2C instance.
byteThe byte to be transmitted. Holds the software registers and hardware pointer.
Note
This macro performs a single byte transmission as part of an I2C write transaction.
  • First, it sends the specified byte using the i2c_sendTxByte() function.
  • Followed byi2c_sendNackBlocking() to complete the 9-bit transfer cycle (8 data bits + 1 ACK/NACK).
  • It then calls i2c_waitRxAck() to wait until the ACK status is returned by the slave.
  • This ensures that the slave has successfully received and acknowledged the byte.
  • The macro is wrapped in a do { ... } while(0) construct to allow safe usage within conditional blocks or inline statements.

Definition at line 150 of file i2c.h.