10 #include "pattgen_regs.h"
26 ptrdiff_t clock_divisor_reg_offset;
27 ptrdiff_t seed_lower_reg_offset;
28 ptrdiff_t seed_upper_reg_offset;
32 #define DIF_PATTGEN_CHANNEL_CONFIG_CASE_(channel_) \
33 case kDifPattgenChannel##channel_: \
34 enable_bit_idx = PATTGEN_CTRL_ENABLE_CH##channel_##_BIT; \
35 polarity_bit_idx = PATTGEN_CTRL_POLARITY_CH##channel_##_BIT; \
36 inactive_level_pda_bit_idx = \
37 PATTGEN_CTRL_INACTIVE_LEVEL_PDA_CH##channel_##_BIT; \
38 inactive_level_pcl_bit_idx = \
39 PATTGEN_CTRL_INACTIVE_LEVEL_PCL_CH##channel_##_BIT; \
40 clock_divisor_reg_offset = PATTGEN_PREDIV_CH##channel_##_REG_OFFSET; \
41 seed_lower_reg_offset = PATTGEN_DATA_CH##channel_##_0_REG_OFFSET; \
42 seed_upper_reg_offset = PATTGEN_DATA_CH##channel_##_1_REG_OFFSET; \
43 seed_pattern_length_field = PATTGEN_SIZE_LEN_CH##channel_##_FIELD; \
44 num_pattern_repetitions_field = PATTGEN_SIZE_REPS_CH##channel_##_FIELD; \
52 #undef DIF_PATTGEN_CHANNEL_CONFIG_CASE_
55 mmio_region_read32(pattgen->
base_addr, PATTGEN_CTRL_REG_OFFSET);
68 mmio_region_write32(pattgen->
base_addr, PATTGEN_CTRL_REG_OFFSET, ctrl_reg);
71 mmio_region_write32(pattgen->
base_addr, clock_divisor_reg_offset,
75 mmio_region_write32(pattgen->
base_addr, seed_lower_reg_offset,
78 mmio_region_write32(pattgen->
base_addr, seed_upper_reg_offset,
84 mmio_region_read32(pattgen->
base_addr, PATTGEN_SIZE_REG_OFFSET);
89 mmio_region_write32(pattgen->
base_addr, PATTGEN_SIZE_REG_OFFSET, size_reg);
103 #define DIF_PATTGEN_CHANNEL_SET_ENABLED_CASE_(channel_) \
104 case kDifPattgenChannel##channel_: \
105 enable_bit_idx = PATTGEN_CTRL_ENABLE_CH##channel_##_BIT; \
113 #undef DIF_PATTGEN_CHANNEL_SET_ENABLED_CASE_
116 mmio_region_read32(pattgen->
base_addr, PATTGEN_CTRL_REG_OFFSET);
119 mmio_region_write32(pattgen->
base_addr, PATTGEN_CTRL_REG_OFFSET, ctrl_reg);
127 if (pattgen == NULL || is_enabled == NULL) {
133 #define DIF_PATTGEN_CHANNEL_SET_ENABLED_CASE_(channel_) \
134 case kDifPattgenChannel##channel_: \
135 enable_bit_idx = PATTGEN_CTRL_ENABLE_CH##channel_##_BIT; \
143 #undef DIF_PATTGEN_CHANNEL_SET_ENABLED_CASE_
146 mmio_region_read32(pattgen->
base_addr, PATTGEN_CTRL_REG_OFFSET);