timer: add timer operation support

Add basic timer operations to the kernel, including registration,
start/stop, and callback handling. This provides a consistent timer
interface for use by kernel components and drivers.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
This commit is contained in:
xucheng5
2024-11-26 15:58:27 +08:00
committed by Xiang Xiao
parent 2a8acac159
commit f989860c4a
3 changed files with 163 additions and 8 deletions
+16 -6
View File
@@ -68,6 +68,13 @@
* struct timer_notify_s.
* TCIOC_MAXTIMEOUT - Get the maximum supported timeout value
* Argument: A 32-bit timeout value in microseconds.
* TCIOC_TICK_GETSTATUS - Get the status of the timer.
* Argument: A writeable pointer to struct
* timer_status_s.
* TCIOC_TICK_SETTIMEOUT - Reset the timer timeout to this value
* Argument: A 32-bit timeout value in ticks.
* TCIOC_TICK_MAXTIMEOUT - Get the maximum supported timeout value
* Argument: A 32-bit timeout value in ticks.
*
* WARNING: May change TCIOC_SETTIMEOUT to pass pointer to 64bit nanoseconds
* or timespec structure.
@@ -78,12 +85,15 @@
* range.
*/
#define TCIOC_START _TCIOC(0x0001)
#define TCIOC_STOP _TCIOC(0x0002)
#define TCIOC_GETSTATUS _TCIOC(0x0003)
#define TCIOC_SETTIMEOUT _TCIOC(0x0004)
#define TCIOC_NOTIFICATION _TCIOC(0x0005)
#define TCIOC_MAXTIMEOUT _TCIOC(0x0006)
#define TCIOC_START _TCIOC(0x0001)
#define TCIOC_STOP _TCIOC(0x0002)
#define TCIOC_GETSTATUS _TCIOC(0x0003)
#define TCIOC_SETTIMEOUT _TCIOC(0x0004)
#define TCIOC_NOTIFICATION _TCIOC(0x0005)
#define TCIOC_MAXTIMEOUT _TCIOC(0x0006)
#define TCIOC_TICK_GETSTATUS _TCIOC(0x0007)
#define TCIOC_TICK_SETTIMEOUT _TCIOC(0x0008)
#define TCIOC_TICK_MAXTIMEOUT _TCIOC(0x0009)
/* Bit Settings *************************************************************/