diff --git a/userspace/libwr/dot-config.c b/userspace/libwr/dot-config.c index baec29e96a0eaab6b3ca25d6633145a27cd82180..61165ba09de7df4a7dddc232a6a0a02194ee3049 100644 --- a/userspace/libwr/dot-config.c +++ b/userspace/libwr/dot-config.c @@ -5,6 +5,7 @@ #include <string.h> #include <errno.h> #include <stdarg.h> +#include <libwr/wrs-msg.h> #include <libwr/config.h> /* All strings here are strdup'd and then split; you can't free(3) them */ @@ -173,7 +174,7 @@ int libwr_cfg_read_verify_file(char *dotconfig, char *kconfig) if (!strcmp(c->name, kc->name)) break; if (!kc) { - fprintf(stderr, "Configuration \"%s\" not found\n", + pr_error("Configuration \"%s\" not found\n", c->name); errors++; } diff --git a/userspace/libwr/hwiu.c b/userspace/libwr/hwiu.c index 99a0d91da533ebef55d9796343fea23cef0796cf..10d081bd83c02c24fb6da77c495e598a5a4cd08a 100644 --- a/userspace/libwr/hwiu.c +++ b/userspace/libwr/hwiu.c @@ -3,6 +3,7 @@ #include <stddef.h> #include <fpga_io.h> #include <regs/hwiu-regs.h> +#include <libwr/wrs-msg.h> #include <libwr/hwiu.h> #define hwiu_write(reg, val) \ @@ -43,8 +44,9 @@ int shw_hwiu_gwver(struct gw_info *info) s_data = (struct gw_info *)data; *info = *s_data; if (info->nwords != HWIU_INFO_WORDS) { - printf("nwords: sw=%u, hw=%u, ver=%u, data=%x\n", info->nwords, - HWIU_INFO_WORDS, info->struct_ver, data[0]); + pr_error("nwords: sw=%u, hw=%u, ver=%u, data=%x\n", + info->nwords, HWIU_INFO_WORDS, info->struct_ver, + data[0]); return -1; } //now read info words diff --git a/userspace/libwr/i2c_fpga_reg.c b/userspace/libwr/i2c_fpga_reg.c index 6ec9a53819764518cc5676ca3359d71e954a9318..9861a49e529957de7330b1c6bf7aaccec2a5027b 100644 --- a/userspace/libwr/i2c_fpga_reg.c +++ b/userspace/libwr/i2c_fpga_reg.c @@ -5,6 +5,7 @@ #include <stdlib.h> #include <string.h> #include <libwr/util.h> //for shw_udelay(); +#include <libwr/wrs-msg.h> #include "i2c_fpga_reg.h" @@ -18,11 +19,11 @@ int i2c_fpga_reg_init_bus(struct i2c_bus *bus) i2c_fpga_reg_t *priv; if (!bus->type_specific) { - printf("no type specific structure provided\n"); + pr_error("no type specific structure provided\n"); return -1; } if (bus->type != I2C_BUS_TYPE_FPGA_REG) { - printf("type doesn't match I2C_BUS_TYPE_FPGA_REG(%d): %d\n", + pr_error("type doesn't match I2C_BUS_TYPE_FPGA_REG(%d): %d\n", I2C_BUS_TYPE_FPGA_REG, bus->type); return -1; } @@ -40,7 +41,7 @@ int i2c_fpga_reg_init_bus(struct i2c_bus *bus) _fpga_writel(priv->base_address + FPGA_I2C_REG_CTR, CTR_EN); if (!(_fpga_readl(priv->base_address + FPGA_I2C_REG_CTR) & CTR_EN)) { - printf("failed to read from control register\n"); + pr_error("failed to read from control register\n"); return -1; } diff --git a/userspace/libwr/i2c_io.c b/userspace/libwr/i2c_io.c index c0e4623b87cc8a061651f5dab571af228900ac97..bc85b4d1cb28a82ba8ee27d8df701d6d904197f5 100644 --- a/userspace/libwr/i2c_io.c +++ b/userspace/libwr/i2c_io.c @@ -86,10 +86,10 @@ int shw_i2c_io_scan(uint8_t * dev_map) return -1; detect = i2c_scan(&i2c_io_bus, dev_map); - printf("\ni2c_bus: %s: %d devices\n", i2c_io_bus.name, detect); + pr_debug("\ni2c_bus: %s: %d devices\n", i2c_io_bus.name, detect); for (i = 0; i < 128; i++) if (dev_map[i / 8] & (1 << (i % 8))) - printf("device at: 0x%02X\n", i); + pr_debug("device at: 0x%02X\n", i); return detect; } diff --git a/userspace/libwr/i2c_sfp.c b/userspace/libwr/i2c_sfp.c index 682c1333e1a18bb74b82f8e7141629e62a6056db..673ef0bb4745b69c8b2187672d4d0dd417c86bf1 100644 --- a/userspace/libwr/i2c_sfp.c +++ b/userspace/libwr/i2c_sfp.c @@ -215,10 +215,10 @@ int shw_sfp_bus_scan(int num, uint8_t * dev_map) return -1; detect = i2c_scan(&i2c_buses[num], dev_map); - printf("\ni2c_bus: %s: %d devices\n", i2c_buses[num].name, detect); + pr_debug("\ni2c_bus: %s: %d devices\n", i2c_buses[num].name, detect); for (i = 0; i < 128; i++) if (dev_map[i / 8] & (1 << (i % 8))) - printf("device at: 0x%02X\n", i); + pr_debug("device at: 0x%02X\n", i); return detect; } @@ -548,12 +548,12 @@ static struct shw_sfp_caldata *shw_sfp_cal_list = NULL; /* local helper */ static void __err_msg(int index, char *pname, char *pvalue) { - fprintf(stderr, "Config item \"SFP%02i_PARAMS\": parameter \"%s\" ", - index, pname); if (pvalue) - fprintf(stderr, "is wrong (\"%s\")\n", pvalue); + pr_error("Config item \"SFP%02i_PARAMS\": parameter \"%s\" " + "is wrong (\"%s\")\n", index, pname, pvalue); else - fprintf(stderr, "is not specified\n"); + pr_error("Config item \"SFP%02i_PARAMS\": parameter \"%s\" " + "is not specified\n", index, pname); } int shw_sfp_read_db(void) @@ -653,7 +653,6 @@ struct shw_sfp_caldata *shw_sfp_get_cal_data(int num, t = shw_sfp_cal_list; /* In the first pass, look for serial number */ while (t) { -// printf("search1 %s %s\n", t->part_num, t->vendor_serial); if (t->vendor_name[0] == 0 && strncmp(pn, t->part_num, 16) == 0 && t->vendor_serial[0] == 0) diff --git a/userspace/libwr/ptpd_netif.c b/userspace/libwr/ptpd_netif.c index 259057772590be9c8c1cba4452f96c051305a749..eb6366f6a3b8cd36304fa613766a2546d2c5c689 100644 --- a/userspace/libwr/ptpd_netif.c +++ b/userspace/libwr/ptpd_netif.c @@ -27,6 +27,7 @@ #include <libwr/hal_shmem.h> #include <libwr/hal_client.h> #include <libwr/util.h> +#include <libwr/wrs-msg.h> #include <net/ethernet.h> #ifdef NETIF_VERBOSE @@ -487,8 +488,8 @@ int ptpd_netif_adjust_counters(int64_t adjust_sec, int32_t adjust_nsec) return 0; if (adjust_sec && adjust_nsec) { - fprintf(stderr, - " FATAL : trying to adjust both the SEC and the NS counters simultaneously. \n"); + pr_error(" FATAL : trying to adjust both the SEC and the NS " + "counters simultaneously.\n"); exit(-1); } diff --git a/userspace/libwr/rt_client.c b/userspace/libwr/rt_client.c index afcc3bde280a6fb072f97f7f5d553e854442719f..775340a61022294354c267bd543dd01571a1128c 100644 --- a/userspace/libwr/rt_client.c +++ b/userspace/libwr/rt_client.c @@ -43,16 +43,16 @@ int rts_get_state(struct rts_pll_state *state) return ret; #ifdef VERBOSE - printf("RTS State Dump: \n"); - printf("CurrentRef: %d Mode: %d Flags: %x\n", + pr_debug("RTS State Dump:\n"); + pr_debug("CurrentRef: %d Mode: %d Flags: %x\n", state->current_ref, state->mode, state->flags); for (i = 0; i < RTS_PLL_CHANNELS; i++) - printf("Ch%d: setpoint: %dps current: %dps " - "loopback: %dps flags: %x\n", i, - state->channels[i].phase_setpoint, - state->channels[i].phase_current, - state->channels[i].phase_loopback, - state->channels[i].flags); + pr_debug("Ch%d: setpoint: %dps current: %dps " + "loopback: %dps flags: %x\n", i, + state->channels[i].phase_setpoint, + state->channels[i].phase_current, + state->channels[i].phase_loopback, + state->channels[i].flags); #endif return 0; diff --git a/userspace/libwr/util.c b/userspace/libwr/util.c index 99745651517286e0ccc3015f878181baca905c8b..5c121278487e982bcf77e88bf8e03be64520b912 100644 --- a/userspace/libwr/util.c +++ b/userspace/libwr/util.c @@ -3,6 +3,7 @@ #include <stdlib.h> #include <sys/time.h> +#include <libwr/wrs-msg.h> #include <libwr/util.h> static int loops_per_msec = -1; @@ -26,7 +27,7 @@ void shw_udelay_init(void) loops_per_msec = i * 1000 / min; if (0) - printf("loops per msec %i\n", loops_per_msec); + pr_debug("loops per msec %i\n", loops_per_msec); /* * I get 39400 more or less; it makes sense at 197 bogomips. * The loop is 6 instructions with 3 (cached) memory accesses