Merge pull request #107 from visitor83/pulls
format s3c24x0 serial.c and mini2440 rtconfig.py
This commit is contained in:
commit
ce176ee1d6
|
@ -102,6 +102,12 @@ static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt
|
|||
err_code = RT_EOK;
|
||||
uart = (struct serial_device*)dev->user_data;
|
||||
|
||||
if (ptr == RT_NULL)
|
||||
{
|
||||
err_code = -RT_ENOMEM;
|
||||
rt_set_errno(err_code);
|
||||
return -RT_ENOMEM;
|
||||
}
|
||||
if (dev->flag & RT_DEVICE_FLAG_INT_RX)
|
||||
{
|
||||
rt_base_t level;
|
||||
|
@ -160,6 +166,12 @@ static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buf
|
|||
ptr = (rt_uint8_t*)buffer;
|
||||
uart = (struct serial_device*)dev->user_data;
|
||||
|
||||
if (ptr == RT_NULL)
|
||||
{
|
||||
err_code = -RT_ENOMEM;
|
||||
rt_set_errno(err_code);
|
||||
return -RT_ENOMEM;
|
||||
}
|
||||
if (dev->flag & RT_DEVICE_FLAG_INT_TX)
|
||||
{
|
||||
/* interrupt mode Tx */
|
||||
|
@ -200,13 +212,13 @@ static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buf
|
|||
while (!(uart->uart_device->ustat & USTAT_TXB_EMPTY));
|
||||
uart->uart_device->utxh = (*ptr & 0xFF);
|
||||
|
||||
++ptr; --size;
|
||||
++ptr;
|
||||
--size;
|
||||
}
|
||||
}
|
||||
|
||||
/* set error code */
|
||||
rt_set_errno(err_code);
|
||||
|
||||
return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue