This patch series reduces the number of warnings emitted during firmware compilation. No functional changes. The patches could NOT be TESTED, so please try them before merging.
Kind regards, -Alexander Huemer
this eliminates the occurrance of gcc warning warning: format ‘?’ expects type ‘?’, but argument ? has type ‘?’ --- src/target/firmware/apps/loader/main.c | 4 ++-- src/target/firmware/calypso/dsp.c | 5 +++-- src/target/firmware/calypso/keypad.c | 3 ++- src/target/firmware/flash/cfi_flash.c | 13 +++++++------ src/target/firmware/layer1/prim_fbsb.c | 9 +++++---- src/target/firmware/layer1/prim_freq.c | 3 ++- 6 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/src/target/firmware/apps/loader/main.c b/src/target/firmware/apps/loader/main.c index 2ff6f9c..18f0b36 100644 --- a/src/target/firmware/apps/loader/main.c +++ b/src/target/firmware/apps/loader/main.c @@ -162,13 +162,13 @@ int main(void) if (flash_init(&the_flash, 0)) { puts("Failed to initialize flash!\n"); } else { - printf("Found flash of %d bytes at 0x%x with %d regions\n", + printf("Found flash of %zu bytes at 0x%p with %zu regions\n", the_flash.f_size, the_flash.f_base, the_flash.f_nregions);
int i; for (i = 0; i < the_flash.f_nregions; i++) { - printf(" Region %d of %d pages with %d bytes each.\n", + printf(" Region %d of %zu pages with %zu bytes each.\n", i, the_flash.f_regions[i].fr_bnum, the_flash.f_regions[i].fr_bsize); diff --git a/src/target/firmware/calypso/dsp.c b/src/target/firmware/calypso/dsp.c index 1daecb2..8bf9749 100644 --- a/src/target/firmware/calypso/dsp.c +++ b/src/target/firmware/calypso/dsp.c @@ -23,6 +23,7 @@
#include <stdint.h> #include <stdio.h> +#include <inttypes.h>
#include <debug.h> #include <delay.h> @@ -639,7 +640,7 @@ static void _dsp_dump_range(uint32_t addr, uint32_t size, int mode) * the sercomm buffer */ delay_ms(2); if ((addr&15)==0) - printf("%05x : ", addr); + printf("%05"PRIx32" : ", addr); printf("%04hx%c", *api++, ((addr&15)==15)?'\n':' '); addr++; } @@ -685,7 +686,7 @@ void dsp_dump(void)
/* Dump each range */ for (i=0; dr[i].name; i++) { - printf("DSP dump: %s [%05x-%05x]\n", dr[i].name, + printf("DSP dump: %s [%05"PRIx32"-%05lx]\n", dr[i].name, dr[i].addr, dr[i].addr+dr[i].size-1); _dsp_dump_range(dr[i].addr, dr[i].size, dr[i].mode); } diff --git a/src/target/firmware/calypso/keypad.c b/src/target/firmware/calypso/keypad.c index fd4e0ff..30fb3b9 100644 --- a/src/target/firmware/calypso/keypad.c +++ b/src/target/firmware/calypso/keypad.c @@ -22,6 +22,7 @@
#include <stdint.h> #include <stdio.h> +#include <inttypes.h>
#include <defines.h> #include <debug.h> @@ -98,7 +99,7 @@ void dispatch_buttons(uint32_t buttons) else if BTN_TO_KEY(OK) else { - printf("\nunknown keycode: 0x%08x\n", diff); + printf("\nunknown keycode: 0x%08"PRIx32"\n", diff); break; } emit_key(key, state); diff --git a/src/target/firmware/flash/cfi_flash.c b/src/target/firmware/flash/cfi_flash.c index 69369d5..4f31d78 100644 --- a/src/target/firmware/flash/cfi_flash.c +++ b/src/target/firmware/flash/cfi_flash.c @@ -24,6 +24,7 @@ #include <stdio.h> #include <stdint.h> #include <errno.h> +#include <inttypes.h> #include <memory.h> #include <defines.h> #include <flash/cfi_flash.h> @@ -184,7 +185,7 @@ int flash_block_unlock(flash_t * flash, uint32_t block_offset) return -EPERM; }
- printf("Unlocking block at 0x%08x, meaning %08x\n", + printf("Unlocking block at 0x%08"PRIx32", meaning %8p\n", block_offset, base_addr + block_offset);
flash_write_cmd(base_addr, CFI_CMD_PROTECT); @@ -203,7 +204,7 @@ int flash_block_lock(flash_t * flash, uint32_t block_offset) return -EINVAL; }
- printf("Locking block at 0x%08x\n", block_offset); + printf("Locking block at 0x%08"PRIx32"\n", block_offset);
flash_write_cmd(base_addr, CFI_CMD_PROTECT); flash_write_cmd(base_addr + block_offset, CFI_PROT_LOCK); @@ -221,7 +222,7 @@ int flash_block_lockdown(flash_t * flash, uint32_t block_offset) return -EINVAL; }
- printf("Locking down block at 0x%08x\n", block_offset); + printf("Locking down block at 0x%08"PRIx32"\n", block_offset);
flash_write_cmd(base_addr, CFI_CMD_PROTECT); flash_write_cmd(base_addr + block_offset, CFI_PROT_LOCKDOWN); @@ -243,7 +244,7 @@ int flash_block_erase(flash_t * flash, uint32_t block_offset) return -EPERM; }
- printf("Erasing block 0x%08x...", block_offset); + printf("Erasing block 0x%08"PRIx32"...", block_offset);
void *block_addr = ((uint8_t *) base_addr) + block_offset;
@@ -313,7 +314,7 @@ int flash_program(flash_t * flash, uint32_t dst, void *src, uint32_t nbytes) }
/* say something */ - printf("Programming %u bytes to 0x%08x from 0x%p...", nbytes, dst, src); + printf("Programming %"PRIu32" bytes to 0x%08"PRIx32" from 0x%p...", nbytes, dst, src);
/* clear status register */ flash_write_cmd(base_addr, CFI_CMD_CLEAR_STATUS); @@ -373,7 +374,7 @@ int flash_program(flash_t * flash, uint32_t dst, void *src, uint32_t nbytes) flash_write_cmd(base_addr, CFI_CMD_RESET);
err: - printf(" at offset 0x%x\n", i); + printf(" at offset 0x%"PRIx32"\n", i);
return res; } diff --git a/src/target/firmware/layer1/prim_fbsb.c b/src/target/firmware/layer1/prim_fbsb.c index 7affd75..023902d 100644 --- a/src/target/firmware/layer1/prim_fbsb.c +++ b/src/target/firmware/layer1/prim_fbsb.c @@ -25,6 +25,7 @@ #include <string.h> #include <stdlib.h> #include <errno.h> +#include <inttypes.h>
#include <defines.h> #include <debug.h> @@ -93,7 +94,7 @@ static void dump_mon_state(struct mon_state *fb) fb->snr, l1s_snr_int(fb->snr), l1s_snr_fract(fb->snr), tpu_get_offset(), tpu_get_synchro()); #else - printf("(%u:%u): TOA=%5u, Power=%4ddBm, Angle=%5dHz\n", + printf("(%"PRIu32":%u): TOA=%5u, Power=%4ddBm, Angle=%5dHz\n", fb->fnr_report, fb->attempt, fb->toa, agc_inp_dbm8_by_pm(fb->pm)/8, ANGLE_TO_FREQ(fb->angle)); #endif @@ -201,7 +202,7 @@ static int l1s_sbdet_resp(__unused uint8_t p1, uint8_t attempt,
sb = dsp_api.db_r->a_sch[3] | dsp_api.db_r->a_sch[4] << 16; fbs.mon.bsic = l1s_decode_sb(&fbs.mon.time, sb); - printf("=> SB 0x%08x: BSIC=%u ", sb, fbs.mon.bsic); + printf("=> SB 0x%08"PRIx32": BSIC=%u ", sb, fbs.mon.bsic); l1s_time_dump(&fbs.mon.time);
l1s.serving_cell.bsic = fbs.mon.bsic; @@ -480,9 +481,9 @@ static int l1s_fbdet_resp(__unused uint8_t p1, uint8_t attempt,
int fn_offset = l1s.current_time.fn - last_fb->attempt + ntdma; int delay = fn_offset + 11 - l1s.current_time.fn - 1; - printf(" fn_offset=%d (fn=%u + attempt=%u + ntdma = %d)\n", + printf(" fn_offset=%d (fn=%"PRIu32" + attempt=%u + ntdma = %d)\n", fn_offset, l1s.current_time.fn, last_fb->attempt, ntdma); - printf(" delay=%d (fn_offset=%d + 11 - fn=%u - 1\n", delay, + printf(" delay=%d (fn_offset=%d + 11 - fn=%"PRIu32" - 1\n", delay, fn_offset, l1s.current_time.fn); printf(" scheduling next FB/SB detection task with delay %u\n", delay); if (abs(last_fb->freq_diff) < fbs.req.freq_err_thresh2 && diff --git a/src/target/firmware/layer1/prim_freq.c b/src/target/firmware/layer1/prim_freq.c index 88bc453..64e08b5 100644 --- a/src/target/firmware/layer1/prim_freq.c +++ b/src/target/firmware/layer1/prim_freq.c @@ -24,6 +24,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <inttypes.h>
#include <defines.h> #include <debug.h> @@ -102,7 +103,7 @@ void l1a_freq_req(uint32_t fn_sched) fn_sched = l1s.current_time.fn + diff; if (fn_sched >= GSM_MAX_FN) fn_sched -= GSM_MAX_FN; - printf("Scheduling frequency change at fn=%u, currently fn=%u\n", + printf("Scheduling frequency change at fn=%"PRIu32", currently fn=%"PRIu32"\n", fn_sched, l1s.current_time.fn);
local_firq_save(flags);
this eliminates the occurrance of gcc warning warning: unused parameter ‘?’ --- src/target/firmware/apps/hello_world/main.c | 3 ++- src/target/firmware/board/compal/rffe_dualband.c | 6 ++++-- .../firmware/board/compal_e86/rffe_dualband_e86.c | 6 ++++-- .../firmware/board/gta0x/rffe_gta0x_triband.c | 6 ++++-- .../board/pirelli_dpl10/rffe_dpl10_triband.c | 6 ++++-- src/target/firmware/calypso/i2c.c | 3 ++- src/target/firmware/calypso/sim.c | 3 ++- src/target/firmware/comm/msgb.c | 4 +++- src/target/firmware/comm/timer.c | 4 +++- src/target/firmware/display/ssd1783.c | 4 +++- src/target/firmware/display/ssd1963.c | 6 +++--- src/target/firmware/display/td014.c | 4 +++- src/target/firmware/flash/cfi_flash.c | 3 +++ src/target/firmware/layer1/afc.c | 3 ++- src/target/firmware/layer1/apc.c | 4 +++- src/target/firmware/layer1/l23_api.c | 8 +++----- src/target/firmware/layer1/prim_fbsb.c | 6 +----- src/target/firmware/layer1/prim_rach.c | 1 - src/target/firmware/layer1/prim_tch.c | 2 +- src/target/firmware/layer1/prim_tx_nb.c | 1 - src/target/firmware/layer1/toa.c | 3 ++- src/target/firmware/layer1/tpu_window.c | 2 +- src/target/firmware/rf/trf6151.c | 6 ++++++ 23 files changed, 59 insertions(+), 35 deletions(-)
diff --git a/src/target/firmware/apps/hello_world/main.c b/src/target/firmware/apps/hello_world/main.c index 5e3ed85..56598b9 100644 --- a/src/target/firmware/apps/hello_world/main.c +++ b/src/target/firmware/apps/hello_world/main.c @@ -24,6 +24,7 @@ #include <stdio.h> #include <string.h>
+#include <defines.h> #include <debug.h> #include <memory.h> #include <delay.h> @@ -59,7 +60,7 @@ static void console_rx_cb(uint8_t dlci, struct msgb *msg) msgb_free(msg); }
-static void l1a_l23_rx_cb(uint8_t dlci, struct msgb *msg) +static void l1a_l23_rx_cb(__unused uint8_t dlci, struct msgb *msg) { int i; puts("l1a_l23_rx_cb: "); diff --git a/src/target/firmware/board/compal/rffe_dualband.c b/src/target/firmware/board/compal/rffe_dualband.c index f4b7361..995c03b 100644 --- a/src/target/firmware/board/compal/rffe_dualband.c +++ b/src/target/firmware/board/compal/rffe_dualband.c @@ -1,6 +1,7 @@ #include <stdint.h> #include <stdio.h>
+#include <defines.h> #include <debug.h> #include <memory.h> #include <rffe.h> @@ -23,7 +24,7 @@ #define RITA_STROBE TSPEN(2) /* Strobe for the Rita TSP */
/* switch RF Frontend Mode */ -void rffe_mode(enum gsm_band band, int tx) +void rffe_mode(__unused enum gsm_band band, __unused int tx) { uint16_t tspact = tsp_act_state();
@@ -96,7 +97,8 @@ void rffe_compute_gain(int16_t exp_inp, int16_t target_bb) trf6151_compute_gain(exp_inp, target_bb); }
-void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb) +void rffe_rx_win_ctrl(__unused int16_t exp_inp, __unused int16_t target_bb) { +#warning function not implemented yet /* FIXME */ } diff --git a/src/target/firmware/board/compal_e86/rffe_dualband_e86.c b/src/target/firmware/board/compal_e86/rffe_dualband_e86.c index 25bb099..a71a6d4 100644 --- a/src/target/firmware/board/compal_e86/rffe_dualband_e86.c +++ b/src/target/firmware/board/compal_e86/rffe_dualband_e86.c @@ -1,6 +1,7 @@ #include <stdint.h> #include <stdio.h>
+#include <defines.h> #include <debug.h> #include <memory.h> #include <rffe.h> @@ -26,7 +27,7 @@ #define RITA_STROBE TSPEN(2) /* Strobe for the Rita TSP */
/* switch RF Frontend Mode */ -void rffe_mode(enum gsm_band band, int tx) +void rffe_mode(__unused enum gsm_band band, __unused int tx) { uint16_t tspact = tsp_act_state();
@@ -100,7 +101,8 @@ void rffe_compute_gain(int16_t exp_inp, int16_t target_bb) trf6151_compute_gain(exp_inp, target_bb); }
-void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb) +void rffe_rx_win_ctrl(__unused int16_t exp_inp, __unused int16_t target_bb) { +#warning function not implemented yet /* FIXME */ } diff --git a/src/target/firmware/board/gta0x/rffe_gta0x_triband.c b/src/target/firmware/board/gta0x/rffe_gta0x_triband.c index f118d29..c138fde 100644 --- a/src/target/firmware/board/gta0x/rffe_gta0x_triband.c +++ b/src/target/firmware/board/gta0x/rffe_gta0x_triband.c @@ -1,6 +1,7 @@ #include <stdint.h> #include <stdio.h>
+#include <defines.h> #include <debug.h> #include <memory.h> #include <rffe.h> @@ -27,7 +28,7 @@ #define RITA_STROBE TSPEN(2) /* Strobe for the Rita TSP */
/* switch RF Frontend Mode */ -void rffe_mode(enum gsm_band band, int tx) +void rffe_mode(enum gsm_band band, __unused int tx) { uint16_t tspact = tsp_act_state();
@@ -125,7 +126,8 @@ void rffe_compute_gain(int16_t exp_inp, int16_t target_bb) trf6151_compute_gain(exp_inp, target_bb); }
-void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb) +void rffe_rx_win_ctrl(__unused int16_t exp_inp, __unused int16_t target_bb) { +#warning function not implemented yet /* FIXME */ } diff --git a/src/target/firmware/board/pirelli_dpl10/rffe_dpl10_triband.c b/src/target/firmware/board/pirelli_dpl10/rffe_dpl10_triband.c index d4d1342..e17dd6b 100644 --- a/src/target/firmware/board/pirelli_dpl10/rffe_dpl10_triband.c +++ b/src/target/firmware/board/pirelli_dpl10/rffe_dpl10_triband.c @@ -1,6 +1,7 @@ #include <stdint.h> #include <stdio.h>
+#include <defines.h> #include <debug.h> #include <memory.h> #include <rffe.h> @@ -28,7 +29,7 @@ #define RITA_STROBE TSPEN(1) /* Strobe for the Rita TSP */
/* switch RF Frontend Mode */ -void rffe_mode(enum gsm_band band, int tx) +void rffe_mode(enum gsm_band band, __unused int tx) { uint16_t tspact = tsp_act_state();
@@ -130,7 +131,8 @@ void rffe_compute_gain(int16_t exp_inp, int16_t target_bb) trf6151_compute_gain(exp_inp, target_bb); }
-void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb) +void rffe_rx_win_ctrl(__unused int16_t exp_inp, __unused int16_t target_bb) { +#warning function not implemented yet /* FIXME */ } diff --git a/src/target/firmware/calypso/i2c.c b/src/target/firmware/calypso/i2c.c index 02e1a03..cd05838 100644 --- a/src/target/firmware/calypso/i2c.c +++ b/src/target/firmware/calypso/i2c.c @@ -23,6 +23,7 @@ #include <stdint.h> #include <stdio.h>
+#include <defines.h> #include <debug.h> #include <memory.h> #include <i2c.h> @@ -100,7 +101,7 @@ int i2c_write(uint8_t chip, uint32_t addr, int alen, const uint8_t *buffer, int return 0; }
-void i2c_init(int speed, int slaveadd) +void i2c_init(__unused int speed, __unused int slaveadd) { /* scl_out = clk_func_ref / 3, clk_func_ref = master_clock_freq / (divisor_2 + 1) diff --git a/src/target/firmware/calypso/sim.c b/src/target/firmware/calypso/sim.c index 752628f..3f4dd15 100644 --- a/src/target/firmware/calypso/sim.c +++ b/src/target/firmware/calypso/sim.c @@ -27,6 +27,7 @@ #include <stdint.h> #include <stdio.h>
+#include <defines.h> #include <debug.h> #include <memory.h> #include <string.h> @@ -392,7 +393,7 @@ int calypso_sim_transmit(uint8_t *data, int length)
/* IRQ-Handler for simcard interface */ -void sim_irq_handler(enum irq_nr irq) +void sim_irq_handler(__unused enum irq_nr irq) { int regVal = readw(REG_SIM_IT);
diff --git a/src/target/firmware/comm/msgb.c b/src/target/firmware/comm/msgb.c index 4215d24..f2ff8c1 100644 --- a/src/target/firmware/comm/msgb.c +++ b/src/target/firmware/comm/msgb.c @@ -24,8 +24,10 @@ #include <sys/types.h> #include <asm/system.h>
+#include <defines.h> #include <debug.h> #include <delay.h> +#include <console.h>
#include <osmocom/core/msgb.h>
@@ -43,7 +45,7 @@ struct supermsg { uint8_t buf[MSGB_DATA_SIZE]; }; static struct supermsg msgs[MSGB_NUM]; -void *_talloc_zero(void *ctx, unsigned int size, const char *name) +void *_talloc_zero(__unused void *ctx, unsigned int size, __unused const char *name) { unsigned long flags; unsigned int i; diff --git a/src/target/firmware/comm/timer.c b/src/target/firmware/comm/timer.c index 6a649ae..66b01b1 100644 --- a/src/target/firmware/comm/timer.c +++ b/src/target/firmware/comm/timer.c @@ -19,6 +19,8 @@ */
#include <stdint.h> + +#include <defines.h> #include <debug.h> #include <osmocom/core/linuxlist.h>
@@ -187,7 +189,7 @@ int timer_check(void) return i; }
-static void timer_irq(enum irq_nr irq) +static void timer_irq(__unused enum irq_nr irq) { /* we only increment jiffies here. FIXME: does this need to be atomic? */ jiffies++; diff --git a/src/target/firmware/display/ssd1783.c b/src/target/firmware/display/ssd1783.c index 5696b48..7f96c1e 100644 --- a/src/target/firmware/display/ssd1783.c +++ b/src/target/firmware/display/ssd1783.c @@ -24,6 +24,7 @@ #include <stdint.h> #include <stdio.h> //#define DEBUG +#include <defines.h> #include <debug.h> #include <delay.h> #include <uwire.h> @@ -230,8 +231,9 @@ static int ssd1783_puts_col(const char *str, int txtline, int fColor, int bColor
/* interface to display driver core */
-static void ssd1783_set_attr(unsigned long attr) +static void ssd1783_set_attr(__unused unsigned long attr) { +#warning function not implemented yet /* FIXME */ }
diff --git a/src/target/firmware/display/ssd1963.c b/src/target/firmware/display/ssd1963.c index 49d5275..7c453a5 100644 --- a/src/target/firmware/display/ssd1963.c +++ b/src/target/firmware/display/ssd1963.c @@ -24,6 +24,7 @@
#include <stdint.h> #include <stdio.h> +#include <defines.h> #include <debug.h> #include <delay.h> #include <uwire.h> @@ -78,8 +79,6 @@ static void ssd1963_clrscr(void)
static void ssd1963_init(void) { - unsigned int i; - calypso_reset_set(RESET_EXT, 0); uwire_init(); delay_ms(3); @@ -183,8 +182,9 @@ static int ssd1963_puts_col(const char *str, int txtline, int fColor, int bColor
/* interface to display driver core */
-static void ssd1963_set_attr(unsigned long attr) +static void ssd1963_set_attr(__unused unsigned long attr) { +#warning function not implemented yet /* FIXME */ }
diff --git a/src/target/firmware/display/td014.c b/src/target/firmware/display/td014.c index 11ef3ea..df04c13 100644 --- a/src/target/firmware/display/td014.c +++ b/src/target/firmware/display/td014.c @@ -24,6 +24,7 @@ #include <stdint.h> #include <stdio.h>
+#include <defines.h> #include <debug.h> #include <delay.h> #include <uwire.h> @@ -158,8 +159,9 @@ static int td014_puts_col(const char *str, int txtline, int fColor, int bColor)
/* interface to display driver core */
-static void td014_set_attr(unsigned long attr) +static void td014_set_attr(__unused unsigned long attr) { +#warning function not implemented yet /* FIXME */ }
diff --git a/src/target/firmware/flash/cfi_flash.c b/src/target/firmware/flash/cfi_flash.c index 4f31d78..167cf20 100644 --- a/src/target/firmware/flash/cfi_flash.c +++ b/src/target/firmware/flash/cfi_flash.c @@ -140,6 +140,9 @@ static inline uint16_t flash_read16(const void *base_addr, uint32_t offset) __ramtext static char flash_protected(uint32_t block_offset) { + /* prevent compiler from complaining when preprocessor causes + variable block_offset to be unused */ + (void)block_offset; #ifdef CONFIG_FLASH_WRITE # ifdef CONFIG_FLASH_WRITE_LOADER return 0; diff --git a/src/target/firmware/layer1/afc.c b/src/target/firmware/layer1/afc.c index a51a107..f136ef1 100644 --- a/src/target/firmware/layer1/afc.c +++ b/src/target/firmware/layer1/afc.c @@ -23,6 +23,7 @@ #include <stdint.h> #include <stdio.h>
+#include <defines.h> #include <debug.h> #include <osmocom/gsm/gsm_utils.h>
@@ -117,7 +118,7 @@ void afc_input(int32_t freq_error, uint16_t arfcn, int valid) }
/* callback function for runavg */ -static void afc_ravg_output(struct running_avg *ravg, int32_t avg) +static void afc_ravg_output(__unused struct running_avg *ravg, int32_t avg) { afc_correct(avg, afc_state.arfcn); } diff --git a/src/target/firmware/layer1/apc.c b/src/target/firmware/layer1/apc.c index 480c760..c3180d3 100644 --- a/src/target/firmware/layer1/apc.c +++ b/src/target/firmware/layer1/apc.c @@ -22,6 +22,8 @@
#include <errno.h>
+#include <defines.h> + #include <osmocom/core/utils.h> #include <osmocom/gsm/gsm_utils.h>
@@ -33,7 +35,7 @@ extern const int dbm2apc_gsm900_max;
/* determine the AUXAPC value by the Tx Power Level */ -int16_t apc_tx_dbm2auxapc(enum gsm_band band, int8_t dbm) +int16_t apc_tx_dbm2auxapc(__unused enum gsm_band band, int8_t dbm) { if (dbm < 0) return -ERANGE; diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c index ed43e14..fd4ad09 100644 --- a/src/target/firmware/layer1/l23_api.c +++ b/src/target/firmware/layer1/l23_api.c @@ -26,6 +26,7 @@ #include <stdio.h> #include <string.h>
+#include <defines.h> #include <debug.h> #include <byteorder.h>
@@ -302,11 +303,8 @@ static void l1ctl_rx_crypto_req(struct msgb *msg) }
/* receive a L1CTL_DM_REL_REQ from L23 */ -static void l1ctl_rx_dm_rel_req(struct msgb *msg) +static void l1ctl_rx_dm_rel_req(__unused struct msgb *msg) { - struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data; - struct l1ctl_info_ul *ul = (struct l1ctl_info_ul *) l1h->data; - printd("L1CTL_DM_REL_REQ\n"); l1a_mftask_set(0); l1s.dedicated.type = GSM_DCHAN_NONE; @@ -574,7 +572,7 @@ static void l1ctl_sim_req(struct msgb *msg) }
/* callback from SERCOMM when L2 sends a message to L1 */ -static void l1a_l23_rx_cb(uint8_t dlci, struct msgb *msg) +static void l1a_l23_rx_cb(__unused uint8_t dlci, struct msgb *msg) { struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
diff --git a/src/target/firmware/layer1/prim_fbsb.c b/src/target/firmware/layer1/prim_fbsb.c index 023902d..06ecee2 100644 --- a/src/target/firmware/layer1/prim_fbsb.c +++ b/src/target/firmware/layer1/prim_fbsb.c @@ -178,8 +178,6 @@ static int l1s_sbdet_resp(__unused uint8_t p1, uint8_t attempt, int qbits, fn_offset; struct l1_cell_info *cinfo = &l1s.serving_cell; int fnr_delta, bits_delta; - struct l1ctl_sync_new_ccch_resp *l1; - struct msgb *msg;
putchart('s');
@@ -327,7 +325,7 @@ static int read_fb_result(struct mon_state *st, int attempt) }
static void fbinfo2cellinfo(struct l1_cell_info *cinfo, - const struct mon_state *mon) + __unused const struct mon_state *mon) { int ntdma, qbits, fn_offset, fnr_delta, bits_delta;
@@ -523,8 +521,6 @@ static const struct tdma_sched_item fb_sched_set[] = { /* Asynchronous completion handler for FB detection */ static void l1a_fb_compl(__unused enum l1_compl c) { - struct l1_cell_info *cinfo = &l1s.serving_cell; - if (last_fb->attempt >= 13) { /* FB detection failed, signal this via L1CTL */ return l1ctl_fbsb_resp(255); diff --git a/src/target/firmware/layer1/prim_rach.c b/src/target/firmware/layer1/prim_rach.c index 47f7424..f0c553e 100644 --- a/src/target/firmware/layer1/prim_rach.c +++ b/src/target/firmware/layer1/prim_rach.c @@ -57,7 +57,6 @@ struct { /* p1: type of operation (0: one NB, 1: one RACH burst, 2: four NB */ static int l1s_tx_rach_cmd(__unused uint8_t p1, __unused uint8_t p2, __unused uint16_t p3) { - int i; uint16_t *info_ptr; uint8_t data[2];
diff --git a/src/target/firmware/layer1/prim_tch.c b/src/target/firmware/layer1/prim_tch.c index 96858fb..e5f6a5a 100644 --- a/src/target/firmware/layer1/prim_tch.c +++ b/src/target/firmware/layer1/prim_tch.c @@ -500,7 +500,7 @@ const struct tdma_sched_item tch_sched_set[] = { /* This task is needed to perform some operation in the DSP when there is * no data to be exchanged */
-static int l1s_tch_d_resp(__unused uint8_t p1, __unused uint8_t p2, uint16_t p3) +static int l1s_tch_d_resp(__unused uint8_t p1, __unused uint8_t p2, __unused uint16_t p3) { /* mark READ page as being used */ dsp_api.r_page_used = 1; diff --git a/src/target/firmware/layer1/prim_tx_nb.c b/src/target/firmware/layer1/prim_tx_nb.c index 3038178..b886200 100644 --- a/src/target/firmware/layer1/prim_tx_nb.c +++ b/src/target/firmware/layer1/prim_tx_nb.c @@ -75,7 +75,6 @@ static int l1s_tx_cmd(uint8_t p1, uint8_t burst_id, uint16_t p3) { uint16_t arfcn; uint8_t tsc, tn; - uint8_t mf_task_id = p3 & 0xff; uint8_t mf_task_flags = p3 >> 8;
putchart('T'); diff --git a/src/target/firmware/layer1/toa.c b/src/target/firmware/layer1/toa.c index 7d80d95..e5b857c 100644 --- a/src/target/firmware/layer1/toa.c +++ b/src/target/firmware/layer1/toa.c @@ -24,6 +24,7 @@ #include <stdint.h> #include <stdio.h>
+#include <defines.h> #include <debug.h> #include <osmocom/gsm/gsm_utils.h>
@@ -71,7 +72,7 @@ void toa_reset(void) }
/* callback function for runavg */ -static void toa_ravg_output(struct running_avg *ravg, int32_t avg) +static void toa_ravg_output(__unused struct running_avg *ravg, int32_t avg) { if (avg != 16) { printf("TOA AVG is not 16 qbits, correcting (got %ld)\n", avg); diff --git a/src/target/firmware/layer1/tpu_window.c b/src/target/firmware/layer1/tpu_window.c index 2fdb048..e8762d4 100644 --- a/src/target/firmware/layer1/tpu_window.c +++ b/src/target/firmware/layer1/tpu_window.c @@ -135,7 +135,7 @@ void l1s_rx_win_ctrl(uint16_t arfcn, enum l1_rxwin_type wtype, uint8_t tn_ofs) trf6151_set_mode(TRF6151_IDLE); }
-void l1s_tx_win_ctrl(uint16_t arfcn, enum l1_txwin_type wtype, uint8_t pwr, uint8_t tn_ofs) +void l1s_tx_win_ctrl(uint16_t arfcn, enum l1_txwin_type wtype, __unused uint8_t pwr, uint8_t tn_ofs) { uint16_t offset;
diff --git a/src/target/firmware/rf/trf6151.c b/src/target/firmware/rf/trf6151.c index 5360402..29dd408 100644 --- a/src/target/firmware/rf/trf6151.c +++ b/src/target/firmware/rf/trf6151.c @@ -23,6 +23,7 @@ #include <stdint.h> #include <stdio.h>
+#include <defines.h> #include <debug.h> #include <memory.h> #include <keypad.h> @@ -568,6 +569,11 @@ void trf6151_rx_window(int16_t start_qbits, uint16_t arfcn) /* prepare a Tx window with the TRF6151 finished at time 'start' (in qbits) */ void trf6151_tx_window(int16_t start_qbits, uint16_t arfcn) { + /* prevent compiler from complaining when preprocessor causes + variables start_qbits and arfcn to be unused */ + (void)start_qbits; + (void)arfcn; + #ifdef CONFIG_TX_ENABLE int16_t start_pll_qbits;
this eliminates the occurrance of gcc warnings warning: ‘?’ may be used uninitialized in this function warning: ‘?’ is used uninitialized in this function --- src/target/firmware/apps/loader/main.c | 2 +- src/target/firmware/apps/loader_mtk/main.c | 2 +- src/target/firmware/layer1/l23_api.c | 2 +- src/target/firmware/layer1/mframe_sched.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/target/firmware/apps/loader/main.c b/src/target/firmware/apps/loader/main.c index 18f0b36..de2193a 100644 --- a/src/target/firmware/apps/loader/main.c +++ b/src/target/firmware/apps/loader/main.c @@ -204,7 +204,7 @@ static void cmd_handler(uint8_t dlci, struct msgb *msg)
uint8_t command = msgb_get_u8(msg);
- int res; + int res = 0;
flash_lock_t lock;
diff --git a/src/target/firmware/apps/loader_mtk/main.c b/src/target/firmware/apps/loader_mtk/main.c index 9bfaa7e..0bc4ab8 100644 --- a/src/target/firmware/apps/loader_mtk/main.c +++ b/src/target/firmware/apps/loader_mtk/main.c @@ -145,7 +145,7 @@ static void cmd_handler(uint8_t dlci, struct msgb *msg)
uint8_t command = msgb_get_u8(msg);
- int res; + int res = 0;
flash_lock_t lock;
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c index fd4ad09..bd990bb 100644 --- a/src/target/firmware/layer1/l23_api.c +++ b/src/target/firmware/layer1/l23_api.c @@ -69,7 +69,7 @@ static uint32_t chan_nr2mf_task_mask(uint8_t chan_nr, uint8_t neigh_mode) uint8_t lch_idx; enum mframe_task master_task = 0; uint32_t neigh_task = 0; - enum mf_type multiframe; + enum mf_type multiframe = MFNONE;
if (cbits == 0x01) { lch_idx = 0; diff --git a/src/target/firmware/layer1/mframe_sched.c b/src/target/firmware/layer1/mframe_sched.c index 6281c3d..5227d41 100644 --- a/src/target/firmware/layer1/mframe_sched.c +++ b/src/target/firmware/layer1/mframe_sched.c @@ -332,7 +332,7 @@ static const struct mframe_sched_item *sched_set_for_task[32] = { /* encodes a channel number according to 08.58 Chapter 9.3.1 */ uint8_t mframe_task2chan_nr(enum mframe_task mft, uint8_t ts) { - uint8_t cbits; + uint8_t cbits = 0;
switch (mft) { case MF_TASK_BCCH_NORM:
On 11/23/2011 11:59 PM, Alexander Huemer wrote:
+++ b/src/target/firmware/layer1/mframe_sched.c @@ -332,7 +332,7 @@ static const struct mframe_sched_item *sched_set_for_task[32] = { /* encodes a channel number according to 08.58 Chapter 9.3.1 */ uint8_t mframe_task2chan_nr(enum mframe_task mft, uint8_t ts) {
- uint8_t cbits;
uint8_t cbits = 0;
switch (mft) { case MF_TASK_BCCH_NORM:
uninitialized variables are tricky. In this case it is more the question of which enum value is not handled in the switch/case statement (or if the gcc fails to look at all values of the enum). E.g. a
default: cbits = 0; BIG_WARNING(mft);
might be better?
On Thu, Nov 24, 2011 at 12:07:23AM +0100, Holger Hans Peter Freyther wrote:
On 11/23/2011 11:59 PM, Alexander Huemer wrote:
+++ b/src/target/firmware/layer1/mframe_sched.c @@ -332,7 +332,7 @@ static const struct mframe_sched_item *sched_set_for_task[32] = { /* encodes a channel number according to 08.58 Chapter 9.3.1 */ uint8_t mframe_task2chan_nr(enum mframe_task mft, uint8_t ts) {
- uint8_t cbits;
uint8_t cbits = 0;
switch (mft) { case MF_TASK_BCCH_NORM:
uninitialized variables are tricky. In this case it is more the question of which enum value is not handled in the switch/case statement (or if the gcc fails to look at all values of the enum). E.g. a
default: cbits = 0; BIG_WARNING(mft);
might be better?
i am a bit unsure about the best way to handle such stuff. default cases have the drawback that gcc does not tell you any more that enum values are not handled in the switch. so i try to avoid default cases on enums.
On 11/24/2011 12:41 AM, Alexander Huemer wrote:
On Thu, Nov 24, 2011 at 12:07:23AM +0100, Holger Hans Peter Freyther wrote:
On 11/23/2011 11:59 PM, Alexander Huemer wrote:
i am a bit unsure about the best way to handle such stuff. default cases have the drawback that gcc does not tell you any more that enum values are not handled in the switch. so i try to avoid default cases on enums.
well, a) we have a warning b) we initialize cbits and shut the compiler up but still miss some case values. c) we add a default: with a runtime warning..
I tend to prefer a) and c) over b).
this eliminates the occurrance of gcc warnings warning: initialization from incompatible pointer type warning: assignment from incompatible pointer type --- src/target/firmware/apps/loader/main.c | 2 +- src/target/firmware/apps/loader_mtk/main.c | 2 +- src/target/firmware/display/ssd1783.c | 2 +- src/target/firmware/display/ssd1963.c | 2 +- src/target/firmware/display/td014.c | 2 +- src/target/firmware/layer1/prim_pm.c | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/target/firmware/apps/loader/main.c b/src/target/firmware/apps/loader/main.c index de2193a..602297b 100644 --- a/src/target/firmware/apps/loader/main.c +++ b/src/target/firmware/apps/loader/main.c @@ -308,7 +308,7 @@ static void cmd_handler(uint8_t dlci, struct msgb *msg) msgb_put_u8(reply, 1); // nchips
// chip 1 - msgb_put_u32(reply, the_flash.f_base); + msgb_put_u32(reply, *(uint32_t *)the_flash.f_base); msgb_put_u32(reply, the_flash.f_size); msgb_put_u8(reply, the_flash.f_nregions);
diff --git a/src/target/firmware/apps/loader_mtk/main.c b/src/target/firmware/apps/loader_mtk/main.c index 0bc4ab8..4345443 100644 --- a/src/target/firmware/apps/loader_mtk/main.c +++ b/src/target/firmware/apps/loader_mtk/main.c @@ -249,7 +249,7 @@ static void cmd_handler(uint8_t dlci, struct msgb *msg) msgb_put_u8(reply, 1); // nchips
// chip 1 - msgb_put_u32(reply, the_flash.f_base); + msgb_put_u32(reply, *(uint32_t *)the_flash.f_base); msgb_put_u32(reply, the_flash.f_size); msgb_put_u8(reply, the_flash.f_nregions);
diff --git a/src/target/firmware/display/ssd1783.c b/src/target/firmware/display/ssd1783.c index 7f96c1e..71c3cf3 100644 --- a/src/target/firmware/display/ssd1783.c +++ b/src/target/firmware/display/ssd1783.c @@ -237,7 +237,7 @@ static void ssd1783_set_attr(__unused unsigned long attr) /* FIXME */ }
-static int ssd1783_putc(unsigned int c) +static int ssd1783_putc(unsigned char c) { return ssd1783_putc_col(c, BLACK, WHITE); } diff --git a/src/target/firmware/display/ssd1963.c b/src/target/firmware/display/ssd1963.c index 7c453a5..0b2c49f 100644 --- a/src/target/firmware/display/ssd1963.c +++ b/src/target/firmware/display/ssd1963.c @@ -188,7 +188,7 @@ static void ssd1963_set_attr(__unused unsigned long attr) /* FIXME */ }
-static int ssd1963_putc(unsigned int c) +static int ssd1963_putc(unsigned char c) { return ssd1963_putc_col(c, BLACK, WHITE); } diff --git a/src/target/firmware/display/td014.c b/src/target/firmware/display/td014.c index df04c13..b4dd1c0 100644 --- a/src/target/firmware/display/td014.c +++ b/src/target/firmware/display/td014.c @@ -165,7 +165,7 @@ static void td014_set_attr(__unused unsigned long attr) /* FIXME */ }
-static int td014_putc(unsigned int c) +static int td014_putc(unsigned char c) { return td014_putc_col(c, BLACK, WHITE); } diff --git a/src/target/firmware/layer1/prim_pm.c b/src/target/firmware/layer1/prim_pm.c index c2d85ac..640f960 100644 --- a/src/target/firmware/layer1/prim_pm.c +++ b/src/target/firmware/layer1/prim_pm.c @@ -108,7 +108,7 @@ static int l1s_pm_resp(uint8_t num_meas, __unused uint8_t p2, l1s.pm.msg = l1ctl_msgb_alloc(L1CTL_PM_CONF); }
- pmr = msgb_put(l1s.pm.msg, sizeof(*pmr)); + pmr = (struct l1ctl_pm_conf *)msgb_put(l1s.pm.msg, sizeof(*pmr)); pmr->band_arfcn = htons(arfcn); /* FIXME: do this as RxLev rather than DBM8 ? */ pmr->pm[0] = dbm2rxlev(agc_inp_dbm8_by_pm(pm_level[0])/8); @@ -124,7 +124,7 @@ static int l1s_pm_resp(uint8_t num_meas, __unused uint8_t p2, l1s.pm.range.arfcn_next++; } else { /* we have finished, flush the msgb to L2 */ - struct l1ctl_hdr *l1h = l1s.pm.msg->l1h; + struct l1ctl_hdr *l1h = (struct l1ctl_hdr *)l1s.pm.msg->l1h; l1h->flags |= L1CTL_F_DONE; l1_queue_for_l2(l1s.pm.msg); l1s.pm.msg = NULL;
this eliminates the occurrance of gcc warning warning: comparison between signed and unsigned --- src/target/firmware/apps/loader/main.c | 10 +++++----- src/target/firmware/flash/cfi_flash.c | 2 +- src/target/firmware/layer1/prim_pm.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/target/firmware/apps/loader/main.c b/src/target/firmware/apps/loader/main.c index 602297b..b4c51de 100644 --- a/src/target/firmware/apps/loader/main.c +++ b/src/target/firmware/apps/loader/main.c @@ -125,7 +125,7 @@ static const uint8_t phone_ack[] = { 0x1b, 0xf6, 0x02, 0x00, 0x41, 0x03, 0x42 }; int main(void) { /* Simulate a compal loader saying "ACK" */ - int i = 0; + unsigned int i; for (i = 0; i < sizeof(phone_ack); i++) { putchar_asm(phone_ack[i]); } @@ -166,11 +166,11 @@ int main(void) the_flash.f_size, the_flash.f_base, the_flash.f_nregions);
- int i; - for (i = 0; i < the_flash.f_nregions; i++) { + unsigned int j; + for (j = 0; j < the_flash.f_nregions; j++) { printf(" Region %d of %zu pages with %zu bytes each.\n", i, - the_flash.f_regions[i].fr_bnum, + the_flash.f_regions[j].fr_bnum, the_flash.f_regions[i].fr_bsize); }
@@ -312,7 +312,7 @@ static void cmd_handler(uint8_t dlci, struct msgb *msg) msgb_put_u32(reply, the_flash.f_size); msgb_put_u8(reply, the_flash.f_nregions);
- int i; + unsigned int i; for (i = 0; i < the_flash.f_nregions; i++) { msgb_put_u32(reply, the_flash.f_regions[i].fr_bnum); msgb_put_u32(reply, the_flash.f_regions[i].fr_bsize); diff --git a/src/target/firmware/flash/cfi_flash.c b/src/target/firmware/flash/cfi_flash.c index 167cf20..eaaedff 100644 --- a/src/target/firmware/flash/cfi_flash.c +++ b/src/target/firmware/flash/cfi_flash.c @@ -402,7 +402,7 @@ __ramtext static int get_query(void *base_addr, struct cfi_query *query) { int res = 0; - int i; + unsigned int i;
flash_write_cmd(base_addr, CFI_CMD_CFI);
diff --git a/src/target/firmware/layer1/prim_pm.c b/src/target/firmware/layer1/prim_pm.c index 640f960..54a6780 100644 --- a/src/target/firmware/layer1/prim_pm.c +++ b/src/target/firmware/layer1/prim_pm.c @@ -101,7 +101,7 @@ static int l1s_pm_resp(uint8_t num_meas, __unused uint8_t p2, if (!l1s.pm.msg) l1s.pm.msg = l1ctl_msgb_alloc(L1CTL_PM_CONF);
- if (msgb_tailroom(l1s.pm.msg) < sizeof(*pmr)) { + if (msgb_tailroom(l1s.pm.msg) < (int)sizeof(*pmr)) { /* flush current msgb */ l1_queue_for_l2(l1s.pm.msg); /* allocate a new msgb and initialize header */
this eliminates the occurrance of gcc warning warning: ‘?’ defined but not used --- src/target/firmware/calypso/dsp.c | 2 ++ src/target/firmware/calypso/irq.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/target/firmware/calypso/dsp.c b/src/target/firmware/calypso/dsp.c index 8bf9749..470dfc4 100644 --- a/src/target/firmware/calypso/dsp.c +++ b/src/target/firmware/calypso/dsp.c @@ -117,6 +117,7 @@ static void dsp_bl_start_at(uint16_t addr) writew(BL_CMD_COPY_BLOCK, BL_CMD_STATUS); }
+#if 0 static int dsp_bl_upload_sections(const struct dsp_section *sec) { /* Make sure the bootloader is ready */ @@ -151,6 +152,7 @@ static int dsp_bl_upload_sections(const struct dsp_section *sec)
return 0; } +#endif
static int dsp_upload_sections_api(const struct dsp_section *sec, uint16_t dsp_base_api) { diff --git a/src/target/firmware/calypso/irq.c b/src/target/firmware/calypso/irq.c index 136fd55..9c2e0ed 100644 --- a/src/target/firmware/calypso/irq.c +++ b/src/target/firmware/calypso/irq.c @@ -232,6 +232,7 @@ static void set_default_priorities(void) } }
+#if 0 static uint32_t irq_nest_mask; /* mask off all interrupts that have a lower priority than irq_nr */ static void mask_all_lower_prio_irqs(enum irq_nr irqnr) @@ -250,6 +251,7 @@ static void mask_all_lower_prio_irqs(enum irq_nr irqnr) irq_nest_mask |= (1 << i); } } +#endif
void irq_init(void) {
this eliminates the occurrance of gcc warnings warning: implicit declaration of function ‘?’ warning: redundant redeclaration of ‘?’ --- src/target/firmware/apps/chainload/main.c | 1 + src/target/firmware/apps/loader/main.c | 1 + src/target/firmware/board/compal_e86/init.c | 1 + src/target/firmware/board/compal_e99/init.c | 1 + src/target/firmware/board/se_j100/init.c | 1 + src/target/firmware/include/layer1/async.h | 8 ++------ src/target/firmware/include/layer1/prim.h | 2 ++ src/target/firmware/layer1/l23_api.c | 4 ++-- src/target/firmware/layer1/prim_fbsb.c | 2 ++ src/target/firmware/layer1/prim_freq.c | 1 + src/target/firmware/layer1/prim_rach.c | 1 + src/target/firmware/layer1/prim_rx_nb.c | 2 ++ src/target/firmware/layer1/tpu_window.c | 1 + 13 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/target/firmware/apps/chainload/main.c b/src/target/firmware/apps/chainload/main.c index 5121837..9dfa217 100644 --- a/src/target/firmware/apps/chainload/main.c +++ b/src/target/firmware/apps/chainload/main.c @@ -29,6 +29,7 @@ #include <delay.h>
#include <calypso/clock.h> +#include <calypso/timer.h>
/* Main Program */
diff --git a/src/target/firmware/apps/loader/main.c b/src/target/firmware/apps/loader/main.c index b4c51de..4ff3b6a 100644 --- a/src/target/firmware/apps/loader/main.c +++ b/src/target/firmware/apps/loader/main.c @@ -47,6 +47,7 @@ #include <calypso/misc.h> #include <uart.h> #include <calypso/timer.h> +#include <calypso/backlight.h>
#include <flash/cfi_flash.h>
diff --git a/src/target/firmware/board/compal_e86/init.c b/src/target/firmware/board/compal_e86/init.c index 1de6193..9dbda0e 100644 --- a/src/target/firmware/board/compal_e86/init.c +++ b/src/target/firmware/board/compal_e86/init.c @@ -41,6 +41,7 @@ #include <calypso/backlight.h>
#include <comm/sercomm.h> +#include <comm/timer.h>
#include <abb/twl3025.h> #include <rf/trf6151.h> diff --git a/src/target/firmware/board/compal_e99/init.c b/src/target/firmware/board/compal_e99/init.c index 0c218a8..1c76749 100644 --- a/src/target/firmware/board/compal_e99/init.c +++ b/src/target/firmware/board/compal_e99/init.c @@ -41,6 +41,7 @@ #include <calypso/backlight.h>
#include <comm/sercomm.h> +#include <comm/timer.h>
#include <abb/twl3025.h> #include <rf/trf6151.h> diff --git a/src/target/firmware/board/se_j100/init.c b/src/target/firmware/board/se_j100/init.c index 30c3e6b..e8691cf 100644 --- a/src/target/firmware/board/se_j100/init.c +++ b/src/target/firmware/board/se_j100/init.c @@ -41,6 +41,7 @@ #include <calypso/backlight.h>
#include <comm/sercomm.h> +#include <comm/timer.h>
#include <abb/twl3025.h> #include <rf/trf6151.h> diff --git a/src/target/firmware/include/layer1/async.h b/src/target/firmware/include/layer1/async.h index a9fa08d..0935ec3 100644 --- a/src/target/firmware/include/layer1/async.h +++ b/src/target/firmware/include/layer1/async.h @@ -32,18 +32,14 @@ int l1a_txq_msgb_count(struct llist_head *queue); /* flush all pending msgb */ void l1a_txq_msgb_flush(struct llist_head *queue);
-/* request a RACH */ -void l1a_rach_req(uint16_t offset, uint8_t combined, uint8_t ra); - -/* schedule frequency change */ -void l1a_freq_req(uint32_t fn_sched); - /* Enable a repeating multiframe task */ void l1a_mftask_enable(enum mframe_task task);
/* Disable a repeating multiframe task */ void l1a_mftask_disable(enum mframe_task task);
+void l1a_mftask_set(uint32_t tasks); + /* Set TCH mode */ uint8_t l1a_tch_mode_set(uint8_t mode);
diff --git a/src/target/firmware/include/layer1/prim.h b/src/target/firmware/include/layer1/prim.h index 30c51ae..f01d64e 100644 --- a/src/target/firmware/include/layer1/prim.h +++ b/src/target/firmware/include/layer1/prim.h @@ -19,7 +19,9 @@ void l1s_pm_test(uint8_t base_fn, uint16_t arfcn); void l1s_nb_test(uint8_t base_fn);
void l1s_fbsb_req(uint8_t base_fn, struct l1ctl_fbsb_req *req); +/* schedule frequency change */ void l1a_freq_req(uint32_t fn_sched); +/* request a RACH */ void l1a_rach_req(uint16_t offset, uint8_t combined, uint8_t ra);
/* Primitives raw scheduling sets */ diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c index bd990bb..b21d8f0 100644 --- a/src/target/firmware/layer1/l23_api.c +++ b/src/target/firmware/layer1/l23_api.c @@ -39,10 +39,12 @@ #include <layer1/mframe_sched.h> #include <layer1/prim.h> #include <layer1/tpu_window.h> +#include <layer1/sched_gsmtime.h>
#include <abb/twl3025.h> #include <rf/trf6151.h> #include <calypso/sim.h> +#include <calypso/dsp.h>
#include <l1ctl_proto.h>
@@ -551,8 +553,6 @@ static void l1ctl_rx_traffic_req(struct msgb *msg) l1a_txq_msgb_enq(&l1s.tx_queue[L1S_CHAN_TRAFFIC], msg); }
-void sim_apdu(uint16_t len, uint8_t *data); - static void l1ctl_sim_req(struct msgb *msg) { uint16_t len = msg->len - sizeof(struct l1ctl_hdr); diff --git a/src/target/firmware/layer1/prim_fbsb.c b/src/target/firmware/layer1/prim_fbsb.c index 06ecee2..936afbc 100644 --- a/src/target/firmware/layer1/prim_fbsb.c +++ b/src/target/firmware/layer1/prim_fbsb.c @@ -31,6 +31,7 @@ #include <debug.h> #include <memory.h> #include <byteorder.h> +#include <rffe.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/core/msgb.h> #include <calypso/dsp_api.h> @@ -48,6 +49,7 @@ #include <layer1/mframe_sched.h> #include <layer1/tpu_window.h> #include <layer1/l23_api.h> +#include <layer1/agc.h>
#include <l1ctl_proto.h>
diff --git a/src/target/firmware/layer1/prim_freq.c b/src/target/firmware/layer1/prim_freq.c index 64e08b5..057caa7 100644 --- a/src/target/firmware/layer1/prim_freq.c +++ b/src/target/firmware/layer1/prim_freq.c @@ -46,6 +46,7 @@ #include <layer1/tdma_sched.h> #include <layer1/tpu_window.h> #include <layer1/l23_api.h> +#include <layer1/sched_gsmtime.h>
#include <l1ctl_proto.h>
diff --git a/src/target/firmware/layer1/prim_rach.c b/src/target/firmware/layer1/prim_rach.c index f0c553e..3825d7f 100644 --- a/src/target/firmware/layer1/prim_rach.c +++ b/src/target/firmware/layer1/prim_rach.c @@ -46,6 +46,7 @@ #include <layer1/tdma_sched.h> #include <layer1/tpu_window.h> #include <layer1/l23_api.h> +#include <layer1/sched_gsmtime.h>
#include <l1ctl_proto.h>
diff --git a/src/target/firmware/layer1/prim_rx_nb.c b/src/target/firmware/layer1/prim_rx_nb.c index 7eb4548..ade23a0 100644 --- a/src/target/firmware/layer1/prim_rx_nb.c +++ b/src/target/firmware/layer1/prim_rx_nb.c @@ -29,6 +29,7 @@ #include <debug.h> #include <memory.h> #include <byteorder.h> +#include <rffe.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/core/msgb.h> #include <calypso/dsp_api.h> @@ -48,6 +49,7 @@ #include <layer1/l23_api.h> #include <layer1/rfch.h> #include <layer1/prim.h> +#include <layer1/agc.h>
#include <l1ctl_proto.h>
diff --git a/src/target/firmware/layer1/tpu_window.c b/src/target/firmware/layer1/tpu_window.c index e8762d4..c5b4d63 100644 --- a/src/target/firmware/layer1/tpu_window.c +++ b/src/target/firmware/layer1/tpu_window.c @@ -33,6 +33,7 @@
#include <layer1/sync.h> #include <layer1/tpu_window.h> +#include <layer1/rfch.h>
/* all units in GSM quarter-bits (923.1ns) */ #define L1_TDMA_LENGTH_Q 5000
osmocom-bb\src\host\layer23\include\l1ctl_proto.h
git 1.7.4.msysgit.0 00000000 2E 2E 2F 2E 2E 2F 2E 2E 2F 2E 2E 2F 69 6E 63 6C ../../../../incl 00000016 75 64 65 2F 6C 31 63 74 6C 5F 70 72 6F 74 6F 2E ude/l1ctl_proto. 00000032 68 h
change -> #include <../../../../include/l1ctl_proto.h>
git 1.7.5.1 00000000 21 3C 73 79 6D 6C 69 6E 6B 3E FF FE 2E 00 2E 00 !<symlink>ÿþ. . 00000016 2F 00 2E 00 2E 00 2F 00 2E 00 2E 00 2F 00 2E 00 / . . / . . / . 00000032 2E 00 2F 00 69 00 6E 00 63 00 6C 00 75 00 64 00 . / i n c l u d 00000048 65 00 2F 00 6C 00 31 00 63 00 74 00 6C 00 5F 00 e / l 1 c t l _ 00000064 70 00 72 00 6F 00 74 00 6F 00 2E 00 68 00 00 00 p r o t o . h
error in git?
osmocom-bb\src\shared\libosmocore\src\socket.c int osmo_sockaddr_is_local(struct sockaddr *addr, socklen_t addrlen)
osmocom-bb_win\src\shared\libosmocore\include\osmocom\core\socket.h int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen);
change socket.c -> socklen_t -> unsigned int
gcc 3.4.4 g++ 4.5.3
error in gcc?
thank you
On Tue, Nov 29, 2011 at 12:18:10AM +0100, Juantxi wrote:
change -> #include <../../../../include/l1ctl_proto.h>
git 1.7.5.1 00000000 21 3C 73 79 6D 6C 69 6E 6B 3E FF FE 2E 00 2E 00 !<symlink>ÿþ. . 00000016 2F 00 2E 00 2E 00 2F 00 2E 00 2E 00 2F 00 2E 00 / . . / . . / . 00000032 2E 00 2F 00 69 00 6E 00 63 00 6C 00 75 00 64 00 . / i n c l u d 00000048 65 00 2F 00 6C 00 31 00 63 00 74 00 6C 00 5F 00 e / l 1 c t l _ 00000064 70 00 72 00 6F 00 74 00 6F 00 2E 00 68 00 00 00 p r o t o . h
error in git?
I'm not sure how git deals with symbolik links on cygwin. Sorry.
While some users have had success using cygwin, it is not a platform that we support. You're mostly on your own here, and should probably have some experience with fixing up smaller issues related to the cygwin API differences and how git behaves on your platform.
Regards, Harald
While some users have had success using cygwin, it is not a platform that we support. You're mostly on your own here, and should probably have some experience with fixing up smaller issues related to the cygwin API differences and how git behaves on your platform.
compilation process using CygWin is OK!
need socket.c change: int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen)
In linux use old slackware live cd because I have only 1 laptop 256MB 20MB hard disk 800MHz same versions are identical in cygwin other no
autotool -> not install shtool -> not install make 3.81 YES automake 1.11.1 YES libtool 2.4 YES pkg-config 0.23 YES autoconf 2.68 YES M4 1.4.16 - YES git 1.7.5.1 YES gcc 3.4.4 YES g++ 4.5.3 NO! older in wifislax 3.4.4 gnuarm bu-2.17 gcc 4.1.1 NO! older in my linux gnuarm 3.4.3
my problem is:
"MAKE: no rules for handlers.p"
very rare! but ...
"continue in next weeks"
ja ja ja
good bye
Hi!
Just a minor note:
On Tue, Nov 29, 2011 at 09:02:48AM +0100, Juantxi wrote:
need socket.c change: int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen)
cygwin also defines a 'socklen_t', and it would be a better fix to #include the file that provides this definition...
Thank you for your answers but I do not answer if that's a hassle for you
months ago you had this version of gnuarm:
binutils-2.15, gcc-3.4.3-c-c++-java, newlib-1.12.0, insight-6.1, TAR BZ2 [56.0MB]
is valid to compile today osmocom?
----- Original Message ----- From: "Harald Welte" laforge@gnumonks.org To: "Juantxi" juantxipazos@yahoo.es Cc: baseband-devel@lists.osmocom.org Sent: Thursday, December 01, 2011 8:35 AM Subject: cygwin / socklen_t (was Re: small problem)
Hi!
Just a minor note:
On Tue, Nov 29, 2011 at 09:02:48AM +0100, Juantxi wrote:
need socket.c change: int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen)
cygwin also defines a 'socklen_t', and it would be a better fix to #include the file that provides this definition...
--
- Harald Welte laforge@gnumonks.org
http://laforge.gnumonks.org/
"Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6)
this eliminates the occurrance of gcc warning warning: cast increases required alignment of target type --- src/target/firmware/include/comm/timer.h | 4 +++- src/target/firmware/include/layer1/sched_gsmtime.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/target/firmware/include/comm/timer.h b/src/target/firmware/include/comm/timer.h index db7d1a5..7025cda 100644 --- a/src/target/firmware/include/comm/timer.h +++ b/src/target/firmware/include/comm/timer.h @@ -21,6 +21,8 @@ #ifndef TIMER_H #define TIMER_H
+#include <defines.h> + #include <sys/time.h>
#include <osmocom/core/linuxlist.h> @@ -51,7 +53,7 @@ struct osmo_timer_list {
void (*cb)(void*); void *data; -}; +} __packed;
extern unsigned long volatile jiffies;
diff --git a/src/target/firmware/include/layer1/sched_gsmtime.h b/src/target/firmware/include/layer1/sched_gsmtime.h index c40359e..36918fa 100644 --- a/src/target/firmware/include/layer1/sched_gsmtime.h +++ b/src/target/firmware/include/layer1/sched_gsmtime.h @@ -2,6 +2,9 @@ #define _L1_SCHED_GSMTIME_H
#include <stdint.h> + +#include <defines.h> + #include <osmocom/core/linuxlist.h>
struct sched_gsmtime_event { @@ -9,7 +12,7 @@ struct sched_gsmtime_event { const struct tdma_sched_item *si; uint32_t fn; uint16_t p3; /* parameter for TDMA scheduler */ -}; +} __packed;
/* initialize the GSMTIME scheduler */ void sched_gsmtime_init(void);
Hi,
First, thanks for this series of patch, I'll be sure to review and test them.
this eliminates the occurrance of gcc warning warning: cast increases required alignment of target type
src/target/firmware/include/comm/timer.h | 4 +++- src/target/firmware/include/layer1/sched_gsmtime.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-)
-}; +} __packed;
I'm not conviced by this one : Why should we use packed for structures not used as 'communication packets' ?
Cheers,
Sylvain
Hi Sylvain and Alexander,
On Thu, Nov 24, 2011 at 07:58:33AM +0100, Sylvain Munaut wrote:
First, thanks for this series of patch, I'll be sure to review and test them.
Thanks for testing, Sylvain.
-}; +} __packed;
I'm not conviced by this one : Why should we use packed for structures not used as 'communication packets' ?
I agree with Sylvain here. this will just cause the compiler to generate much less efficient code at no other benefit...
On Thu, Nov 24, 2011 at 07:58:33AM +0100, Sylvain Munaut wrote:
Hi,
First, thanks for this series of patch, I'll be sure to review and test them.
Well, no problem, I had some time on hand I couldn't use otherwise.
this eliminates the occurrance of gcc warning warning: cast increases required alignment of target type
src/target/firmware/include/comm/timer.h | 4 +++- src/target/firmware/include/layer1/sched_gsmtime.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-)
-}; +} __packed;
I'm not conviced by this one : Why should we use packed for structures not used as 'communication packets' ?
What are the drawbacks ?
Steve and Holger raised some reasonable concerns on some of the other patches, it seems I was quite unconcentrated and they are mostly crap. The patches do not contain any "magic" anyway. Just straight-forward reaction on the different kind of warnings. Most of them can be eliminated easily.
Kind regards -Alex
On 11/24/2011 10:36 AM, Alexander Huemer wrote:
Steve and Holger raised some reasonable concerns on some of the other patches, it seems I was quite unconcentrated and they are mostly crap.
crap? no, not at all. I agree that we should get the number of warnings down, sometimes a warning just needs something else than the straight forward fix.
On Thu, Nov 24, 2011 at 10:49:43AM +0100, Holger Hans Peter Freyther wrote:
On 11/24/2011 10:36 AM, Alexander Huemer wrote:
Steve and Holger raised some reasonable concerns on some of the other patches, it seems I was quite unconcentrated and they are mostly crap.
crap? no, not at all. I agree that we should get the number of warnings down, sometimes a warning just needs something else than the straight forward fix.
Compiler warnings are of course controversial. I personally think that osmocom-bb and friends are fine pieces of code and deserve a kind of "polished" look when compiling.
Some warnings are also quite strong indications of bugs like "... makes pointer from integer without a cast" and things like that.
I myself don't know how to handle e.g. "discards qualifiers from pointer target type" when the constness of lvalue and rvalue don't match.
Maybe it doesn't actually matter so much and I am just pedantic.
Hi Alexander,
On Thu, Nov 24, 2011 at 10:36:27AM +0100, Alexander Huemer wrote:
On Thu, Nov 24, 2011 at 07:58:33AM +0100, Sylvain Munaut wrote:
Hi,
First, thanks for this series of patch, I'll be sure to review and test them.
Well, no problem, I had some time on hand I couldn't use otherwise.
this eliminates the occurrance of gcc warning warning: cast increases required alignment of target type
src/target/firmware/include/comm/timer.h | 4 +++- src/target/firmware/include/layer1/sched_gsmtime.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-)
-}; +} __packed;
I'm not conviced by this one : Why should we use packed for structures not used as 'communication packets' ?
What are the drawbacks ?
normally, the compiler will lay out the structure in a way that optimizes accesses to members. So e.g. on an ARM, a
struct { uint8_t byte1; uint8_t byte2; };
will very likely contain 3 bytes padding between the two uint8 values in order to make sure no unaligned loads/stores will be required.
However, if you change that to '__packed', the padding will not be generated and any access to struct members will need to deal with unaligned accesses, which can be inflating the code size considerably.
Steve and Holger raised some reasonable concerns on some of the other patches, it seems I was quite unconcentrated and they are mostly crap.
don't say that. We love to receive cleanup patches like yours, and even if 2-3 have some issues, at a series of 8 it is still considerable gain for the project.
The patches do not contain any "magic" anyway. Just straight-forward reaction on the different kind of warnings. Most of them can be eliminated easily.
yes, in most cases. However, sometimes we keep the warning around as a reminder that something still needs to be done, such as e.g. handling an undhandled enum value in switch() or the like. In such a case of course we shuold implement the missing member, and not introduce a default case.
Regards, Harald
On Thu, Nov 24, 2011 at 11:33:09AM +0100, Harald Welte wrote:
normally, the compiler will lay out the structure in a way that optimizes accesses to members. So e.g. on an ARM, a
struct { uint8_t byte1; uint8_t byte2; };
will very likely contain 3 bytes padding between the two uint8 values in order to make sure no unaligned loads/stores will be required.
However, if you change that to '__packed', the padding will not be generated and any access to struct members will need to deal with unaligned accesses, which can be inflating the code size considerably.
thanks for pointing that out. It's actually obvious after a moment of thinking.
One additional thought on the switch/enum situation and initialisation: what about adding an additional member to the enum, let's say VOID and instances of the enum are initialised to that. A switch statement that handles this enum gets a case for VOID which produces a runtime warning, much like a default case. this way the compiler is happy, because the variable is initialised and also tells you when enum values are not handled.
baseband-devel@lists.osmocom.org