rtc_qmsi: 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 rtc as this is a wake event on Quark SE C1000. Jira: ZEP-1188 Change-Id: Id850ce405eb3f4857be720201e462ea8e24a334f Signed-off-by: Julien Delayen <julien.delayen@intel.com>
This commit is contained in:
parent
bd6285a3f1
commit
ee04a3f6d8
2 changed files with 29 additions and 0 deletions
|
@ -155,12 +155,18 @@ static uint32_t rtc_qmsi_read(struct device *dev)
|
|||
return QM_RTC[QM_RTC_0].rtc_ccvr;
|
||||
}
|
||||
|
||||
static uint32_t rtc_qmsi_get_pending_int(struct device *dev)
|
||||
{
|
||||
return QM_RTC[QM_RTC_0].rtc_stat;
|
||||
}
|
||||
|
||||
static const struct rtc_driver_api api = {
|
||||
.enable = rtc_qmsi_enable,
|
||||
.disable = rtc_qmsi_disable,
|
||||
.read = rtc_qmsi_read,
|
||||
.set_config = rtc_qmsi_set_config,
|
||||
.set_alarm = rtc_qmsi_set_alarm,
|
||||
.get_pending_int = rtc_qmsi_get_pending_int,
|
||||
};
|
||||
|
||||
static int rtc_qmsi_init(struct device *dev)
|
||||
|
|
|
@ -77,6 +77,7 @@ typedef int (*rtc_api_set_config)(struct device *dev,
|
|||
typedef int (*rtc_api_set_alarm)(struct device *dev,
|
||||
const uint32_t alarm_val);
|
||||
typedef uint32_t (*rtc_api_read)(struct device *dev);
|
||||
typedef uint32_t (*rtc_api_get_pending_int)(struct device *dev);
|
||||
|
||||
struct rtc_driver_api {
|
||||
rtc_api_enable enable;
|
||||
|
@ -84,6 +85,7 @@ struct rtc_driver_api {
|
|||
rtc_api_read read;
|
||||
rtc_api_set_config set_config;
|
||||
rtc_api_set_alarm set_alarm;
|
||||
rtc_api_get_pending_int get_pending_int;
|
||||
};
|
||||
|
||||
static inline uint32_t rtc_read(struct device *dev)
|
||||
|
@ -124,6 +126,27 @@ static inline int rtc_set_alarm(struct device *dev,
|
|||
return api->set_alarm(dev, alarm_val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 rtc interrupt is pending.
|
||||
* @retval 0 if no rtc interrupt is pending.
|
||||
*/
|
||||
static inline int rtc_get_pending_int(struct device *dev)
|
||||
{
|
||||
struct rtc_driver_api *api;
|
||||
|
||||
api = (struct rtc_driver_api *)dev->driver_api;
|
||||
return api->get_pending_int(dev);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue