Update fix warnings and builds.

This commit is contained in:
Wayne Lin 2023-03-31 17:14:02 +08:00 committed by Man, Jianting (Meco)
parent d9e74b0f76
commit c143842be2
27 changed files with 195 additions and 179 deletions

View File

@ -29,13 +29,13 @@
/* Private functions ------------------------------------------------------------*/
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value);
static int nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args);
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value);
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args);
static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled);
static rt_base_t nu_gpio_get(const char *name);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled);
static rt_base_t nu_gpio_pin_get(const char *name);
/* Private variables ------------------------------------------------------------*/
static struct rt_pin_irq_hdr pin_irq_hdr_tab[IRQ_MAX_NUM];
@ -47,7 +47,7 @@ static struct rt_pin_ops nu_gpio_ops =
nu_gpio_attach_irq,
nu_gpio_detach_irq,
nu_gpio_irq_enable,
nu_gpio_get,
nu_gpio_pin_get,
};
static rt_uint32_t g_u32PinIrqMask = 0x0;
@ -102,7 +102,32 @@ static void pin_irq_hdr(rt_uint32_t irq_status, rt_uint32_t port_index)
}
}
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode)
static rt_base_t nu_gpio_pin_get(const char *name)
{
/* Get pin number by name,such as PA.0, PF12 */
if ((name[2] == '\0') || ((name[2] == '.') && (name[3] == '\0')))
return -(RT_EINVAL);
long number;
if ((name[2] == '.'))
number = atol(&name[3]);
else
number = atol(&name[2]);
if (number > 15)
return -(RT_EINVAL);
if (name[1] >= 'A' && name[1] <= 'H')
return ((name[1] - 'A') * 0x10) + number;
if (name[1] >= 'a' && name[1] <= 'h')
return ((name[1] - 'a') * 0x10) + number;
return -(RT_EINVAL);
}
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode)
{
GPIO_T *PORT;
@ -140,7 +165,7 @@ static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode
#endif
}
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value)
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value)
{
if (nu_port_check(pin))
return;
@ -148,7 +173,7 @@ static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t val
GPIO_PIN_DATA(NU_GET_PORT(pin), NU_GET_PINS(pin)) = value;
}
static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin)
{
if (nu_port_check(pin))
return PIN_LOW;
@ -156,7 +181,7 @@ static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
return GPIO_PIN_DATA(NU_GET_PORT(pin), NU_GET_PINS(pin));
}
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args)
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args)
{
rt_base_t level;
rt_int32_t irqindex;
@ -223,7 +248,7 @@ static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin)
return RT_EOK;
}
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled)
{
GPIO_T *PORT;
rt_base_t level;
@ -282,32 +307,6 @@ exit_nu_gpio_irq_enable:
return -(ret);
}
static rt_base_t nu_gpio_get(const char *name)
{
/* Get pin number by name,such as PA.0, PF12 */
if ((name[2] == '\0')||((name[2] == '.')&&(name[3] == '\0')))
return -(RT_EINVAL);
long number;
if ((name[2] == '.'))
number = atol(&name[3]);
else
number = atol(&name[2]);
if (number > 15)
return -(RT_EINVAL);
if (name[1] >= 'A' && name[1] <= 'H')
return ((name[1] - 'A') * 0x10) + number;
if (name[1] >= 'a' && name[1] <= 'h')
return ((name[1] - 'a') * 0x10) + number;
return -(RT_EINVAL);
}
int rt_hw_gpio_init(void)
{
rt_int32_t irqindex;

View File

@ -12,7 +12,8 @@
#include <rtconfig.h>
#ifdef BSP_USING_USBD
#if defined(BSP_USING_USBD)
#include <rtthread.h>
#include <rtdevice.h>
#include <string.h>
@ -191,7 +192,7 @@ static rt_err_t _ep_disable(uep_t ep)
return RT_EOK;
}
static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
static rt_size_t _ep_read(rt_uint8_t address, void *buffer)
{
rt_size_t size = 0;
rt_uint8_t *buf;
@ -207,7 +208,7 @@ static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
return size;
}
static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT(!(address & USB_DIR_IN));
@ -216,7 +217,7 @@ static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t s
return size;
}
static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT((address & USB_DIR_IN));

