RA6M3修复ra_pin_mode、rt_ssize_t ra_uart_transmit文件类型错误

电子说

1.3w人已加入

描述

renesas在用keil编译时报错:

RT-Thread

详细信如下:

../libraries/HAL_Drivers/drv_gpio.c(324): error: incompatible function pointer types initializing 'void (*)(struct rt_device , rt_base_t, rt_uint8_t)' (aka 'void ( )(struct rt_device *, long, unsigned char)') with an expression of type 'void (rt_device_t, rt_base_t, rt_base_t)' (aka 'void (struct rt_device , long, long)') [-Wincompatible-function-pointer-types]
.pin_mode = ra_pin_mode,
^~~~~~~~~~~
../libraries/HAL_Drivers/drv_gpio.c(325): error: incompatible function pointer types initializing 'void (
)(struct rt_device , rt_base_t, rt_uint8_t)' (aka 'void ( )(struct rt_device *, long, unsigned char)') with an expression of type 'void (rt_device_t, rt_base_t, rt_base_t)' (aka 'void (struct rt_device , long, long)') [-Wincompatible-function-pointer-types]
.pin_write = ra_pin_write,
^~~~~~~~~~~~
../libraries/HAL_Drivers/drv_gpio.c(326): error: incompatible function pointer types initializing 'rt_int8_t (
)(struct rt_device , rt_base_t)' (aka 'signed char ( )(struct rt_device *, long)') with an expression of type 'int (rt_device_t, rt_base_t)' (aka 'int (struct rt_device , long)') [-Wincompatible-function-pointer-types]
.pin_read = ra_pin_read,
^~~~~~~~~~~
../libraries/HAL_Drivers/drv_gpio.c(327): error: incompatible function pointer types initializing 'rt_err_t (
)(struct rt_device , rt_base_t, rt_uint8_t, void ( )(void *), void )' (aka 'long ( )(struct rt_device , long, unsigned char, void ( )(void *), void *)') with an expression of type 'rt_err_t (struct rt_device , rt_int32_t, rt_uint32_t, void ( )(void *), void *)' (aka 'long (struct rt_device , int, unsigned int, void ( )(void *), void )') [-Wincompatible-function-pointer-types]
.pin_attach_irq = ra_pin_attach_irq,
^~~~~~~~~~~~~~~~~
../libraries/HAL_Drivers/drv_gpio.c(328): error: incompatible function pointer types initializing 'rt_err_t (
)(struct rt_device , rt_base_t)' (aka 'long ( )(struct rt_device *, long)') with an expression of type 'rt_err_t (struct rt_device *, rt_int32_t)' (aka 'long (struct rt_device , int)') [-Wincompatible-function-pointer-types]
.pin_detach_irq = ra_pin_dettach_irq,
^~~~~~~~~~~~~~~~~~
../libraries/HAL_Drivers/drv_gpio.c(329): error: incompatible function pointer types initializing 'rt_err_t (
)(struct rt_device , rt_base_t, rt_uint8_t)' (aka 'long ( )(struct rt_device *, long, unsigned char)') with an expression of type 'rt_err_t (struct rt_device *, rt_base_t, rt_uint32_t)' (aka 'long (struct rt_device *, long, unsigned int)') [-Wincompatible-function-pointer-types]
.pin_irq_enable = ra_pin_irq_enable,
^~~~~~~~~~~~~~~~~
6 errors generated.
compiling drv_gpio.c...
../libraries/HAL_Drivers/drv_usart_v2.c(252): warning: variable 'uart' set but not used [-Wunused-but-set-variable]
struct ra_uart uart;
^
../libraries/HAL_Drivers/drv_usart_v2.c(499): error: incompatible function pointer types initializing 'rt_size_t (
)(struct rt_serial_device *, rt_uint8_t , rt_size_t, rt_uint32_t)' (aka 'unsigned int ( )(struct rt_serial_device *, unsigned char *, unsigned int, unsigned int)') with an expression of type 'rt_ssize_t (struct rt_serial_device *, rt_uint8_t *, rt_size_t, rt_uint32_t)' (aka 'long (struct rt_serial_device *, unsigned char *, unsigned int, unsigned int)') [-Wincompatible-function-pointer-types]
.transmit = ra_uart_transmit
^~~~~~~~~~~~~~~~
1 warning and 1 error generated.

经经分析原因,是文件类型使用不当报错,现将修复情情况如下:

bsp/renesas/libraries/HAL_Drivers/drv_gpio.c
@@ -111,7 +111,7 @@ static void ra_pin_map_init(void)
}
#endif /* R_ICU_H /
static void ra_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
static void ra_pin_mode(rt_device_t dev, rt_base_t pin, rt_uint8_t mode)
{
fsp_err_t err;
/
Initialize the IOPORT module and configure the pins */
@@ -154,7 +154,7 @@ static void ra_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
}
}
static void ra_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value)
static void ra_pin_write(rt_device_t dev, rt_base_t pin, rt_uint8_t value)
{
bsp_io_level_t level = BSP_IO_LEVEL_HIGH;
@@ -168,7 +168,7 @@ static void ra_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value)
R_BSP_PinAccessDisable();
}
static int ra_pin_read(rt_device_t dev, rt_base_t pin)
static rt_int8_t ra_pin_read(rt_device_t dev, rt_base_t pin)
{
if ((pin > RA_MAX_PIN_VALUE) || (pin < RA_MIN_PIN_VALUE))
{
@@ -178,7 +178,7 @@ static int ra_pin_read(rt_device_t dev, rt_base_t pin)
return R_BSP_PinRead(pin);
}
static rt_err_t ra_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
static rt_err_t ra_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled)
{
#ifdef R_ICU_H
rt_err_t err;
@@ -230,7 +230,7 @@ static rt_err_t ra_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_ui
#endif
}
static rt_err_t ra_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
static rt_err_t ra_pin_attach_irq(struct rt_device *device, rt_base_t pin,
rt_uint32_t mode, void (*hdr)(void *args), void *args)
{
#ifdef R_ICU_H
@@ -264,7 +264,7 @@ static rt_err_t ra_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
#endif
}
static rt_err_t ra_pin_dettach_irq(struct rt_device *device, rt_int32_t pin)
static rt_err_t ra_pin_dettach_irq(struct rt_device *device, rt_base_t pin)
{
#ifdef R_ICU_H
rt_int32_t irqx = ra_pin_get_irqx(pin);
bsp/renesas/libraries/HAL_Drivers/drv_usart_v2.c
Comment on this file
@@ -244,7 +244,7 @@ static int ra_uart_getc(struct rt_serial_device *serial)
return RT_EOK;
}
static rt_ssize_t ra_uart_transmit(struct rt_serial_device *serial,
static rt_size_t ra_uart_transmit(struct rt_serial_device *serial,
rt_uint8_t *buf,
rt_size_t size,
rt_uint32_t tx_flag)
bsp/renesas/libraries/HAL_Drivers/drv_usart_v2.c
Comment on this file
@@ -244,7 +244,7 @@ static int ra_uart_getc(struct rt_serial_device *serial)
return RT_EOK;
}
static rt_ssize_t ra_uart_transmit(struct rt_serial_device *serial,
static rt_size_t ra_uart_transmit(struct rt_serial_device *serial,
rt_uint8_t *buf,
rt_size_t size,
rt_uint32_t tx_flag)

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分