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@246tNt.com>
Change-Id: If2ca8efff37cb8fd1f1841656537ea8ad11ef55c
This commit is contained in:
Sylvain Munaut 2022-01-10 12:22:41 +01:00
parent 5e3fbfe217
commit ab75c94cce
2 changed files with 8 additions and 5 deletions

View File

@ -290,11 +290,11 @@ e1_init(int port, uint16_t rx_cr, uint16_t tx_cr)
}
#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 @@ e1_tx_config(int port, uint16_t cr)
}
#define RXCR_PERMITTED ( \
E1_RX_CR_MODE_MFA )
E1_RX_CR_MODE_MASK )
void
e1_rx_config(int port, uint16_t cr)

View File

@ -27,6 +27,7 @@ struct e1_core {
#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 @@ struct e1_core {
#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 */