View File

@ -29,12 +29,12 @@
/* Private functions ------------------------------------------------------------*/
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value);
static int nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args);
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value);
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args);
static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled);
static rt_base_t nu_gpio_pin_get(const char *name);
/* Private variables ------------------------------------------------------------*/
@ -129,7 +129,7 @@ static rt_base_t nu_gpio_pin_get(const char *name)
return -(RT_EINVAL);
}
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode)
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode)
{
GPIO_T *PORT;
@ -164,7 +164,7 @@ static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode
}
}
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value)
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value)
{
if (nu_port_check(pin))
return;
@ -172,7 +172,7 @@ static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t val
GPIO_PIN_DATA_S(NU_GET_PORT(pin), NU_GET_PINS(pin)) = value;
}
static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin)
{
if (nu_port_check(pin))
return PIN_LOW;
@ -180,7 +180,7 @@ static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
return GPIO_PIN_DATA_S(NU_GET_PORT(pin), NU_GET_PINS(pin));
}
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args)
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args)
{
rt_base_t level;
rt_int32_t irqindex;
@ -247,7 +247,7 @@ static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin)
return RT_EOK;
}
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled)
{
GPIO_T *PORT;
rt_base_t level;

View File

@ -39,7 +39,7 @@ enum
/* Private functions ------------------------------------------------------------*/
static rt_err_t nu_qspi_bus_configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static int nu_qspi_register_bus(struct nu_spi *qspi_bus, const char *name);
/* Public functions -------------------------------------------------------------*/
@ -207,7 +207,7 @@ static int nu_qspi_mode_config(struct nu_spi *qspi_bus, rt_uint8_t *tx, rt_uint8
return qspi_lines;
}
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{
struct nu_spi *qspi_bus;
struct rt_qspi_configuration *qspi_configuration;
@ -217,7 +217,7 @@ static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_
#endif
rt_uint8_t bytes_per_word;
QSPI_T *qspi_base;
rt_uint32_t u32len = 0;
rt_ssize_t u32len = 0;
RT_ASSERT(device != RT_NULL);
RT_ASSERT(message != RT_NULL);

View File

@ -57,7 +57,7 @@ enum
static void nu_spi_transmission_with_poll(struct nu_spi *spi_bus,
uint8_t *send_addr, uint8_t *recv_addr, int length, uint8_t bytes_per_word);
static int nu_spi_register_bus(struct nu_spi *spi_bus, const char *name);
static rt_uint32_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_ssize_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_err_t nu_spi_bus_configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
#if defined(BSP_USING_SPI_PDMA)
@ -588,7 +588,7 @@ void nu_spi_transfer(struct nu_spi *spi_bus, uint8_t *tx, uint8_t *rx, int lengt
#endif
}
static rt_uint32_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
static rt_ssize_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{
struct nu_spi *spi_bus;
struct rt_spi_configuration *configuration;

View File

@ -229,7 +229,7 @@ static rt_err_t _ep_disable(uep_t ep)
return RT_EOK;
}
static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
static rt_size_t _ep_read(rt_uint8_t address, void *buffer)
{
rt_size_t size = 0;
rt_uint8_t *buf;
@ -245,7 +245,7 @@ static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
return size;
}
static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT(!(address & USB_DIR_IN));
@ -254,7 +254,7 @@ static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t s
return size;
}
static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT((address & USB_DIR_IN));

View File

@ -29,12 +29,12 @@
/* Private functions ------------------------------------------------------------*/
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value);
static int nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args);
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value);
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args);
static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled);
static rt_base_t nu_gpio_pin_get(const char *name);
/* Private variables ------------------------------------------------------------*/
@ -129,7 +129,7 @@ static rt_base_t nu_gpio_pin_get(const char *name)
return -(RT_EINVAL);
}
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode)
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode)
{
GPIO_T *PORT;
@ -164,7 +164,7 @@ static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode
}
}
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value)
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value)
{
if (nu_port_check(pin))
return;
@ -172,7 +172,7 @@ static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t val
GPIO_PIN_DATA(NU_GET_PORT(pin), NU_GET_PINS(pin)) = value;
}
static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin)
{
if (nu_port_check(pin))
return PIN_LOW;
@ -180,7 +180,7 @@ static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
return GPIO_PIN_DATA(NU_GET_PORT(pin), NU_GET_PINS(pin));
}
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args)
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args)
{
rt_base_t level;
rt_int32_t irqindex;
@ -247,7 +247,7 @@ static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin)
return RT_EOK;
}
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled)
{
GPIO_T *PORT;
rt_base_t level;

View File

@ -42,7 +42,7 @@ enum
/* Private functions ------------------------------------------------------------*/
static rt_err_t nu_qspi_bus_configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static int nu_qspi_register_bus(struct nu_spi *qspi_bus, const char *name);
/* Public functions -------------------------------------------------------------*/
@ -225,16 +225,15 @@ static int nu_qspi_mode_config(struct nu_spi *qspi_bus, rt_uint8_t *tx, rt_uint8
return qspi_lines;
}
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{
struct nu_spi *qspi_bus;
struct rt_qspi_configuration *qspi_configuration;
struct rt_qspi_message *qspi_message;
rt_uint8_t u8last = 1;
rt_uint8_t bytes_per_word;
QSPI_T *qspi_base;
rt_uint32_t u32len = 0;
rt_ssize_t u32len = 0;
RT_ASSERT(device != RT_NULL);
RT_ASSERT(message != RT_NULL);

View File

@ -78,7 +78,7 @@ enum
static void nu_spi_transmission_with_poll(struct nu_spi *spi_bus,
uint8_t *send_addr, uint8_t *recv_addr, int length, uint8_t bytes_per_word);
static int nu_spi_register_bus(struct nu_spi *spi_bus, const char *name);
static rt_uint32_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_ssize_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_err_t nu_spi_bus_configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
#if defined(BSP_USING_SPI_PDMA)
@ -757,7 +757,7 @@ void nu_spi_transfer(struct nu_spi *spi_bus, uint8_t *tx, uint8_t *rx, int lengt
#endif
}
static rt_uint32_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
static rt_ssize_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{
struct nu_spi *spi_bus;
struct rt_spi_configuration *configuration;

View File

@ -276,7 +276,7 @@ static rt_err_t _ep_disable(uep_t ep)
return RT_EOK;
}
static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
static rt_size_t _ep_read(rt_uint8_t address, void *buffer)
{
rt_size_t size = 0;
rt_uint8_t *buf;
@ -292,7 +292,7 @@ static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
return size;
}
static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT(!(address & USB_DIR_IN));
@ -301,7 +301,7 @@ static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t s
return size;
}
static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT((address & USB_DIR_IN));

View File

@ -29,12 +29,12 @@
/* Private functions ------------------------------------------------------------*/
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value);
static int nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args);
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value);
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args);
static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled);
static rt_base_t nu_gpio_pin_get(const char *name);
/* Private variables ------------------------------------------------------------*/
@ -129,7 +129,7 @@ static rt_base_t nu_gpio_pin_get(const char *name)
return -(RT_EINVAL);
}
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode)
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode)
{
GPIO_T *PORT;
@ -164,7 +164,7 @@ static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode
}
}
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value)
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value)
{
if (nu_port_check(pin))
return;
@ -172,7 +172,7 @@ static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t val
GPIO_PIN_DATA(NU_GET_PORT(pin), NU_GET_PINS(pin)) = value;
}
static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin)
{
if (nu_port_check(pin))
return PIN_LOW;
@ -180,7 +180,7 @@ static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
return GPIO_PIN_DATA(NU_GET_PORT(pin), NU_GET_PINS(pin));
}
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args)
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args)
{
rt_base_t level;
rt_int32_t irqindex;
@ -247,7 +247,7 @@ static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin)
return RT_EOK;
}
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled)
{
GPIO_T *PORT;
rt_base_t level;

View File

@ -42,7 +42,7 @@ enum
/* Private functions ------------------------------------------------------------*/
static rt_err_t nu_qspi_bus_configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static int nu_qspi_register_bus(struct nu_spi *qspi_bus, const char *name);
/* Public functions -------------------------------------------------------------*/
@ -60,7 +60,7 @@ static struct nu_spi nu_qspi_arr [] =
{
.name = "qspi0",
.spi_base = (SPI_T *)QSPI0,
.rstidx = QSPI0_RST,
#if defined(BSP_USING_SPI_PDMA)
#if defined(BSP_USING_QSPI0_PDMA)
.pdma_perp_tx = PDMA_QSPI0_TX,
@ -76,7 +76,7 @@ static struct nu_spi nu_qspi_arr [] =
{
.name = "qspi1",
.spi_base = (SPI_T *)QSPI1,
.rstidx = QSPI1_RST,
#if defined(BSP_USING_SPI_PDMA)
#if defined(BSP_USING_QSPI1_PDMA)
.pdma_perp_tx = PDMA_QSPI1_TX,
@ -88,7 +88,6 @@ static struct nu_spi nu_qspi_arr [] =
#endif
},
#endif
{0}
}; /* qspi nu_qspi */
static rt_err_t nu_qspi_bus_configure(struct rt_spi_device *device,
@ -226,17 +225,15 @@ static int nu_qspi_mode_config(struct nu_spi *qspi_bus, rt_uint8_t *tx, rt_uint8
return qspi_lines;
}
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{
struct nu_spi *qspi_bus;
struct rt_qspi_configuration *qspi_configuration;
#if defined(RT_SFUD_USING_QSPI)
struct rt_qspi_message *qspi_message;
rt_uint8_t u8last = 1;
#endif
rt_uint8_t bytes_per_word;
QSPI_T *qspi_base;
rt_uint32_t u32len = 0;
rt_ssize_t u32len = 0;
RT_ASSERT(device != RT_NULL);
RT_ASSERT(message != RT_NULL);
@ -259,7 +256,6 @@ static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_
}
}
#if defined(RT_SFUD_USING_QSPI)
qspi_message = (struct rt_qspi_message *)message;
/* Command + Address + Dummy + Data */
@ -275,7 +271,7 @@ static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_
}
/* Address stage */
if (qspi_message->address.size != 0)
if (qspi_message->address.size > 0)
{
rt_uint32_t u32ReversedAddr = 0;
rt_uint32_t u32AddrNumOfByte = qspi_message->address.size / 8;
@ -305,8 +301,39 @@ static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_
1);
}
/* alternate_bytes stage */
if ((qspi_message->alternate_bytes.size > 0) && (qspi_message->alternate_bytes.size <= 4))
{
rt_uint32_t u32AlternateByte = 0;
rt_uint32_t u32NumOfByte = qspi_message->alternate_bytes.size / 8;
switch (u32NumOfByte)
{
case 1:
u32AlternateByte = (qspi_message->alternate_bytes.content & 0xff);
break;
case 2:
nu_set16_be((rt_uint8_t *)&u32AlternateByte, qspi_message->alternate_bytes.content);
break;
case 3:
nu_set24_be((rt_uint8_t *)&u32AlternateByte, qspi_message->alternate_bytes.content);
break;
case 4:
nu_set32_be((rt_uint8_t *)&u32AlternateByte, qspi_message->alternate_bytes.content);
break;
default:
RT_ASSERT(0);
break;
}
u8last = nu_qspi_mode_config(qspi_bus, (rt_uint8_t *)&u32AlternateByte, RT_NULL, qspi_message->alternate_bytes.qspi_lines);
nu_spi_transfer((struct nu_spi *)qspi_bus,
(rt_uint8_t *) &u32AlternateByte,
RT_NULL,
u32NumOfByte,
1);
}
/* Dummy_cycles stage */
if (qspi_message->dummy_cycles != 0)
if (qspi_message->dummy_cycles > 0)
{
qspi_bus->dummy = 0x00;
@ -317,15 +344,11 @@ static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_
qspi_message->dummy_cycles / (8 / u8last),
1);
}
/* Data stage */
nu_qspi_mode_config(qspi_bus, (rt_uint8_t *) message->send_buf, (rt_uint8_t *) message->recv_buf, qspi_message->qspi_data_lines);
#else
/* Data stage */
nu_qspi_mode_config(qspi_bus, RT_NULL, RT_NULL, 1);
#endif //#if defined(RT_SFUD_USING_QSPI)
if (message->length != 0)
if (message->length > 0)
{
/* Data stage */
nu_qspi_mode_config(qspi_bus, (rt_uint8_t *) message->send_buf, (rt_uint8_t *) message->recv_buf, qspi_message->qspi_data_lines);
nu_spi_transfer((struct nu_spi *)qspi_bus,
(rt_uint8_t *) message->send_buf,
(rt_uint8_t *) message->recv_buf,
@ -367,11 +390,14 @@ static int rt_hw_qspi_init(void)
for (i = (QSPI_START + 1); i < QSPI_CNT; i++)
{
SYS_ResetModule(nu_qspi_arr[i].rstidx);
nu_qspi_register_bus(&nu_qspi_arr[i], nu_qspi_arr[i].name);
#if defined(BSP_USING_SPI_PDMA)
nu_qspi_arr[i].pdma_chanid_tx = -1;
nu_qspi_arr[i].pdma_chanid_rx = -1;
#endif
#if defined(BSP_USING_QSPI_PDMA)
if ((nu_qspi_arr[i].pdma_perp_tx != NU_PDMA_UNUSED) && (nu_qspi_arr[i].pdma_perp_rx != NU_PDMA_UNUSED))
{
if (nu_hw_spi_pdma_allocate(&nu_qspi_arr[i]) != RT_EOK)

View File

@ -57,7 +57,7 @@ enum
static void nu_spi_transmission_with_poll(struct nu_spi *spi_bus,
uint8_t *send_addr, uint8_t *recv_addr, int length, uint8_t bytes_per_word);
static int nu_spi_register_bus(struct nu_spi *spi_bus, const char *name);
static rt_uint32_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_ssize_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_err_t nu_spi_bus_configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
#if defined(BSP_USING_SPI_PDMA)
@ -588,7 +588,7 @@ void nu_spi_transfer(struct nu_spi *spi_bus, uint8_t *tx, uint8_t *rx, int lengt
#endif
}
static rt_uint32_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
static rt_ssize_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{
struct nu_spi *spi_bus;
struct rt_spi_configuration *configuration;

View File

@ -210,7 +210,7 @@ static rt_err_t _ep_disable(uep_t ep)
return RT_EOK;
}
static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
static rt_size_t _ep_read(rt_uint8_t address, void *buffer)
{
rt_size_t size = 0;
rt_uint8_t *buf;
@ -226,7 +226,7 @@ static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
return size;
}
static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT(!(address & USB_DIR_IN));
@ -235,7 +235,7 @@ static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t s
return size;
}
static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT((address & USB_DIR_IN));

View File

@ -54,7 +54,7 @@ const rt_uint32_t platform_mem_desc_size = sizeof(platform_mem_desc) / sizeof(pl
* This function will initialize board
*/
rt_mmu_info mmu_info;
struct rt_aspace mmu_info;
extern size_t MMUTable[];

View File

@ -28,12 +28,12 @@
/* Private functions ------------------------------------------------------------*/
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value);
static int nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args);
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value);
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args);
static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled);
static rt_base_t nu_gpio_pin_get(const char *name);
/* Private variables ------------------------------------------------------------*/
@ -126,7 +126,7 @@ static rt_base_t nu_gpio_pin_get(const char *name)
return -(RT_EINVAL);
}
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode)
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode)
{
GPIO_T *PORT;
@ -161,7 +161,7 @@ static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode
}
}
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value)
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value)
{
if (nu_port_check(pin))
return;
@ -169,7 +169,7 @@ static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t val
GPIO_PIN_DATA(NU_GET_PORT(pin), NU_GET_PINS(pin)) = value;
}
static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin)
{
if (nu_port_check(pin))
return PIN_LOW;
@ -177,7 +177,7 @@ static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
return GPIO_PIN_DATA(NU_GET_PORT(pin), NU_GET_PINS(pin));
}
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args)
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args)
{
rt_base_t level;
rt_int32_t irqindex;
@ -255,7 +255,7 @@ static void nu_gpio_isr(int vector, void *param)
PORT->INTSRC = int_status;
}
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled)
{
GPIO_T *PORT;
rt_base_t level;

View File

@ -42,7 +42,7 @@ enum
/* Private functions ------------------------------------------------------------*/
static rt_err_t nu_qspi_bus_configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static int nu_qspi_register_bus(struct nu_spi *qspi_bus, const char *name);
/* Public functions -------------------------------------------------------------*/
@ -216,16 +216,15 @@ static int nu_qspi_mode_config(struct nu_spi *qspi_bus, rt_uint8_t *tx, rt_uint8
return qspi_lines;
}
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{
struct nu_spi *qspi_bus;
struct rt_qspi_configuration *qspi_configuration;
struct rt_qspi_message *qspi_message;
rt_uint8_t u8last = 1;
rt_uint8_t bytes_per_word;
QSPI_T *qspi_base;
rt_uint32_t u32len = 0;
rt_ssize_t u32len = 0;
RT_ASSERT(device != RT_NULL);
RT_ASSERT(message != RT_NULL);

View File

@ -57,7 +57,7 @@ enum
static void nu_spi_transmission_with_poll(struct nu_spi *spi_bus,
uint8_t *send_addr, uint8_t *recv_addr, int length, uint8_t bytes_per_word);
static int nu_spi_register_bus(struct nu_spi *spi_bus, const char *name);
static rt_uint32_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_ssize_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_err_t nu_spi_bus_configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
#if defined(BSP_USING_SPI_PDMA)
@ -153,8 +153,8 @@ static rt_err_t nu_spi_bus_configure(struct rt_spi_device *device,
rt_err_t ret = RT_EOK;
void *pvUserData;
RT_ASSERT(device != RT_NULL);
RT_ASSERT(configuration != RT_NULL);
RT_ASSERT(device);
RT_ASSERT(configuration);
spi_bus = (struct nu_spi *) device->bus;
pvUserData = device->parent.user_data;
@ -600,7 +600,7 @@ void nu_spi_transfer(struct nu_spi *spi_bus, uint8_t *tx, uint8_t *rx, int lengt
#endif
}
static rt_uint32_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
static rt_ssize_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{
struct nu_spi *spi_bus;
struct rt_spi_configuration *configuration;

View File

@ -460,7 +460,7 @@ static rt_err_t nu_gmac_init(rt_device_t device)
count = 0;
do
{
LOG_D("[%s] Set %d pkt frame buffer address - 0x%08x, size=%d", __func__, count, (u32)(&psgmacmemmgr->psRXFrames[count]), PKT_FRAME_BUF_SIZE);
//LOG_D("[%s] Set %d pkt frame buffer address - 0x%08x, size=%d", __func__, count, (u32)(&psgmacmemmgr->psRXFrames[count]), PKT_FRAME_BUF_SIZE);
status = synopGMAC_set_rx_qptr(gmacdev, (u32)(&psgmacmemmgr->psRXFrames[count]), PKT_FRAME_BUF_SIZE, 0);
if (status < 0)
{
@ -576,22 +576,14 @@ rt_err_t nu_gmac_tx(rt_device_t device, struct pbuf *p)
offload_needed = 0;
#endif
u32 index = gmacdev->TxNext;
u8 *pu8PktData = (u8 *)((u32)&psgmacmemmgr->psTXFrames[index] | UNCACHEABLE);
struct pbuf *q;
rt_uint32_t offset = 0;
void *puPktData = (void *)((u32)&psgmacmemmgr->psTXFrames[index] | UNCACHEABLE);
LOG_D("%s: Transmitting data(%08x-%d).\n", psNuGMAC->name, (u32)&psgmacmemmgr->psTXFrames[index], p->tot_len);
/* Copy to TX data buffer. */
for (q = p; q != NULL; q = q->next)
{
rt_uint8_t *ptr = q->payload;
rt_uint32_t len = q->len;
rt_memcpy(&pu8PktData[offset], ptr, len);
offset += len;
}
pbuf_copy_partial(p, puPktData, p->tot_len, 0);
status = synopGMAC_xmit_frames(gmacdev, (u8 *)&psgmacmemmgr->psTXFrames[index], offset, offload_needed, 0);
status = synopGMAC_xmit_frames(gmacdev, (u8 *)&psgmacmemmgr->psTXFrames[index], p->tot_len, offload_needed, 0);
if (status != 0)
{
LOG_E("%s No More Free Tx skb\n", __func__);

View File

@ -37,12 +37,12 @@
/* Private functions ------------------------------------------------------------*/
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value);
static int nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args);
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value);
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args);
static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled);
static rt_base_t nu_gpio_pin_get(const char *name);
/* Private variables ------------------------------------------------------------*/
@ -144,7 +144,7 @@ static rt_base_t nu_gpio_pin_get(const char *name)
return -(RT_EINVAL);
}
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode)
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode)
{
GPIO_PORT PORT;
@ -178,7 +178,7 @@ static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode
}
}
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value)
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value)
{
GPIO_PORT PORT;
@ -193,7 +193,7 @@ static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t val
GPIO_ClrBit(PORT, NU_GET_PIN_MASK(NU_GET_PINS(pin)));
}
static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin)
{
GPIO_PORT PORT;
@ -205,7 +205,7 @@ static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
return GPIO_ReadBit(PORT, NU_GET_PIN_MASK(NU_GET_PINS(pin)));
}
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args)
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args)
{
rt_base_t level;
rt_int32_t irqindex;
@ -297,7 +297,7 @@ static void nu_gpio_isr(int vector, void *param)
outpw(REG_AIC_SCCRH, IRQ_GPIO - 1);
}
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled)
{
GPIO_PORT PORT;
GPIO_TRIGGER_TYPE triggerType;

View File

@ -66,7 +66,7 @@ typedef struct nu_qspi *nu_qspi_t;
static void nu_qspi_transmission_with_poll(struct nu_qspi *spi_bus,
uint8_t *send_addr, uint8_t *recv_addr, int length, uint8_t bytes_per_word);
static int nu_qspi_register_bus(struct nu_qspi *spi_bus, const char *name);
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_err_t nu_qspi_bus_configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
/* Public functions -------------------------------------------------------------*/
@ -354,7 +354,7 @@ static int nu_qspi_mode_config(struct nu_qspi *spi_bus, rt_uint8_t *tx, rt_uint8
return qspi_lines;
}
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{
struct nu_qspi *spi_bus;
struct rt_qspi_configuration *qspi_configuration;
@ -362,7 +362,7 @@ static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_
rt_uint8_t u8last = 1;
rt_uint8_t bytes_per_word;
uint32_t idx;
rt_uint32_t u32len = 0;
rt_ssize_t u32len = 0;
RT_ASSERT(device != RT_NULL);
RT_ASSERT(message != RT_NULL);

View File

@ -436,7 +436,7 @@ __STATIC_INLINE void nu_buffer_cpy(rt_uint8_t address, void *buffer, rt_size_t s
}
}
static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
static rt_size_t _ep_read(rt_uint8_t address, void *buffer)
{
rt_size_t size = 0;
@ -464,7 +464,7 @@ static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
return size;
}
static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT(!(address & USB_DIR_IN));
@ -496,7 +496,7 @@ static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t s
return size;
}
static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT((address & USB_DIR_IN));

