drivers: counter: cat1: Fix test_single_shot_alarm_notop

TC "test_single_shot_alarm_notop" is failing because there were 2 ISR
callbacks instead of one. this is because of invoking
ifx_cat1_counter_set_int_pending incorrectly. Updated
ifx_cat1_counter_set_alarm to fix this

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
This commit is contained in:
Sreeram Tatapudi 2023-07-31 17:48:57 -07:00 committed by Fabio Baltieri
parent 3b3e28aeda
commit fa471172b7
3 changed files with 29 additions and 8 deletions

View file

@ -396,15 +396,16 @@ static int ifx_cat1_counter_set_alarm(const struct device *dev, uint8_t chan_id,
uint32_t curr = cyhal_timer_read(&data->counter_obj);
uint32_t diff = ifx_cat1_counter_ticks_sub((val - 1), curr, top_val);
/* Interrupt is triggered always for relative alarm and for absolute depending
* on the flag.
*/
if (irq_on_late) {
data->alarm_irq_flag = true;
ifx_cat1_counter_set_int_pending(dev);
}
if ((absolute && (val < curr)) || (diff > max_rel_val)) {
/* Interrupt is triggered always for relative alarm and for absolute depending
* on the flag.
*/
if (irq_on_late) {
data->alarm_irq_flag = true;
ifx_cat1_counter_set_int_pending(dev);
}
if (absolute) {
return -ETIME;
}

View file

@ -0,0 +1,10 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation
*/
counter0_0: &counter0_0 {
status = "okay";
};

View file

@ -0,0 +1,10 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation
*/
counter0_0: &counter0_0 {
status = "okay";
};