From 9c35c09227041d2d23477b19443b3f707fddc664 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Thu, 26 Jun 2014 20:31:33 +0200 Subject: [PATCH] fix compilation errors due to undefined variables --- fat.c | 7 +++++++ i2cm_sw.c | 8 ++++++-- imu.c | 6 ++++++ sd_main.c | 2 ++ sd_raw.c | 8 ++++++-- sd_raw.h | 8 ++++---- 6 files changed, 31 insertions(+), 8 deletions(-) diff --git a/fat.c b/fat.c index 367d489..df579ce 100644 --- a/fat.c +++ b/fat.c @@ -814,6 +814,9 @@ uint8_t fat_clear_cluster(const struct fat_fs_struct* fs, cluster_t cluster_num) */ uintptr_t fat_clear_cluster_callback(uint8_t* buffer, offset_t offset, void* p) { + (void)buffer; + (void)offset; + (void)p; return 16; } #endif @@ -2518,6 +2521,8 @@ uint8_t fat_get_fs_free_16_callback(uint8_t* buffer, offset_t offset, void* p) struct fat_usage_count_callback_arg* count_arg = (struct fat_usage_count_callback_arg*) p; uintptr_t buffer_size = count_arg->buffer_size; + (void)offset; + for(uintptr_t i = 0; i < buffer_size; i += 2, buffer += 2) { uint16_t cluster = read16(buffer); @@ -2538,6 +2543,8 @@ uint8_t fat_get_fs_free_32_callback(uint8_t* buffer, offset_t offset, void* p) struct fat_usage_count_callback_arg* count_arg = (struct fat_usage_count_callback_arg*) p; uintptr_t buffer_size = count_arg->buffer_size; + (void)offset; + for(uintptr_t i = 0; i < buffer_size; i += 4, buffer += 4) { uint32_t cluster = read32(buffer); diff --git a/i2cm_sw.c b/i2cm_sw.c index 78f562d..92f2321 100644 --- a/i2cm_sw.c +++ b/i2cm_sw.c @@ -283,11 +283,13 @@ uint8_t i2cm_receive_byte(uint8_t last) -uint8_t i2c_send(uint8_t addr, uint8_t* data, uint8_t len, uint8_t dummy) +uint8_t i2c_send(uint8_t addr, uint8_t* data, uint8_t len, uint8_t ctrl) { uint8_t i; uint8_t err = 0; + (void)ctrl; /* ignored */ + err = i2cm_send_start((addr<<1) | 0); if (err) return err; @@ -305,11 +307,13 @@ uint8_t i2c_send(uint8_t addr, uint8_t* data, uint8_t len, uint8_t dummy) uint8_t i2c_buf[0x20]; -uint8_t i2c_recv(uint8_t addr, uint8_t len, uint8_t dummy) +uint8_t i2c_recv(uint8_t addr, uint8_t len, uint8_t ctrl) { uint8_t i; uint8_t err = 0; + (void)ctrl; /* ignored */ + err = i2cm_send_start((addr<<1) | 1); if (err) return err; diff --git a/imu.c b/imu.c index 745df11..efaba62 100644 --- a/imu.c +++ b/imu.c @@ -40,11 +40,15 @@ int mag_z; void i2c_recvevent(uint8_t * buf, int8_t size) +void i2c_recvevent(uint8_t *buf, int8_t size) { + (void)buf; + (void)size; } void i2c_sendevent(int8_t size) { + (void)size; } @@ -65,6 +69,8 @@ uint16_t counter; void do_led_blink(void *dummy) { + (void)dummy; + #if 1 /* simple blink */ LED1_TOGGLE(); #endif diff --git a/sd_main.c b/sd_main.c index 82bb8ad..d2ee6c5 100644 --- a/sd_main.c +++ b/sd_main.c @@ -603,6 +603,8 @@ uint32_t strtolong(const char* str) uint8_t find_file_in_dir(struct fat_fs_struct* fs, struct fat_dir_struct* dd, const char* name, struct fat_dir_entry_struct* dir_entry) { + (void)fs; + while(fat_read_dir(dd, dir_entry)) { if(strcmp(dir_entry->long_name, name) == 0) diff --git a/sd_raw.c b/sd_raw.c index 8c830a3..f33184e 100644 --- a/sd_raw.c +++ b/sd_raw.c @@ -9,9 +9,12 @@ */ #include +#include #include #include "sd_raw.h" +#include + /** * \addtogroup sd_raw MMC/SD/SDHC card raw access * @@ -160,7 +163,7 @@ static uint8_t sd_raw_card_type; /* private helper functions */ static void sd_raw_send_byte(uint8_t b); -static uint8_t sd_raw_rec_byte(); +static uint8_t sd_raw_rec_byte(void); static uint8_t sd_raw_send_command(uint8_t command, uint32_t arg); /** @@ -169,7 +172,7 @@ static uint8_t sd_raw_send_command(uint8_t command, uint32_t arg); * * \returns 0 on failure, 1 on success. */ -uint8_t sd_raw_init() +uint8_t sd_raw_init(void) { /* enable inputs for reading card status */ configure_pin_available(); @@ -925,6 +928,7 @@ uint8_t sd_raw_get_info(struct sd_raw_info* info) if(i == 0) { csd_structure = b >> 6; + (void)csd_structure; } else if(i == 14) { diff --git a/sd_raw.h b/sd_raw.h index 6aa9750..e4ab587 100644 --- a/sd_raw.h +++ b/sd_raw.h @@ -124,15 +124,15 @@ struct sd_raw_info typedef uint8_t (*sd_raw_read_interval_handler_t)(uint8_t* buffer, offset_t offset, void* p); typedef uintptr_t (*sd_raw_write_interval_handler_t)(uint8_t* buffer, offset_t offset, void* p); -uint8_t sd_raw_init(); -uint8_t sd_raw_available(); -uint8_t sd_raw_locked(); +uint8_t sd_raw_init(void); +uint8_t sd_raw_available(void); +uint8_t sd_raw_locked(void); uint8_t sd_raw_read(offset_t offset, uint8_t* buffer, uintptr_t length); uint8_t sd_raw_read_interval(offset_t offset, uint8_t* buffer, uintptr_t interval, uintptr_t length, sd_raw_read_interval_handler_t callback, void* p); uint8_t sd_raw_write(offset_t offset, const uint8_t* buffer, uintptr_t length); uint8_t sd_raw_write_interval(offset_t offset, uint8_t* buffer, uintptr_t length, sd_raw_write_interval_handler_t callback, void* p); -uint8_t sd_raw_sync(); +uint8_t sd_raw_sync(void); uint8_t sd_raw_get_info(struct sd_raw_info* info); -- 2.39.5