* @brief This function will perform a variety of control functions on devices. * * @param dev is the pointer of device driver structure. * * @param cmd is the command sent to device. * * @param arg is the argument of command. * * @return the result, -RT_ENOSYS for failed. */
| 417 | * @return the result, -RT_ENOSYS for failed. |
| 418 | */ |
| 419 | rt_err_t rt_device_control(rt_device_t dev, int cmd, void *arg) |
| 420 | { |
| 421 | /* parameter check */ |
| 422 | RT_ASSERT(dev != RT_NULL); |
| 423 | RT_ASSERT(rt_object_get_type(&dev->parent) == RT_Object_Class_Device); |
| 424 | |
| 425 | /* call device_write interface */ |
| 426 | if (device_control != RT_NULL) |
| 427 | { |
| 428 | return device_control(dev, cmd, arg); |
| 429 | } |
| 430 | |
| 431 | return -RT_ENOSYS; |
| 432 | } |
| 433 | RTM_EXPORT(rt_device_control); |
| 434 | |
| 435 | /** |