summaryrefslogtreecommitdiff
path: root/include/counter.h
diff options
context:
space:
mode:
authorJulien Delayen <julien.delayen@intel.com>2016-11-03 13:43:36 +0000
committerAnas Nashif <nashif@linux.intel.com>2016-11-03 21:29:48 +0000
commit74799a326ecb1a1cfee045fed32dcb0c6977b546 (patch)
tree4e504a7a784d2301ff64a9c112bc71372b920b1e /include/counter.h
parenta770264ef3b5641539880c023638f99187313029 (diff)
counter_qmsi_aonpt: Add get_pending_int API
For AON peripherals on Quark SE C1000, an API is needed to retrieve the interrupt status after wake up. This enables the application to know the wake source before enabling again the interrupts. Add this API to the periodic timer as this is a wake event on Quark SE C1000. Jira: ZEP-1188 Change-Id: I79976230bccb1f970b6856d28bf7428175167828 Signed-off-by: Julien Delayen <julien.delayen@intel.com>
Diffstat (limited to 'include/counter.h')
-rw-r--r--include/counter.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/counter.h b/include/counter.h
index 593bbfe3b..7fe4bd950 100644
--- a/include/counter.h
+++ b/include/counter.h
@@ -45,12 +45,14 @@ typedef uint32_t (*counter_api_read)(void);
typedef int (*counter_api_set_alarm)(struct device *dev,
counter_callback_t callback,
uint32_t count, void *user_data);
+typedef uint32_t (*counter_api_get_pending_int)(struct device *dev);
struct counter_driver_api {
counter_api_start start;
counter_api_stop stop;
counter_api_read read;
counter_api_set_alarm set_alarm;
+ counter_api_get_pending_int get_pending_int;
};
/**
@@ -123,6 +125,27 @@ static inline int counter_set_alarm(struct device *dev,
return api->set_alarm(dev, callback, count, user_data);
}
+/**
+ * @brief Function to get pending interrupts
+ *
+ * The purpose of this function is to return the interrupt
+ * status register for the device.
+ * This is especially useful when waking up from
+ * low power states to check the wake up source.
+ *
+ * @param dev Pointer to the device structure for the driver instance.
+ *
+ * @retval 1 if the counter interrupt is pending.
+ * @retval 0 if no counter interrupt is pending.
+ */
+static inline int counter_get_pending_int(struct device *dev)
+{
+ struct counter_driver_api *api;
+
+ api = (struct counter_driver_api *)dev->driver_api;
+ return api->get_pending_int(dev);
+}
+
#ifdef __cplusplus
}
#endif