View File

@ -161,7 +161,7 @@ static void nu_adc_touch_cal(int32_t *sumx, int32_t *sumy)
g_sCalMat.e * ytemp) / g_sCalMat.div;
}
static rt_ssize_t nu_adc_touch_readpoint(struct rt_touch_device *device, void *buf, rt_size_t read_num)
static rt_size_t nu_adc_touch_readpoint(struct rt_touch_device *device, void *buf, rt_size_t read_num)
{
static uint32_t last_report_x = 0, last_report_y = 0;
struct rt_touch_data *pPoint = (struct rt_touch_data *)buf;

View File

@ -29,12 +29,12 @@
/* Private functions ------------------------------------------------------------*/
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value);
static int nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args);
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode);
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value);
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin);
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args);
static rt_err_t nu_gpio_detach_irq(struct rt_device *device, rt_int32_t pin);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled);
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled);
static rt_base_t nu_gpio_pin_get(const char *name);
/* Private variables ------------------------------------------------------------*/
@ -127,7 +127,7 @@ static rt_base_t nu_gpio_pin_get(const char *name)
return -(RT_EINVAL);
}
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode)
static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_uint8_t mode)
{
GPIO_T *PORT;
@ -162,7 +162,7 @@ static void nu_gpio_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode
}
}
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t value)
static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_uint8_t value)
{
if (nu_port_check(pin))
return;
@ -170,7 +170,7 @@ static void nu_gpio_write(struct rt_device *device, rt_base_t pin, rt_base_t val
GPIO_PIN_DATA(NU_GET_PORT(pin), NU_GET_PINS(pin)) = value;
}
static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
static rt_int8_t nu_gpio_read(struct rt_device *device, rt_base_t pin)
{
if (nu_port_check(pin))
return PIN_LOW;
@ -178,7 +178,7 @@ static int nu_gpio_read(struct rt_device *device, rt_base_t pin)
return GPIO_PIN_DATA(NU_GET_PORT(pin), NU_GET_PINS(pin));
}
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args)
static rt_err_t nu_gpio_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint8_t mode, void (*hdr)(void *args), void *args)
{
rt_base_t level;
rt_int32_t irqindex;
@ -256,7 +256,7 @@ static void nu_gpio_isr(int vector, void *param)
PORT->INTSRC = int_status;
}
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled)
{
GPIO_T *PORT;
rt_base_t level;

View File

@ -39,7 +39,7 @@ enum
/* Private functions ------------------------------------------------------------*/
static rt_err_t nu_qspi_bus_configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static int nu_qspi_register_bus(struct nu_spi *qspi_bus, const char *name);
/* Public functions -------------------------------------------------------------*/
@ -197,7 +197,7 @@ static int nu_qspi_mode_config(struct nu_spi *qspi_bus, rt_uint8_t *tx, rt_uint8
return qspi_lines;
}
static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
static rt_ssize_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{
struct nu_spi *qspi_bus;
struct rt_qspi_configuration *qspi_configuration;
@ -205,7 +205,7 @@ static rt_uint32_t nu_qspi_bus_xfer(struct rt_spi_device *device, struct rt_spi_
rt_uint8_t u8last = 1;
rt_uint8_t bytes_per_word;
QSPI_T *qspi_base;
rt_uint32_t u32len = 0;
rt_ssize_t u32len = 0;
RT_ASSERT(device != RT_NULL);
RT_ASSERT(message != RT_NULL);

View File

@ -56,7 +56,7 @@ struct nu_spi_cs
static void nu_spi_transmission_with_poll(struct nu_spi *spi_bus,
uint8_t *send_addr, uint8_t *recv_addr, int length, uint8_t bytes_per_word);
static int nu_spi_register_bus(struct nu_spi *spi_bus, const char *name);
static rt_uint32_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_ssize_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message);
static rt_err_t nu_spi_bus_configure(struct rt_spi_device *device, struct rt_spi_configuration *configuration);
#if defined(BSP_USING_SPI_PDMA)
@ -570,7 +570,7 @@ void nu_spi_transfer(struct nu_spi *spi_bus, uint8_t *tx, uint8_t *rx, int lengt
#endif
}
static rt_uint32_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
static rt_ssize_t nu_spi_bus_xfer(struct rt_spi_device *device, struct rt_spi_message *message)
{
struct nu_spi *spi_bus;
struct rt_spi_configuration *configuration;

View File

@ -437,7 +437,7 @@ __STATIC_INLINE void nu_buffer_cpy(rt_uint8_t address, void *buffer, rt_size_t s
}
}
static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
static rt_size_t _ep_read(rt_uint8_t address, void *buffer)
{
rt_size_t size = 0;
@ -465,7 +465,7 @@ static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer)
return size;
}
static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT(!(address & USB_DIR_IN));
@ -497,7 +497,7 @@ static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t s
return size;
}
static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size)
{
RT_ASSERT((address & USB_DIR_IN));