fixed the coding style in device.c
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2386 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
1aab195a7d
commit
5334925454
28
src/device.c
28
src/device.c
|
@ -28,7 +28,9 @@
|
||||||
*
|
*
|
||||||
* @return the error code, RT_EOK on initialization successfully.
|
* @return the error code, RT_EOK on initialization successfully.
|
||||||
*/
|
*/
|
||||||
rt_err_t rt_device_register(rt_device_t dev, const char *name, rt_uint16_t flags)
|
rt_err_t rt_device_register(rt_device_t dev,
|
||||||
|
const char *name,
|
||||||
|
rt_uint16_t flags)
|
||||||
{
|
{
|
||||||
if (dev == RT_NULL)
|
if (dev == RT_NULL)
|
||||||
return -RT_ERROR;
|
return -RT_ERROR;
|
||||||
|
@ -203,7 +205,7 @@ rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag)
|
||||||
/* if device is not initialized, initialize it. */
|
/* if device is not initialized, initialize it. */
|
||||||
if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
|
if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
|
||||||
{
|
{
|
||||||
if (dev->init != RT_NULL )
|
if (dev->init != RT_NULL)
|
||||||
{
|
{
|
||||||
result = dev->init(dev);
|
result = dev->init(dev);
|
||||||
if (result != RT_EOK)
|
if (result != RT_EOK)
|
||||||
|
@ -288,7 +290,10 @@ RTM_EXPORT(rt_device_close);
|
||||||
*
|
*
|
||||||
* @note since 0.4.0, the unit of size/pos is a block for block device.
|
* @note since 0.4.0, the unit of size/pos is a block for block device.
|
||||||
*/
|
*/
|
||||||
rt_size_t rt_device_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
|
rt_size_t rt_device_read(rt_device_t dev,
|
||||||
|
rt_off_t pos,
|
||||||
|
void *buffer,
|
||||||
|
rt_size_t size)
|
||||||
{
|
{
|
||||||
rt_size_t (*read)(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size);
|
rt_size_t (*read)(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size);
|
||||||
|
|
||||||
|
@ -320,7 +325,10 @@ RTM_EXPORT(rt_device_read);
|
||||||
*
|
*
|
||||||
* @note since 0.4.0, the unit of size/pos is a block for block device.
|
* @note since 0.4.0, the unit of size/pos is a block for block device.
|
||||||
*/
|
*/
|
||||||
rt_size_t rt_device_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
|
rt_size_t rt_device_write(rt_device_t dev,
|
||||||
|
rt_off_t pos,
|
||||||
|
const void *buffer,
|
||||||
|
rt_size_t size)
|
||||||
{
|
{
|
||||||
rt_size_t (*write)(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size);
|
rt_size_t (*write)(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size);
|
||||||
|
|
||||||
|
@ -375,7 +383,9 @@ RTM_EXPORT(rt_device_control);
|
||||||
*
|
*
|
||||||
* @return RT_EOK
|
* @return RT_EOK
|
||||||
*/
|
*/
|
||||||
rt_err_t rt_device_set_rx_indicate(rt_device_t dev, rt_err_t (*rx_ind)(rt_device_t dev, rt_size_t size))
|
rt_err_t
|
||||||
|
rt_device_set_rx_indicate(rt_device_t dev,
|
||||||
|
rt_err_t (*rx_ind)(rt_device_t dev, rt_size_t size))
|
||||||
{
|
{
|
||||||
RT_ASSERT(dev != RT_NULL);
|
RT_ASSERT(dev != RT_NULL);
|
||||||
|
|
||||||
|
@ -386,15 +396,17 @@ rt_err_t rt_device_set_rx_indicate(rt_device_t dev, rt_err_t (*rx_ind)(rt_device
|
||||||
RTM_EXPORT(rt_device_set_rx_indicate);
|
RTM_EXPORT(rt_device_set_rx_indicate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will set the indication callback function when device has written
|
* This function will set the indication callback function when device has
|
||||||
* data to physical hardware.
|
* written data to physical hardware.
|
||||||
*
|
*
|
||||||
* @param dev the pointer of device driver structure
|
* @param dev the pointer of device driver structure
|
||||||
* @param tx_done the indication callback function
|
* @param tx_done the indication callback function
|
||||||
*
|
*
|
||||||
* @return RT_EOK
|
* @return RT_EOK
|
||||||
*/
|
*/
|
||||||
rt_err_t rt_device_set_tx_complete(rt_device_t dev, rt_err_t (*tx_done)(rt_device_t dev, void *buffer))
|
rt_err_t
|
||||||
|
rt_device_set_tx_complete(rt_device_t dev,
|
||||||
|
rt_err_t (*tx_done)(rt_device_t dev, void *buffer))
|
||||||
{
|
{
|
||||||
RT_ASSERT(dev != RT_NULL);
|
RT_ASSERT(dev != RT_NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue