summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwdfk-prog <[email protected]>2024-07-11 13:44:42 +0800
committerRbb666 <[email protected]>2024-07-19 11:51:39 +0800
commita837f2b8e9b921b6318b63d28f7f77a98ca752b0 (patch)
tree7dd74d38f46d065455b400deff76b0418f2404f9
parentbceb6635b09451e9d8ec150cd57f82b6a8cedfc1 (diff)
[compoents][hwtimer]Add a user control interface
-rw-r--r--components/drivers/hwtimer/hwtimer.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/components/drivers/hwtimer/hwtimer.c b/components/drivers/hwtimer/hwtimer.c
index bcf9ea9a2a..1b2792558d 100644
--- a/components/drivers/hwtimer/hwtimer.c
+++ b/components/drivers/hwtimer/hwtimer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2023, RT-Thread Development Team
+ * Copyright (c) 2006-2024 RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -320,7 +320,14 @@ static rt_err_t rt_hwtimer_control(struct rt_device *dev, int cmd, void *args)
break;
default:
{
- result = -RT_ENOSYS;
+ if (timer->ops->control != RT_NULL)
+ {
+ result = timer->ops->control(timer, cmd, args);
+ }
+ else
+ {
+ result = -RT_ENOSYS;
+ }
}
break;
}