mirror of
https://github.com/fairwaves/UHD-Fairwaves.git
synced 2025-10-22 23:31:59 +00:00
zpu: hide some debug messages in bootloader mode
This commit is contained in:
@@ -46,7 +46,9 @@ static uint16_t dac_value; /* Current DAC value */
|
||||
static int
|
||||
_set_vctcxo_dac(uint16_t v)
|
||||
{
|
||||
#ifndef BOOTLOADER
|
||||
if (gpsdo_debug) printf("DAC: %d\n", v);
|
||||
#endif
|
||||
dac_value = v;
|
||||
return spi_transact(
|
||||
SPI_TXRX, SPI_SS_DAC,
|
||||
@@ -152,9 +154,10 @@ _gpsdo_pid_step(int32_t val)
|
||||
else if (tot < -PID_MAX_DEV)
|
||||
tot = -PID_MAX_DEV;
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
if (gpsdo_debug) printf("GPSDO: DAC = %d %d (P=%d, I=%d, D=%d)>>%d limit +-%d\n",
|
||||
g_pid.init_val, tot, p_term, i_term, d_term, PID_SCALE_SHIFT, PID_MAX_DEV);
|
||||
|
||||
#endif
|
||||
/* Update DAC */
|
||||
_set_vctcxo_dac( g_pid.init_val + tot );
|
||||
}
|
||||
@@ -195,9 +198,9 @@ _gpsdo_irq_handler(unsigned irq)
|
||||
|
||||
/* Next request */
|
||||
gpsdo_regs->csr = GPSDO_CSR_REQ;
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
if (gpsdo_debug) printf("GPSDO: Counter = %u @ %u sec %u ticks\n", val, cur_secs, cur_ticks);
|
||||
|
||||
#endif
|
||||
/* Check validity of value */
|
||||
if (abs(val - PID_TARGET) < 100000)
|
||||
{
|
||||
@@ -207,17 +210,20 @@ _gpsdo_irq_handler(unsigned irq)
|
||||
if (g_skip_on_first_run > 0) {
|
||||
g_skip_on_first_run--;
|
||||
g_val_lpf = val<<VAL_LPF_PRECISION;
|
||||
#ifndef BOOTLOADER
|
||||
printf("GPSDO init: Filtered counter = %u + %u/8\n",
|
||||
(g_val_lpf>>VAL_LPF_PRECISION), (g_val_lpf&((1<<VAL_LPF_PRECISION)-1)));
|
||||
#endif
|
||||
_gpsdo_pid_first_step(val);
|
||||
} else {
|
||||
/* LPF the value */
|
||||
/* Integer overlow warning! */
|
||||
/* This works for val ~= 52M, but don't try to use it with much larger values - it will overflow */
|
||||
g_val_lpf = (g_val_lpf * 7 + (val<<VAL_LPF_PRECISION) + 4) >> 3;
|
||||
#ifndef BOOTLOADER
|
||||
if (gpsdo_debug) printf("GPSDO: Filtered counter = %u + %u/8\n",
|
||||
(g_val_lpf>>VAL_LPF_PRECISION), (g_val_lpf&((1<<VAL_LPF_PRECISION)-1)));
|
||||
|
||||
#endif
|
||||
/* Update PID */
|
||||
_gpsdo_pid_step(g_val_lpf>>VAL_LPF_PRECISION);
|
||||
}
|
||||
@@ -233,11 +239,16 @@ void
|
||||
gpsdo_init(void)
|
||||
{
|
||||
uint16_t tcxo_dac = eeprom_read_tcxo_dac();
|
||||
printf("TCXO DAC: %d ", tcxo_dac);
|
||||
if (tcxo_dac == 0xFFFF) {
|
||||
tcxo_dac = PID_MID_VAL;
|
||||
printf("TCXO DAC: %d (hardcoded init)\n", tcxo_dac);
|
||||
#ifndef BOOTLOADER
|
||||
printf("(hardcoded init)\n");
|
||||
#endif
|
||||
} else {
|
||||
printf("TCXO DAC: %d (init from EEPROM)\n", tcxo_dac);
|
||||
#ifndef BOOTLOADER
|
||||
printf("(init from EEPROM)\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Reset GPSDO */
|
||||
|
@@ -38,6 +38,13 @@ static uint16_t prescaler_values[MAX_WB_DIV+1] = {
|
||||
|
||||
#define WATCHDOG 50000
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
static void _print_wderr(const char* f)
|
||||
{
|
||||
printf("i2c_%s WATCHDOG failed!", f);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
i2c_init(void)
|
||||
{
|
||||
@@ -63,10 +70,11 @@ wait_for_xfer(void)
|
||||
unsigned i = WATCHDOG;
|
||||
while ((i != 0) && (i2c_regs->cmd_status & I2C_ST_TIP)) // wait for xfer to complete
|
||||
--i;
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
if (i == 0) {
|
||||
puts("wait_for_xfer WATCHDOG failed!");
|
||||
_print_wderr("xfer");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool
|
||||
@@ -90,7 +98,9 @@ i2c_read (unsigned char i2c_addr, unsigned char *buf, unsigned int len)
|
||||
while ((i != 0) && (i2c_regs->cmd_status & I2C_ST_BUSY))
|
||||
--i;
|
||||
if (i == 0) {
|
||||
puts("i2c_read WATCHDOG failed!");
|
||||
#ifndef BOOTLOADER
|
||||
_print_wderr("read");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -120,7 +130,9 @@ i2c_write(unsigned char i2c_addr, const unsigned char *buf, unsigned int len)
|
||||
while ((i != 0) && (i2c_regs->cmd_status & I2C_ST_BUSY))
|
||||
--i;
|
||||
if (i == 0) {
|
||||
puts("i2c_write WATCHDOG failed!");
|
||||
#ifndef BOOTLOADER
|
||||
_print_wderr("write");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -22,25 +22,27 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
ADD_DEFINITIONS(-DUSRP2P)
|
||||
ADD_DEFINITIONS(-DUDP_UART_MASK=2 -DNUM_UARTS_STORAGE=1) #GPS=UART1 streaming enabled
|
||||
|
||||
ADD_LIBRARY(libumtrxfw STATIC
|
||||
SET(libumtrxfw_FILES
|
||||
${COMMON_SRCS}
|
||||
spif.c
|
||||
spi_flash.c
|
||||
spi_flash_read.c
|
||||
bootloader_utils.c
|
||||
ethernet.c
|
||||
xilinx_s3_icap.c
|
||||
xilinx_s6_icap.c
|
||||
udp_fw_update.c
|
||||
u2p_init.c
|
||||
${CMAKE_SOURCE_DIR}/umtrx/spif.c
|
||||
${CMAKE_SOURCE_DIR}/umtrx/spi_flash.c
|
||||
${CMAKE_SOURCE_DIR}/umtrx/spi_flash_read.c
|
||||
${CMAKE_SOURCE_DIR}/umtrx/bootloader_utils.c
|
||||
${CMAKE_SOURCE_DIR}/umtrx/ethernet.c
|
||||
${CMAKE_SOURCE_DIR}/umtrx/xilinx_s3_icap.c
|
||||
${CMAKE_SOURCE_DIR}/umtrx/xilinx_s6_icap.c
|
||||
${CMAKE_SOURCE_DIR}/umtrx/udp_fw_update.c
|
||||
${CMAKE_SOURCE_DIR}/umtrx/u2p_init.c
|
||||
)
|
||||
|
||||
# ADD_LIBRARY(libumtrxfw STATIC ${libumtrxfw_FILES})
|
||||
|
||||
ADD_SUBDIRECTORY(bootloader)
|
||||
|
||||
########################################################################
|
||||
SET(GEN_OUTPUTS_BIN_SIZE 0x3fff)
|
||||
|
||||
ADD_EXECUTABLE(umtrx_txrx_uhd.elf ${CMAKE_SOURCE_DIR}/apps/txrx_uhd.c)
|
||||
TARGET_LINK_LIBRARIES(umtrx_txrx_uhd.elf libumtrxfw)
|
||||
ADD_EXECUTABLE(umtrx_txrx_uhd.elf ${CMAKE_SOURCE_DIR}/apps/txrx_uhd.c ${libumtrxfw_FILES})
|
||||
# TARGET_LINK_LIBRARIES(umtrx_txrx_uhd.elf libumtrxfw)
|
||||
GEN_OUTPUTS(umtrx_txrx_uhd.elf)
|
||||
|
||||
|
@@ -33,10 +33,11 @@ MACRO(GEN_RMI target)
|
||||
ENDMACRO(GEN_RMI)
|
||||
|
||||
########################################################################
|
||||
ADD_EXECUTABLE(bootloader.elf ${CMAKE_SOURCE_DIR}/apps/txrx_uhd.c)
|
||||
ADD_DEFINITIONS(-DUSRP2P)
|
||||
ADD_DEFINITIONS(-DBOOTLOADER)
|
||||
TARGET_LINK_LIBRARIES(bootloader.elf libumtrxfw)
|
||||
|
||||
ADD_EXECUTABLE(bootloader.elf ${CMAKE_SOURCE_DIR}/apps/txrx_uhd.c ${libumtrxfw_FILES})
|
||||
# TARGET_LINK_LIBRARIES(bootloader.elf libumtrxfw)
|
||||
SET(GEN_OUTPUTS_BIN_SIZE 0x3fff)
|
||||
GEN_OUTPUTS(bootloader.elf)
|
||||
GEN_RMI(bootloader.bin)
|
||||
|
Reference in New Issue
Block a user