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>
This commit is contained in:
parent
a770264ef3
commit
74799a326e
2 changed files with 29 additions and 0 deletions
|
@ -162,11 +162,17 @@ static int aon_timer_qmsi_set_alarm(struct device *dev,
|
|||
return result;
|
||||
}
|
||||
|
||||
static uint32_t aon_timer_qmsi_get_pending_int(struct device *dev)
|
||||
{
|
||||
return QM_AONC[QM_AONC_0].aonpt_stat;
|
||||
}
|
||||
|
||||
static const struct counter_driver_api aon_timer_qmsi_api = {
|
||||
.start = aon_timer_qmsi_start,
|
||||
.stop = aon_timer_qmsi_stop,
|
||||
.read = aon_timer_qmsi_read,
|
||||
.set_alarm = aon_timer_qmsi_set_alarm,
|
||||
.get_pending_int = aon_timer_qmsi_get_pending_int,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue