RT-Thread的error code定义有0~10,一共11种,为什么rt_pin_get异常时返回值是-RT_ENOSYS而不是RT_ENOSYS,这个-是为什么?
/* RT-Thread error code definitions */
#define RT_EOK 0 /< There is no error */
#define RT_ERROR 1 /< A generic error happens */
#define RT_ETIMEOUT 2 /< Timed out */
#define RT_EFULL 3 /< The resource is full */
#define RT_EEMPTY 4 /< The resource is empty */
#define RT_ENOMEM 5 /< No memory */
#define RT_ENOSYS 6 /< No system */
#define RT_EBUSY 7 /< Busy */
#define RT_EIO 8 /< IO error */
#define RT_EINTR 9 /< Interrupted system call */
#define RT_EINVAL 10 /**< Invalid argument */
rt_base_t rt_pin_get(const char *name)
{
RT_ASSERT(_hw_pin.ops != RT_NULL);
if (name[0] != 'P' && name[0] != 'p')
{
return -RT_EINVAL;
}
if (_hw_pin.ops->pin_get == RT_NULL)
{
return -RT_ENOSYS;
}
return _hw_pin.ops->pin_get(name);
}
更多回帖