STM32: Add a experimental oneshot, lower-half driver for STM32

This commit is contained in:
Gregory Nutt
2016-08-11 14:07:43 -06:00
parent 9de2c28656
commit 1bb93021df
2 changed files with 338 additions and 8 deletions
+13 -8
View File
@@ -131,23 +131,27 @@
* arg - The opaque argument provided when the interrupt was registered
*/
typedef void (*oneshot_callback_t)(FAR struct oneshot_dev_s *lower,
void *arg);
struct oneshot_lowerhalf_s;
typedef void (*oneshot_callback_t)(FAR struct oneshot_lowerhalf_s *lower,
FAR void *arg);
/* The one short operations supported by the lower half driver */
struct timespec;
struct oneshot_operations_s
{
CODE int (*max_delay)(FAR struct oneshot_s *lower, uint64_t *usec);
CODE int (*start)(FAR struct oneshot_dev_s *lower,
CODE int (*max_delay)(FAR struct oneshot_lowerhalf_s *lower,
FAR uint64_t *usec);
CODE int (*start)(FAR struct oneshot_lowerhalf_s *lower,
oneshot_callback_t callback, FAR void *arg,
FAR const struct timespec *ts);
CODE int (*cancel)(struct oneshot_dev_s *lower, FAR struct timespec *ts);
CODE int (*cancel)(struct oneshot_lowerhalf_s *lower,
FAR struct timespec *ts);
};
/* This structure describes the state of the oneshot timer driver */
/* This structure describes the state of the oneshot timer lower-half driver */
struct oneshot_dev_s
struct oneshot_lowerhalf_s
{
/* This is the part of the lower half driver that is visible to the upper-
* half client of the driver.
@@ -194,7 +198,8 @@ extern "C"
*
****************************************************************************/
FAR struct oneshot_dev_s *oneshot_initialize(int chan, uint16_t resolution);
FAR struct oneshot_lowerhalf_s *oneshot_initialize(int chan,
uint16_t resolution);
#undef EXTERN
#ifdef __cplusplus