Functions | |
| rt_device_t | rt_device_find (const char *name) |
| rt_err_t | rt_device_register (rt_device_t dev, const char *name, rt_uint8_t flags) |
| rt_err_t | rt_device_unregister (rt_device_t dev) |
| rt_err_t | rt_device_init_all (void) |
| rt_err_t | rt_device_open (rt_device_t dev) |
| rt_err_t | rt_device_close (rt_device_t dev) |
| rt_err_t | rt_device_read (rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) |
| rt_err_t | rt_device_write (rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) |
| rt_err_t | rt_device_control (rt_device_t dev, rt_uint8_t cmd, void *arg) |
The Device System provide five interfaces to driver:
| rt_err_t rt_device_close | ( | rt_device_t | dev | ) |
This function will close a device
| dev | the pointer of device driver structure |
| rt_err_t rt_device_control | ( | rt_device_t | dev, | |
| rt_uint8_t | cmd, | |||
| void * | arg | |||
| ) |
This function will perform a variety of control functions on devices.
| dev | the pointer of device driver structure | |
| cmd | the command sent to device | |
| arg | the argument of command |
| rt_device_t rt_device_find | ( | const char * | name | ) |
This function finds a device driver by specified name.
| name | the device driver's name |
| rt_err_t rt_device_init_all | ( | void | ) |
This function initializes all registered device driver
| rt_err_t rt_device_open | ( | rt_device_t | dev | ) |
This function will open a device
| dev | the pointer of device driver structure |
| rt_err_t rt_device_read | ( | rt_device_t | dev, | |
| rt_off_t | pos, | |||
| void * | buffer, | |||
| rt_size_t | size | |||
| ) |
This function will read some data from a device.
| dev | the pointer of device driver structure | |
| pos | the position of reading | |
| buffer | the data buffer to save read data | |
| size | the size of buffer |
| rt_err_t rt_device_register | ( | rt_device_t | dev, | |
| const char * | name, | |||
| rt_uint8_t | flags | |||
| ) |
This function registers a device driver with specified name.
| dev | the pointer of device driver structure | |
| name | the device driver's name | |
| flags | the flag of device |
| rt_err_t rt_device_unregister | ( | rt_device_t | dev | ) |
This function removes a previouly registered device driver
| dev | the pointer of device driver structure |
| rt_err_t rt_device_write | ( | rt_device_t | dev, | |
| rt_off_t | pos, | |||
| const void * | buffer, | |||
| rt_size_t | size | |||
| ) |
This function will write some data to a device.
| dev | the pointer of device driver structure | |
| pos | the position of written | |
| buffer | the data buffer to be written to device | |
| size | the size of buffer |
1.5.7