diff options
author | Josh Blum <josh@joshknows.com> | 2011-03-15 19:18:32 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-03-15 19:18:32 -0700 |
commit | 2f12295f26f14b7403da68a864124f93154c3b0f (patch) | |
tree | 287dc3d6e65c80f0e597d754a023e7b8feaa9631 /host/lib/usrp/usrp2/usrp2_regs.cpp | |
parent | d47bc1e06c19e6abeb37595fe7e52f0be671115c (diff) | |
download | uhd-2f12295f26f14b7403da68a864124f93154c3b0f.tar.gz uhd-2f12295f26f14b7403da68a864124f93154c3b0f.tar.bz2 uhd-2f12295f26f14b7403da68a864124f93154c3b0f.zip |
usrp2: moved sregs in host code, simplfy reg struct a little
Diffstat (limited to 'host/lib/usrp/usrp2/usrp2_regs.cpp')
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_regs.cpp | 141 |
1 files changed, 80 insertions, 61 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_regs.cpp b/host/lib/usrp/usrp2/usrp2_regs.cpp index 66c3ac137..23b66087f 100644 --- a/host/lib/usrp/usrp2/usrp2_regs.cpp +++ b/host/lib/usrp/usrp2/usrp2_regs.cpp @@ -18,10 +18,43 @@ #include "usrp2_regs.hpp" #include "usrp2_iface.hpp" +//////////////////////////////////////////////////////////////////////// +// Setting register offsets +//////////////////////////////////////////////////////////////////////// +#define SR_MISC 0 // 7 regs +#define SR_SIMTIMER 8 // 2 +#define SR_TIME64 10 // 6 +#define SR_BUF_POOL 16 // 4 + +#define SR_RX_FRONT 24 // 5 +#define SR_RX_CTRL0 32 // 9 +#define SR_RX_DSP0 48 // 7 +#define SR_RX_CTRL1 80 // 9 +#define SR_RX_DSP1 96 // 7 + +#define SR_TX_FRONT 128 // ? +#define SR_TX_CTRL 144 // 6 +#define SR_TX_DSP 160 // 5 + +#define SR_UDP_SM 192 // 64 + int sr_addr(int misc_output_base, int sr) { - return misc_output_base + 4 * sr; + return misc_output_base + 4 * sr; } +//////////////////////////////////////////////////////////////////////// +// Slave bases +//////////////////////////////////////////////////////////////////////// +#define USRP2_MISC_OUTPUT_BASE 0xD400 +#define USRP2_GPIO_BASE 0xC800 +#define USRP2_ATR_BASE 0xE400 +#define USRP2_BP_STATUS_BASE 0xCC00 + +#define USRP2P_MISC_OUTPUT_BASE 0x5000 +#define USRP2P_GPIO_BASE 0x6200 +#define USRP2P_ATR_BASE 0x6800 +#define USRP2P_BP_STATUS_BASE 0x6300 + usrp2_regs_t usrp2_get_regs(bool use_n2xx_map) { //how about you just make this dependent on hw_rev instead of doing the init before main, and give up the const globals, since the application won't ever need both. @@ -31,20 +64,6 @@ usrp2_regs_t usrp2_get_regs(bool use_n2xx_map) { bp_base = (use_n2xx_map) ? USRP2P_BP_STATUS_BASE : USRP2_BP_STATUS_BASE; usrp2_regs_t x; - x.sr_misc = 0; - x.sr_tx_prot_eng = 32; - x.sr_rx_prot_eng = 48; - x.sr_buffer_pool_ctrl = 64; - x.sr_udp_sm = 96; - x.sr_tx_dsp = 208; - x.sr_tx_ctrl = 224; - x.sr_rx_dsp0 = 160; - x.sr_rx_ctrl0 = 176; - x.sr_rx_dsp1 = 240; - x.sr_rx_ctrl1 = 32; - x.sr_time64 = 192; - x.sr_simtimer = 198; - x.sr_last = 255; x.misc_ctrl_clock = sr_addr(misc_output_base, 0); x.misc_ctrl_serdes = sr_addr(misc_output_base, 1); x.misc_ctrl_adc = sr_addr(misc_output_base, 2); @@ -54,34 +73,34 @@ usrp2_regs_t usrp2_get_regs(bool use_n2xx_map) { x.misc_ctrl_ram_page = sr_addr(misc_output_base, 6); x.misc_ctrl_flush_icache = sr_addr(misc_output_base, 7); x.misc_ctrl_led_src = sr_addr(misc_output_base, 8); - x.time64_secs = sr_addr(misc_output_base, x.sr_time64 + 0); - x.time64_ticks = sr_addr(misc_output_base, x.sr_time64 + 1); - x.time64_flags = sr_addr(misc_output_base, x.sr_time64 + 2); - x.time64_imm = sr_addr(misc_output_base, x.sr_time64 + 3); - x.time64_tps = sr_addr(misc_output_base, x.sr_time64 + 4); - x.time64_mimo_sync = sr_addr(misc_output_base, x.sr_time64 + 5); + x.time64_secs = sr_addr(misc_output_base, SR_TIME64 + 0); + x.time64_ticks = sr_addr(misc_output_base, SR_TIME64 + 1); + x.time64_flags = sr_addr(misc_output_base, SR_TIME64 + 2); + x.time64_imm = sr_addr(misc_output_base, SR_TIME64 + 3); + x.time64_tps = sr_addr(misc_output_base, SR_TIME64 + 4); + x.time64_mimo_sync = sr_addr(misc_output_base, SR_TIME64 + 5); x.status = bp_base + 4*8; x.time64_secs_rb_imm = bp_base + 4*10; x.time64_ticks_rb_imm = bp_base + 4*11; x.compat_num_rb = bp_base + 4*12; x.time64_secs_rb_pps = bp_base + 4*14; x.time64_ticks_rb_pps = bp_base + 4*15; - x.dsp_tx_freq = sr_addr(misc_output_base, x.sr_tx_dsp + 0); - x.dsp_tx_scale_iq = sr_addr(misc_output_base, x.sr_tx_dsp + 1); - x.dsp_tx_interp_rate = sr_addr(misc_output_base, x.sr_tx_dsp + 2); - x.dsp_tx_mux = sr_addr(misc_output_base, x.sr_tx_dsp + 4); - x.dsp_rx[0].freq = sr_addr(misc_output_base, x.sr_rx_dsp0 + 0); - x.dsp_rx[0].scale_iq = sr_addr(misc_output_base, x.sr_rx_dsp0 + 1); - x.dsp_rx[0].decim_rate = sr_addr(misc_output_base, x.sr_rx_dsp0 + 2); - x.dsp_rx[0].dcoffset_i = sr_addr(misc_output_base, x.sr_rx_dsp0 + 3); - x.dsp_rx[0].dcoffset_q = sr_addr(misc_output_base, x.sr_rx_dsp0 + 4); - x.dsp_rx[0].mux = sr_addr(misc_output_base, x.sr_rx_dsp0 + 5); - x.dsp_rx[1].freq = sr_addr(misc_output_base, x.sr_rx_dsp1 + 0); - x.dsp_rx[1].scale_iq = sr_addr(misc_output_base, x.sr_rx_dsp1 + 1); - x.dsp_rx[1].decim_rate = sr_addr(misc_output_base, x.sr_rx_dsp1 + 2); - x.dsp_rx[1].dcoffset_i = sr_addr(misc_output_base, x.sr_rx_dsp1 + 3); - x.dsp_rx[1].dcoffset_q = sr_addr(misc_output_base, x.sr_rx_dsp1 + 4); - x.dsp_rx[1].mux = sr_addr(misc_output_base, x.sr_rx_dsp1 + 5); + x.dsp_tx_freq = sr_addr(misc_output_base, SR_TX_DSP + 0); + x.dsp_tx_scale_iq = sr_addr(misc_output_base, SR_TX_DSP + 1); + x.dsp_tx_interp_rate = sr_addr(misc_output_base, SR_TX_DSP + 2); + x.dsp_tx_mux = sr_addr(misc_output_base, SR_TX_DSP + 4); + x.dsp_rx[0].freq = sr_addr(misc_output_base, SR_RX_DSP0 + 0); + x.dsp_rx[0].scale_iq = sr_addr(misc_output_base, SR_RX_DSP0 + 1); + x.dsp_rx[0].decim_rate = sr_addr(misc_output_base, SR_RX_DSP0 + 2); + x.dsp_rx[0].dcoffset_i = sr_addr(misc_output_base, SR_RX_DSP0 + 3); + x.dsp_rx[0].dcoffset_q = sr_addr(misc_output_base, SR_RX_DSP0 + 4); + x.dsp_rx[0].mux = sr_addr(misc_output_base, SR_RX_DSP0 + 5); + x.dsp_rx[1].freq = sr_addr(misc_output_base, SR_RX_DSP1 + 0); + x.dsp_rx[1].scale_iq = sr_addr(misc_output_base, SR_RX_DSP1 + 1); + x.dsp_rx[1].decim_rate = sr_addr(misc_output_base, SR_RX_DSP1 + 2); + x.dsp_rx[1].dcoffset_i = sr_addr(misc_output_base, SR_RX_DSP1 + 3); + x.dsp_rx[1].dcoffset_q = sr_addr(misc_output_base, SR_RX_DSP1 + 4); + x.dsp_rx[1].mux = sr_addr(misc_output_base, SR_RX_DSP1 + 5); x.gpio_io = gpio_base + 0; x.gpio_ddr = gpio_base + 4; x.gpio_tx_sel = gpio_base + 8; @@ -94,30 +113,30 @@ usrp2_regs_t usrp2_get_regs(bool use_n2xx_map) { x.atr_inrx_rxside = atr_base + 10; x.atr_full_txside = atr_base + 12; x.atr_full_rxside = atr_base + 14; - x.rx_ctrl[0].stream_cmd = sr_addr(misc_output_base, x.sr_rx_ctrl0 + 0); - x.rx_ctrl[0].time_secs = sr_addr(misc_output_base, x.sr_rx_ctrl0 + 1); - x.rx_ctrl[0].time_ticks = sr_addr(misc_output_base, x.sr_rx_ctrl0 + 2); - x.rx_ctrl[0].clear_overrun = sr_addr(misc_output_base, x.sr_rx_ctrl0 + 3); - x.rx_ctrl[0].vrt_header = sr_addr(misc_output_base, x.sr_rx_ctrl0 + 4); - x.rx_ctrl[0].vrt_stream_id = sr_addr(misc_output_base, x.sr_rx_ctrl0 + 5); - x.rx_ctrl[0].vrt_trailer = sr_addr(misc_output_base, x.sr_rx_ctrl0 + 6); - x.rx_ctrl[0].nsamps_per_pkt = sr_addr(misc_output_base, x.sr_rx_ctrl0 + 7); - x.rx_ctrl[0].nchannels = sr_addr(misc_output_base, x.sr_rx_ctrl0 + 8); - x.rx_ctrl[1].stream_cmd = sr_addr(misc_output_base, x.sr_rx_ctrl1 + 0); - x.rx_ctrl[1].time_secs = sr_addr(misc_output_base, x.sr_rx_ctrl1 + 1); - x.rx_ctrl[1].time_ticks = sr_addr(misc_output_base, x.sr_rx_ctrl1 + 2); - x.rx_ctrl[1].clear_overrun = sr_addr(misc_output_base, x.sr_rx_ctrl1 + 3); - x.rx_ctrl[1].vrt_header = sr_addr(misc_output_base, x.sr_rx_ctrl1 + 4); - x.rx_ctrl[1].vrt_stream_id = sr_addr(misc_output_base, x.sr_rx_ctrl1 + 5); - x.rx_ctrl[1].vrt_trailer = sr_addr(misc_output_base, x.sr_rx_ctrl1 + 6); - x.rx_ctrl[1].nsamps_per_pkt = sr_addr(misc_output_base, x.sr_rx_ctrl1 + 7); - x.rx_ctrl[1].nchannels = sr_addr(misc_output_base, x.sr_rx_ctrl1 + 8); - x.tx_ctrl_num_chan = sr_addr(misc_output_base, x.sr_tx_ctrl + 0); - x.tx_ctrl_clear_state = sr_addr(misc_output_base, x.sr_tx_ctrl + 1); - x.tx_ctrl_report_sid = sr_addr(misc_output_base, x.sr_tx_ctrl + 2); - x.tx_ctrl_policy = sr_addr(misc_output_base, x.sr_tx_ctrl + 3); - x.tx_ctrl_cycles_per_up = sr_addr(misc_output_base, x.sr_tx_ctrl + 4); - x.tx_ctrl_packets_per_up = sr_addr(misc_output_base, x.sr_tx_ctrl + 5); + x.rx_ctrl[0].stream_cmd = sr_addr(misc_output_base, SR_RX_CTRL0 + 0); + x.rx_ctrl[0].time_secs = sr_addr(misc_output_base, SR_RX_CTRL0 + 1); + x.rx_ctrl[0].time_ticks = sr_addr(misc_output_base, SR_RX_CTRL0 + 2); + x.rx_ctrl[0].clear_overrun = sr_addr(misc_output_base, SR_RX_CTRL0 + 3); + x.rx_ctrl[0].vrt_header = sr_addr(misc_output_base, SR_RX_CTRL0 + 4); + x.rx_ctrl[0].vrt_stream_id = sr_addr(misc_output_base, SR_RX_CTRL0 + 5); + x.rx_ctrl[0].vrt_trailer = sr_addr(misc_output_base, SR_RX_CTRL0 + 6); + x.rx_ctrl[0].nsamps_per_pkt = sr_addr(misc_output_base, SR_RX_CTRL0 + 7); + x.rx_ctrl[0].nchannels = sr_addr(misc_output_base, SR_RX_CTRL0 + 8); + x.rx_ctrl[1].stream_cmd = sr_addr(misc_output_base, SR_RX_CTRL1 + 0); + x.rx_ctrl[1].time_secs = sr_addr(misc_output_base, SR_RX_CTRL1 + 1); + x.rx_ctrl[1].time_ticks = sr_addr(misc_output_base, SR_RX_CTRL1 + 2); + x.rx_ctrl[1].clear_overrun = sr_addr(misc_output_base, SR_RX_CTRL1 + 3); + x.rx_ctrl[1].vrt_header = sr_addr(misc_output_base, SR_RX_CTRL1 + 4); + x.rx_ctrl[1].vrt_stream_id = sr_addr(misc_output_base, SR_RX_CTRL1 + 5); + x.rx_ctrl[1].vrt_trailer = sr_addr(misc_output_base, SR_RX_CTRL1 + 6); + x.rx_ctrl[1].nsamps_per_pkt = sr_addr(misc_output_base, SR_RX_CTRL1 + 7); + x.rx_ctrl[1].nchannels = sr_addr(misc_output_base, SR_RX_CTRL1 + 8); + x.tx_ctrl_num_chan = sr_addr(misc_output_base, SR_TX_CTRL + 0); + x.tx_ctrl_clear_state = sr_addr(misc_output_base, SR_TX_CTRL + 1); + x.tx_ctrl_report_sid = sr_addr(misc_output_base, SR_TX_CTRL + 2); + x.tx_ctrl_policy = sr_addr(misc_output_base, SR_TX_CTRL + 3); + x.tx_ctrl_cycles_per_up = sr_addr(misc_output_base, SR_TX_CTRL + 4); + x.tx_ctrl_packets_per_up = sr_addr(misc_output_base, SR_TX_CTRL + 5); return x; } |