diff options
| author | Tangyuxin <[email protected]> | 2022-09-20 22:31:11 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-09-20 10:31:11 -0400 |
| commit | a4829b1c004015cca489679cc335b6089aa9da31 (patch) | |
| tree | 3e346e76bb1c77b5b189ca28b053daeaea5154e9 /components/drivers | |
| parent | 746d7a01bdb29c692b696780f938f11253ae1103 (diff) | |
[fix] Fix simulator compilation warnings (#6438)
* [fix] Fix simulator compilation warnings
* Update bsp/simulator/rtconfig_project.h
Co-authored-by: Man, Jianting (Meco) <[email protected]>
Diffstat (limited to 'components/drivers')
| -rw-r--r-- | components/drivers/hwtimer/hwtimer.c | 4 | ||||
| -rw-r--r-- | components/drivers/i2c/i2c-bit-ops.c | 3 | ||||
| -rw-r--r-- | components/drivers/include/ipc/ringbuffer.h | 2 | ||||
| -rw-r--r-- | components/drivers/ipc/pipe.c | 4 | ||||
| -rw-r--r-- | components/drivers/ipc/ringbuffer.c | 4 | ||||
| -rw-r--r-- | components/drivers/mtd/mtd_nand.c | 2 | ||||
| -rw-r--r-- | components/drivers/sdio/block_dev.c | 2 | ||||
| -rw-r--r-- | components/drivers/sdio/mmc.c | 2 | ||||
| -rw-r--r-- | components/drivers/sdio/sd.c | 5 | ||||
| -rw-r--r-- | components/drivers/serial/serial.c | 6 | ||||
| -rw-r--r-- | components/drivers/touch/touch.c | 2 |
11 files changed, 18 insertions, 18 deletions
diff --git a/components/drivers/hwtimer/hwtimer.c b/components/drivers/hwtimer/hwtimer.c index 774792c409..189ef7df49 100644 --- a/components/drivers/hwtimer/hwtimer.c +++ b/components/drivers/hwtimer/hwtimer.c @@ -231,7 +231,7 @@ static rt_err_t rt_hwtimer_control(struct rt_device *dev, int cmd, void *args) break; case HWTIMER_CTRL_FREQ_SET: { - rt_uint32_t *f; + rt_int32_t *f; if (args == RT_NULL) { @@ -239,7 +239,7 @@ static rt_err_t rt_hwtimer_control(struct rt_device *dev, int cmd, void *args) break; } - f = (rt_uint32_t*)args; + f = (rt_int32_t*)args; if ((*f > timer->info->maxfreq) || (*f < timer->info->minfreq)) { LOG_W("frequency setting out of range! It will maintain at %d Hz", timer->freq); diff --git a/components/drivers/i2c/i2c-bit-ops.c b/components/drivers/i2c/i2c-bit-ops.c index 08fa5a836c..dd294731aa 100644 --- a/components/drivers/i2c/i2c-bit-ops.c +++ b/components/drivers/i2c/i2c-bit-ops.c @@ -372,7 +372,8 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, { struct rt_i2c_msg *msg; struct rt_i2c_bit_ops *ops = (struct rt_i2c_bit_ops *)bus->priv; - rt_int32_t i, ret; + rt_int32_t ret; + rt_uint32_t i; rt_uint16_t ignore_nack; if (num == 0) return 0; diff --git a/components/drivers/include/ipc/ringbuffer.h b/components/drivers/include/ipc/ringbuffer.h index 117c97e775..97abf37097 100644 --- a/components/drivers/include/ipc/ringbuffer.h +++ b/components/drivers/include/ipc/ringbuffer.h @@ -95,7 +95,7 @@ rt_inline rt_uint16_t rt_ringbuffer_get_size(struct rt_ringbuffer *rb) } /** return the size of empty space in rb */ -#define rt_ringbuffer_space_len(rb) ((rb)->buffer_size - rt_ringbuffer_data_len(rb)) +#define rt_ringbuffer_space_len(rb) ((rb)->buffer_size - (rt_int16_t)rt_ringbuffer_data_len(rb)) #ifdef __cplusplus diff --git a/components/drivers/ipc/pipe.c b/components/drivers/ipc/pipe.c index d7b6c373eb..5483ffa549 100644 --- a/components/drivers/ipc/pipe.c +++ b/components/drivers/ipc/pipe.c @@ -497,7 +497,7 @@ static rt_size_t rt_pipe_read(rt_device_t device, rt_off_t pos, void *buffer, rt while (read_bytes < count) { - int len = rt_ringbuffer_get(pipe->fifo, &pbuf[read_bytes], count - read_bytes); + int len = rt_ringbuffer_get(pipe->fifo, &pbuf[read_bytes], (rt_uint16_t)(count - read_bytes)); if (len <= 0) break; read_bytes += len; @@ -539,7 +539,7 @@ static rt_size_t rt_pipe_write(rt_device_t device, rt_off_t pos, const void *buf while (write_bytes < count) { - int len = rt_ringbuffer_put(pipe->fifo, &pbuf[write_bytes], count - write_bytes); + int len = rt_ringbuffer_put(pipe->fifo, &pbuf[write_bytes], (rt_uint16_t)(count - write_bytes)); if (len <= 0) break; write_bytes += len; diff --git a/components/drivers/ipc/ringbuffer.c b/components/drivers/ipc/ringbuffer.c index fc9e15f996..90632f5884 100644 --- a/components/drivers/ipc/ringbuffer.c +++ b/components/drivers/ipc/ringbuffer.c @@ -192,7 +192,7 @@ rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb, /* less data */ if (size < length) - length = size; + length = (rt_uint16_t)size; if (rb->buffer_size - rb->read_index > length) { @@ -248,7 +248,7 @@ rt_size_t rt_ringbuffer_peek(struct rt_ringbuffer *rb, rt_uint8_t **ptr) if ((rt_size_t)(rb->buffer_size - rb->read_index) > size) { - rb->read_index += size; + rb->read_index += (rt_uint16_t)size; return size; } diff --git a/components/drivers/mtd/mtd_nand.c b/components/drivers/mtd/mtd_nand.c index fb62de39b5..6ca56f9a6d 100644 --- a/components/drivers/mtd/mtd_nand.c +++ b/components/drivers/mtd/mtd_nand.c @@ -162,7 +162,7 @@ rt_err_t rt_mtd_nand_mark_badblock(struct rt_mtd_nand_device *device, rt_uint32_ #include <finsh.h> #define __is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ') -static void mtd_dump_hex(const rt_uint8_t *ptr, rt_size_t buflen) +static void mtd_dump_hex(const rt_uint8_t *ptr, int buflen) { unsigned char *buf = (unsigned char *)ptr; int i, j; diff --git a/components/drivers/sdio/block_dev.c b/components/drivers/sdio/block_dev.c index 4067566026..c8bb2f7c68 100644 --- a/components/drivers/sdio/block_dev.c +++ b/components/drivers/sdio/block_dev.c @@ -424,7 +424,7 @@ static struct mmcsd_blk_device * rt_mmcsd_create_blkdev(struct rt_mmcsd_card *ca rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card) { rt_int32_t err = 0; - rt_uint8_t status; + rt_err_t status; rt_uint8_t *sector; err = mmcsd_set_blksize(card); diff --git a/components/drivers/sdio/mmc.c b/components/drivers/sdio/mmc.c index 8e392909e3..74f0637ff8 100644 --- a/components/drivers/sdio/mmc.c +++ b/components/drivers/sdio/mmc.c @@ -196,7 +196,7 @@ static int mmc_parse_ext_csd(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) card_capacity = *((rt_uint32_t *)&ext_csd[EXT_CSD_SEC_CNT]); card_capacity *= card->card_blksize; card_capacity >>= 10; /* unit:KB */ - card->card_capacity = card_capacity; + card->card_capacity = (rt_uint32_t)card_capacity; LOG_I("emmc card capacity %d KB.", card->card_capacity); return 0; diff --git a/components/drivers/sdio/sd.c b/components/drivers/sdio/sd.c index d739ee4eaf..a67d19c922 100644 --- a/components/drivers/sdio/sd.c +++ b/components/drivers/sdio/sd.c @@ -284,8 +284,7 @@ rt_err_t mmcsd_send_app_cmd(struct rt_mmcsd_host *host, int retry) { struct rt_mmcsd_req req; - - rt_uint32_t i; + int i; rt_err_t err; err = -RT_ERROR; @@ -294,7 +293,7 @@ rt_err_t mmcsd_send_app_cmd(struct rt_mmcsd_host *host, * We have to resend MMC_APP_CMD for each attempt so * we cannot use the retries field in mmc_command. */ - for (i = 0;i <= retry;i++) + for (i = 0; i <= retry; i++) { rt_memset(&req, 0, sizeof(struct rt_mmcsd_req)); diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index 00d6671f37..25f06fa401 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -424,7 +424,7 @@ static void rt_dma_recv_update_get_index(struct rt_serial_device *serial, rt_siz if (rx_fifo->is_full && len != 0) rx_fifo->is_full = RT_FALSE; - rx_fifo->get_index += len; + rx_fifo->get_index += (rt_uint16_t)len; if (rx_fifo->get_index >= serial->config.bufsz) { rx_fifo->get_index %= serial->config.bufsz; @@ -445,7 +445,7 @@ static void rt_dma_recv_update_put_index(struct rt_serial_device *serial, rt_siz if (rx_fifo->get_index <= rx_fifo->put_index) { - rx_fifo->put_index += len; + rx_fifo->put_index += (rt_uint16_t)len; /* beyond the fifo end */ if (rx_fifo->put_index >= serial->config.bufsz) { @@ -459,7 +459,7 @@ static void rt_dma_recv_update_put_index(struct rt_serial_device *serial, rt_siz } else { - rx_fifo->put_index += len; + rx_fifo->put_index += (rt_uint16_t)len; if (rx_fifo->put_index >= rx_fifo->get_index) { /* beyond the fifo end */ diff --git a/components/drivers/touch/touch.c b/components/drivers/touch/touch.c index 1a747d8669..2b292e3ec0 100644 --- a/components/drivers/touch/touch.c +++ b/components/drivers/touch/touch.c @@ -218,7 +218,7 @@ int rt_hw_touch_register(rt_touch_t touch, rt_uint32_t flag, void *data) { - rt_int8_t result; + rt_err_t result; rt_device_t device; RT_ASSERT(touch != RT_NULL); |
