mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 01:42:58 +08:00
Timer driver: Add hooks to support signal notification of timer expiration. Commented out because invasive interface changes would also be required to complete the implementation.
This commit is contained in:
@@ -52,6 +52,12 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* It would require some interface modifcations in order to support
|
||||
* notifications.
|
||||
*/
|
||||
|
||||
#undef HAVE_NOTIFICATION
|
||||
|
||||
/* IOCTL Commands ***********************************************************/
|
||||
/* The timer driver uses a standard character driver framework. However,
|
||||
* since the timer driver is a device control interface and not a data
|
||||
@@ -60,14 +66,18 @@
|
||||
*
|
||||
* These are detected and handled by the "upper half" timer driver.
|
||||
*
|
||||
* TCIOC_START - Start the timer
|
||||
* Argument: Ignored
|
||||
* TCIOC_STOP - Stop the timer
|
||||
* Argument: Ignored
|
||||
* TCIOC_GETSTATUS - Get the status of the timer.
|
||||
* Argument: A writeable pointer to struct timer_status_s.
|
||||
* TCIOC_SETTIMEOUT - Reset the timer timeout to this value
|
||||
* Argument: A 32-bit timeout value in microseconds.
|
||||
* TCIOC_START - Start the timer
|
||||
* Argument: Ignored
|
||||
* TCIOC_STOP - Stop the timer
|
||||
* Argument: Ignored
|
||||
* TCIOC_GETSTATUS - Get the status of the timer.
|
||||
* Argument: A writeable pointer to struct timer_status_s.
|
||||
* TCIOC_SETTIMEOUT - Reset the timer timeout to this value
|
||||
* Argument: A 32-bit timeout value in microseconds.
|
||||
* TCIOC_NOTIFICATION - Set up to notify an application via a signal when
|
||||
* the timer expires.
|
||||
* Argument: A read-only pointer to an instance of
|
||||
* stuct timer_notify_s.
|
||||
*
|
||||
* WARNING: May change TCIOC_SETTIMEOUT to pass pointer to 64bit nanoseconds
|
||||
* or timespec structure.
|
||||
@@ -82,18 +92,20 @@
|
||||
* range.
|
||||
*/
|
||||
|
||||
#define TCIOC_START _TCIOC(0x0001)
|
||||
#define TCIOC_STOP _TCIOC(0x0002)
|
||||
#define TCIOC_GETSTATUS _TCIOC(0x0003)
|
||||
#define TCIOC_SETTIMEOUT _TCIOC(0x0004)
|
||||
#define TCIOC_SETHANDLER _TCIOC(0x0005)
|
||||
#define TCIOC_START _TCIOC(0x0001)
|
||||
#define TCIOC_STOP _TCIOC(0x0002)
|
||||
#define TCIOC_GETSTATUS _TCIOC(0x0003)
|
||||
#define TCIOC_SETTIMEOUT _TCIOC(0x0004)
|
||||
#ifdef HAVE_NOTIFICATION
|
||||
#define TCIOC_NOTIFICATION _TCIOC(0x0005)
|
||||
#endif
|
||||
|
||||
/* Bit Settings *************************************************************/
|
||||
/* Bit settings for the struct timer_status_s flags field */
|
||||
|
||||
#define TCFLAGS_ACTIVE (1 << 0) /* 1=The timer is running */
|
||||
#define TCFLAGS_HANDLER (1 << 1) /* 1=Call the user function when the
|
||||
* timer expires */
|
||||
#define TCFLAGS_ACTIVE (1 << 0) /* 1=The timer is running */
|
||||
#define TCFLAGS_HANDLER (1 << 1) /* 1=Call the user function when the
|
||||
* timer expires */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
@@ -117,6 +129,17 @@ struct timer_status_s
|
||||
* (in microseconds) */
|
||||
};
|
||||
|
||||
#ifdef HAVE_NOTIFICATION
|
||||
/* This is the type of the argument passed to the TCIOC_NOTIFICATION ioctl */
|
||||
|
||||
struct timer_notify_s
|
||||
{
|
||||
FAR void *arg; /* An argument to pass with the signal */
|
||||
pid_t pid; /* The ID of the task/thread to receive the signal */
|
||||
uint8_t signal; /* The signal number to use in the notification */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* This structure provides the "lower-half" driver operations available to
|
||||
* the "upper-half" driver.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user