From 62d467f3fc024f6a43abca9c3a2b194b5d3829bf Mon Sep 17 00:00:00 2001 From: Lane Kolbly Date: Thu, 14 Oct 2021 13:15:48 -0500 Subject: host: gpio: Create gpio_atr_offsets to store GPIO registers Refactors register addresses into a gpio_atr_offsets structure which contains the various register addresses. This allows creating other devices with different GPIO register layouts with greater ease, and eliminates the use of macros (yay!) --- host/lib/usrp/b200/b200_impl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp/b200') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 2e2ed5a98..ed685d536 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -749,7 +749,8 @@ b200_impl::b200_impl( // front panel gpio //////////////////////////////////////////////////////////////////// _radio_perifs[0].fp_gpio = - gpio_atr_3000::make(_radio_perifs[0].ctrl, TOREG(SR_FP_GPIO), RB32_FP_GPIO); + gpio_atr_3000::make(_radio_perifs[0].ctrl, + gpio_atr_offsets::make_default(TOREG(SR_FP_GPIO), RB32_FP_GPIO)); for (const auto& attr : gpio_attr_map) { switch (attr.first) { case usrp::gpio_atr::GPIO_SRC: @@ -883,7 +884,7 @@ void b200_impl::setup_radio(const size_t dspno) //////////////////////////////////////////////////////////////////// // Set up peripherals //////////////////////////////////////////////////////////////////// - perif.atr = gpio_atr_3000::make_write_only(perif.ctrl, TOREG(SR_ATR)); + perif.atr = gpio_atr_3000::make(perif.ctrl, gpio_atr_offsets::make_write_only(TOREG(SR_ATR))); perif.atr->set_atr_mode(MODE_ATR, 0xFFFFFFFF); // create rx dsp control objects perif.framer = rx_vita_core_3000::make(perif.ctrl, TOREG(SR_RX_CTRL)); -- cgit v1.2.3