Commit fa471172 authored by Sreeram Tatapudi's avatar Sreeram Tatapudi Committed by Fabio Baltieri
Browse files

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: default avatarSreeram Tatapudi <sreeram.praveen@infineon.com>
parent 3b3e28ae
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -396,6 +396,8 @@ 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);

	if ((absolute && (val < curr)) || (diff > max_rel_val)) {

		/* Interrupt is triggered always for relative alarm and for absolute depending
		 * on the flag.
		 */
@@ -404,7 +406,6 @@ static int ifx_cat1_counter_set_alarm(const struct device *dev, uint8_t chan_id,
			ifx_cat1_counter_set_int_pending(dev);
		}

	if ((absolute && (val < curr)) || (diff > max_rel_val)) {
		if (absolute) {
			return -ETIME;
		}
+10 −0
Original line number Diff line number Diff line
/*
 * 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";
};
+10 −0
Original line number Diff line number Diff line
/*
 * 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";
};