fix error

This commit is contained in:
chinky 2023-04-28 13:59:13 +08:00
parent 3ce14027eb
commit e395a06b62
2 changed files with 8 additions and 7 deletions

View File

@ -179,7 +179,7 @@ typedef struct rt_serial_device rt_serial_t;
*/
struct rt_uart_ops
{
int (*init)(struct rt_serial_device *serial);
rt_err_t (*init)(struct rt_serial_device *serial);
rt_err_t (*configure)(struct rt_serial_device *serial, struct serial_configure *cfg);
rt_err_t (*control)(struct rt_serial_device *serial, int cmd, void *arg);

View File

@ -258,9 +258,9 @@ const static struct dfs_file_ops _serial_fops =
*
* @return length
*/
rt_inline rt_ssize_t _serial_fifo_calc_data_len(struct rt_serial_fifo *fifo)
rt_inline rt_size_t _serial_fifo_calc_data_len(struct rt_serial_fifo *fifo)
{
rt_ssize_t size;
rt_size_t size;
if (fifo->put_index == fifo->get_index) {
size = (fifo->is_full == RT_FALSE) ? 0 : fifo->buf_sz;
} else if (fifo->put_index > fifo->get_index) {
@ -940,7 +940,7 @@ static rt_err_t rt_serial_close(struct rt_device *dev)
return RT_EOK;
}
static rt_ssize_t rt_serial_read(struct rt_device *dev,
static rt_size_t rt_serial_read(struct rt_device *dev,
rt_off_t pos,
void *buffer,
rt_size_t size)
@ -955,7 +955,7 @@ static rt_ssize_t rt_serial_read(struct rt_device *dev,
return serial->_cb_rx(serial, (rt_uint8_t *)buffer, size);
}
static rt_ssize_t rt_serial_write(struct rt_device *dev,
static rt_size_t rt_serial_write(struct rt_device *dev,
rt_off_t pos,
const void *buffer,
rt_size_t size)
@ -1403,9 +1403,10 @@ rt_err_t rt_hw_serial_register(struct rt_serial_device *serial,
rt_err_t ret;
struct rt_device *device;
RT_ASSERT(serial != RT_NULL);
struct serial_configure uart_conf = RT_SERIAL_CONFIG_DEFAULT;
serial->config = RT_SERIAL_CONFIG_DEFAULT;
serial->bufsz = RT_SERIAL_FIFO_BUFSZ;
rt_memcpy(&serial->config, &uart_conf, sizeof(uart_conf));
serial->bufsz = uart_conf.bufsz;
device = &(serial->parent);