laforge has submitted this change. (
https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26847
)
Change subject: icE1usb fw: Add _MASK version for multibit fields in config regs
......................................................................
icE1usb fw: Add _MASK version for multibit fields in config regs
This is a bit cleaner when masking in/out those rather than using
the specific vaue that has all bits set.
Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com>
Change-Id: If2ca8efff37cb8fd1f1841656537ea8ad11ef55c
---
M firmware/ice40-riscv/icE1usb/e1.c
M firmware/ice40-riscv/icE1usb/e1_hw.h
2 files changed, 8 insertions(+), 5 deletions(-)
Approvals:
laforge: Looks good to me, approved; Verified
diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c
index af59f14..a9feea0 100644
--- a/firmware/ice40-riscv/icE1usb/e1.c
+++ b/firmware/ice40-riscv/icE1usb/e1.c
@@ -290,11 +290,11 @@
}
#define TXCR_PERMITTED ( \
- E1_TX_CR_MODE_TS0_CRC_E | \
- E1_TX_CR_TICK_REMOTE | \
- E1_TX_CR_ALARM | \
+ E1_TX_CR_MODE_MASK | \
+ E1_TX_CR_TICK_MASK | \
+ E1_TX_CR_ALARM | \
E1_TX_CR_LOOPBACK | \
- E1_TX_CR_LOOPBACK_CROSS )
+ E1_TX_CR_LOOPBACK_CROSS )
void
e1_tx_config(int port, uint16_t cr)
@@ -306,7 +306,7 @@
}
#define RXCR_PERMITTED ( \
- E1_RX_CR_MODE_MFA )
+ E1_RX_CR_MODE_MASK )
void
e1_rx_config(int port, uint16_t cr)
diff --git a/firmware/ice40-riscv/icE1usb/e1_hw.h b/firmware/ice40-riscv/icE1usb/e1_hw.h
index 9227cc7..73cbd88 100644
--- a/firmware/ice40-riscv/icE1usb/e1_hw.h
+++ b/firmware/ice40-riscv/icE1usb/e1_hw.h
@@ -27,6 +27,7 @@
#define E1_RX_CR_MODE_BYTE (1 << 1) /* Request byte-level alignment */
#define E1_RX_CR_MODE_BFA (2 << 1) /* Request Basic Frame Alignment */
#define E1_RX_CR_MODE_MFA (3 << 1) /* Request Multi-Frame Alignment */
+#define E1_RX_CR_MODE_MASK (3 << 1)
#define E1_RX_CR_OVFL_CLR (1 << 12) /* Clear Rx overflow condition */
/* E1 receiver status register */
@@ -44,8 +45,10 @@
#define E1_TX_CR_MODE_TS0 (1 << 1) /* Generate TS0 in framer */
#define E1_TX_CR_MODE_TS0_CRC (2 << 1) /* Generate TS0 + CRC4 in framer */
#define E1_TX_CR_MODE_TS0_CRC_E (3 << 1) /* Generate TS0 + CRC4 + E-bits (based on
Rx) in framer */
+#define E1_TX_CR_MODE_MASK (3 << 1)
#define E1_TX_CR_TICK_LOCAL (0 << 3) /* use local clock for Tx */
#define E1_TX_CR_TICK_REMOTE (1 << 3) /* use recovered remote clock for Tx */
+#define E1_TX_CR_TICK_MASK (1 << 3)
#define E1_TX_CR_ALARM (1 << 4) /* indicate ALARM to remote */
#define E1_TX_CR_LOOPBACK (1 << 5) /* external loopback enable/diasble */
#define E1_TX_CR_LOOPBACK_CROSS (1 << 6) /* source of loopback: local (0) or other
(1) port */
--
To view, visit
https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26847
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1-hardware
Gerrit-Branch: master
Gerrit-Change-Id: If2ca8efff37cb8fd1f1841656537ea8ad11ef55c
Gerrit-Change-Number: 26847
Gerrit-PatchSet: 1
Gerrit-Owner: tnt <tnt(a)246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged