drivers: counter: add counter_get_value(), deprecate counter_read()
Introduce a new counter API function for reading the current counter value (counter_get_value()) and deprecate the former counter_read() in favor of this. Update all drivers and calling code to match the new counter API. The previous counter driver API function for reading the current value of the counter (counter_read()) did not support indicating whether the read suceeded. This is fine for counters internal to the SoC where the read always succeeds but insufficient for external counters (e.g. I2C or SPI slaves). Fixes #21846. Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
This commit is contained in:
parent
748eb99646
commit
c894a6db4d
19 changed files with 162 additions and 58 deletions
|
@ -79,6 +79,12 @@ static u32_t mcux_rtc_read(struct device *dev)
|
|||
return ticks;
|
||||
}
|
||||
|
||||
static int mcux_rtc_get_value(struct device *dev, u32_t *ticks)
|
||||
{
|
||||
*ticks = mcux_rtc_read(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_rtc_set_alarm(struct device *dev, u8_t chan_id,
|
||||
const struct counter_alarm_cfg *alarm_cfg)
|
||||
{
|
||||
|
@ -245,7 +251,7 @@ static int mcux_rtc_init(struct device *dev)
|
|||
static const struct counter_driver_api mcux_rtc_driver_api = {
|
||||
.start = mcux_rtc_start,
|
||||
.stop = mcux_rtc_stop,
|
||||
.read = mcux_rtc_read,
|
||||
.get_value = mcux_rtc_get_value,
|
||||
.set_alarm = mcux_rtc_set_alarm,
|
||||
.cancel_alarm = mcux_rtc_cancel_alarm,
|
||||
.set_top_value = mcux_rtc_set_top_value,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue