diff --git a/firmware/common/rffc5071.c b/firmware/common/rffc5071.c index 6234a318..ebda0c81 100644 --- a/firmware/common/rffc5071.c +++ b/firmware/common/rffc5071.c @@ -37,13 +37,7 @@ #include "rffc5071_drv.h" #include "rffc5071_regs.def" // private register def macros -#if (defined DEBUG) -#include -#define LOG printf -#else -#define LOG(x,...) #include "hackrf_core.h" -#endif /* Default register values. */ static const uint16_t rffc5071_regs_default[RFFC5071_NUM_REGS] = { @@ -82,7 +76,6 @@ static const uint16_t rffc5071_regs_default[RFFC5071_NUM_REGS] = { /* Set up all registers according to defaults specified in docs. */ void rffc5071_init(rffc5071_driver_t* const drv) { - LOG("# rffc5071_init\n"); memcpy(drv->regs, rffc5071_regs_default, sizeof(drv->regs)); drv->regs_dirty = 0x7fffffff; @@ -97,7 +90,6 @@ void rffc5071_init(rffc5071_driver_t* const drv) void rffc5071_setup(rffc5071_driver_t* const drv) { rffc5071_init(drv); - LOG("# rffc5071_setup\n"); rffc5071_pin_config(drv); @@ -165,7 +157,6 @@ void rffc5071_regs_commit(rffc5071_driver_t* const drv) } void rffc5071_tx(rffc5071_driver_t* const drv) { - LOG("# rffc5071_tx\n"); set_RFFC5071_ENBL(drv, 0); set_RFFC5071_FULLD(drv, 0); set_RFFC5071_MODE(drv, 1); /* mixer 2 used for both RX and TX */ @@ -173,7 +164,6 @@ void rffc5071_tx(rffc5071_driver_t* const drv) { } void rffc5071_rx(rffc5071_driver_t* const drv) { - LOG("# rfc5071_rx\n"); set_RFFC5071_ENBL(drv, 0); set_RFFC5071_FULLD(drv, 0); set_RFFC5071_MODE(drv, 1); /* mixer 2 used for both RX and TX */ @@ -185,7 +175,6 @@ void rffc5071_rx(rffc5071_driver_t* const drv) { * current hardware designs do not support full-duplex operation. */ void rffc5071_rxtx(rffc5071_driver_t* const drv) { - LOG("# rfc5071_rxtx\n"); set_RFFC5071_ENBL(drv, 0); set_RFFC5071_FULLD(drv, 1); /* mixer 1 and mixer 2 (RXTX) */ rffc5071_regs_commit(drv); @@ -194,13 +183,11 @@ void rffc5071_rxtx(rffc5071_driver_t* const drv) { } void rffc5071_disable(rffc5071_driver_t* const drv) { - LOG("# rfc5071_disable\n"); set_RFFC5071_ENBL(drv, 0); rffc5071_regs_commit(drv); } void rffc5071_enable(rffc5071_driver_t* const drv) { - LOG("# rfc5071_enable\n"); set_RFFC5071_ENBL(drv, 1); rffc5071_regs_commit(drv); } @@ -219,8 +206,6 @@ uint64_t rffc5071_config_synth_int(rffc5071_driver_t* const drv, uint16_t lo) { uint16_t p1nmsb; uint8_t p1nlsb; - LOG("# config_synth_int\n"); - /* Calculate n_lo */ uint8_t n_lo = 0; uint16_t x = LO_MAX / lo; @@ -253,8 +238,6 @@ uint64_t rffc5071_config_synth_int(rffc5071_driver_t* const drv, uint16_t lo) { tune_freq_hz = (REF_FREQ * (tmp_n >> 5ULL) * fbkdiv * FREQ_ONE_MHZ) / (lodiv * (1 << 24ULL)); - LOG("# lo=%d n_lo=%d lodiv=%d fvco=%d fbkdiv=%d n=%d tune_freq_hz=%d\n", - lo, n_lo, lodiv, fvco, fbkdiv, n, tune_freq); /* Path 1 */ set_RFFC5071_P1LODIV(drv, n_lo); @@ -294,22 +277,3 @@ void rffc5071_set_gpo(rffc5071_driver_t* const drv, uint8_t gpo) rffc5071_regs_commit(drv); } - -#ifdef TEST -int main(int ac, char **av) -{ - rffc5071_setup(drv); - rffc5071_tx(drv, 0); - rffc5071_set_frequency(drv, 500, 0); - rffc5071_set_frequency(drv, 525, 0); - rffc5071_set_frequency(drv, 550, 0); - rffc5071_set_frequency(drv, 1500, 0); - rffc5071_set_frequency(drv, 1525, 0); - rffc5071_set_frequency(drv, 1550, 0); - rffc5071_disable(drv); - rffc5071_rx(drv, 0); - rffc5071_disable(drv); - rffc5071_rxtx(drv); - rffc5071_disable(drv); -} -#endif //TEST diff --git a/firmware/common/rffc5071_drv.c b/firmware/common/rffc5071_drv.c index ca7ce127..759e7c01 100644 --- a/firmware/common/rffc5071_drv.c +++ b/firmware/common/rffc5071_drv.c @@ -20,20 +20,13 @@ * Boston, MA 02110-1301, USA. */ -#if (defined DEBUG) -#include -#define LOG printf -#else -#define LOG(x,...) #include #include #include #include "hackrf_core.h" -#endif void rffc5071_pin_config(rffc5071_driver_t* const drv) { (void)drv; -#if !defined TEST /* Configure GPIO pins. */ scu_pinmux(SCU_MIXER_ENX, SCU_GPIO_FAST); scu_pinmux(SCU_MIXER_SCLK, SCU_GPIO_FAST | SCU_CONF_FUNCTION4); @@ -51,7 +44,6 @@ void rffc5071_pin_config(rffc5071_driver_t* const drv) { gpio_clear(PORT_MIXER_SCLK, PIN_MIXER_SCLK); gpio_clear(PORT_MIXER_SDATA, PIN_MIXER_SDATA); gpio_set(PORT_MIXER_RESETX, PIN_MIXER_RESETX); /* active low */ -#endif } static void serial_delay(void) @@ -77,10 +69,6 @@ uint16_t rffc5071_spi_read(rffc5071_driver_t* const drv, uint8_t r) { int msb = 1 << (bits -1); uint32_t data = 0x80 | (r & 0x7f); -#if DEBUG - LOG("reg%d = 0\n", r); - return 0; -#else /* make sure everything is starting in the correct state */ gpio_set(PORT_MIXER_ENX, PIN_MIXER_ENX); gpio_clear(PORT_MIXER_SCLK, PIN_MIXER_SCLK); @@ -157,7 +145,6 @@ uint16_t rffc5071_spi_read(rffc5071_driver_t* const drv, uint8_t r) { gpio_clear(PORT_MIXER_SCLK, PIN_MIXER_SCLK); return data; -#endif /* DEBUG */ } /* SPI register write @@ -171,10 +158,6 @@ uint16_t rffc5071_spi_read(rffc5071_driver_t* const drv, uint8_t r) { void rffc5071_spi_write(rffc5071_driver_t* const drv, uint8_t r, uint16_t v) { (void)drv; -#if DEBUG - LOG("0x%04x -> reg%d\n", v, r); -#else - int bits = 25; int msb = 1 << (bits -1); uint32_t data = ((r & 0x7f) << 16) | v; @@ -228,5 +211,4 @@ void rffc5071_spi_write(rffc5071_driver_t* const drv, uint8_t r, uint16_t v) { serial_delay(); gpio_clear(PORT_MIXER_SCLK, PIN_MIXER_SCLK); -#endif }