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

drivers: counter: cat1: Fix formatting issues



Minor format fixes for consistency

Signed-off-by: default avatarSreeram Tatapudi <sreeram.praveen@infineon.com>
parent fa471172
Loading
Loading
Loading
Loading
+33 −41
Original line number Diff line number Diff line
@@ -99,8 +99,7 @@ static void ifx_cat1_counter_event_callback(void *callback_arg, cyhal_timer_even
	    (((CYHAL_TIMER_IRQ_CAPTURE_COMPARE & event) == CYHAL_TIMER_IRQ_CAPTURE_COMPARE) ||
	     data->alarm_irq_flag)) {
		/* Alarm works as one-shot, so disable event */
		cyhal_timer_enable_event(&data->counter_obj,
					 CYHAL_TIMER_IRQ_CAPTURE_COMPARE,
		cyhal_timer_enable_event(&data->counter_obj, CYHAL_TIMER_IRQ_CAPTURE_COMPARE,
					 config->irq_priority, false);

		/* Call User callback for Alarm */
@@ -205,8 +204,7 @@ static int ifx_cat1_counter_init(const struct device *dev)
	}

	/* Register timer event callback */
	cyhal_timer_register_callback(&data->counter_obj,
				      ifx_cat1_counter_event_callback,
	cyhal_timer_register_callback(&data->counter_obj, ifx_cat1_counter_event_callback,
				      (void *)dev);

	return 0;
@@ -292,7 +290,8 @@ static int ifx_cat1_counter_set_top_value(const struct device *dev,
				return -EIO;
			}
		} else {
			TCPWM_CNT_PERIOD(data->counter_obj.tcpwm.base, _CYHAL_TCPWM_CNT_NUMBER(
			TCPWM_CNT_PERIOD(data->counter_obj.tcpwm.base,
					 _CYHAL_TCPWM_CNT_NUMBER(
						 data->counter_obj.tcpwm.resource)) = cfg->ticks;
		}

@@ -307,7 +306,6 @@ static int ifx_cat1_counter_set_top_value(const struct device *dev,
	return 0;
}


static uint32_t ifx_cat1_counter_get_top_value(const struct device *dev)
{
	__ASSERT_NO_MSG(dev != NULL);
@@ -386,8 +384,8 @@ static int ifx_cat1_counter_set_alarm(const struct device *dev, uint8_t chan_id,

		/* limit max to detect short relative being set too late. */
		max_rel_val = irq_on_late ? (top_val / 2U) : top_val;
		val = ifx_cat1_counter_ticks_add(cyhal_timer_read(&data->counter_obj),
						 val, top_val);
		val = ifx_cat1_counter_ticks_add(cyhal_timer_read(&data->counter_obj), val,
						 top_val);
	}

	/* Decrement value to detect also case when val == counter_read(dev). Otherwise,
@@ -435,8 +433,7 @@ static int ifx_cat1_counter_set_alarm(const struct device *dev, uint8_t chan_id,
				data->counter_cfg.compare_value;
		}

		cyhal_timer_enable_event(&data->counter_obj,
					 CYHAL_TIMER_IRQ_CAPTURE_COMPARE,
		cyhal_timer_enable_event(&data->counter_obj, CYHAL_TIMER_IRQ_CAPTURE_COMPARE,
					 config->irq_priority, true);
	}

@@ -502,10 +499,9 @@ static const struct counter_driver_api counter_api = {
};

#define DT_INST_GET_CYHAL_GPIO_OR(inst, gpios_prop, default)                                       \
	COND_CODE_1(					     \
		DT_INST_NODE_HAS_PROP(inst, gpios_prop),     \
		(DT_GET_CYHAL_GPIO_FROM_DT_GPIOS(	     \
			 DT_INST(inst, DT_DRV_COMPAT), gpios_prop)), (default))
	COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, gpios_prop),                                       \
		    (DT_GET_CYHAL_GPIO_FROM_DT_GPIOS(DT_INST(inst, DT_DRV_COMPAT), gpios_prop)),   \
		    (default))

/* Counter driver init macros */
#define INFINEON_CAT1_COUNTER_INIT(n)                                                              \
@@ -513,22 +509,18 @@ static const struct counter_driver_api counter_api = {
	static struct ifx_cat1_counter_data ifx_cat1_counter##n##_data;                            \
                                                                                                   \
	static const struct ifx_cat1_counter_config ifx_cat1_counter##n##_config = {               \
		.counter_info = {							 \
				.max_top_value = (DT_INST_PROP(n, resolution) == 32)	 \
				? UINT32_MAX : UINT16_MAX,				 \
		.counter_info = {.max_top_value = (DT_INST_PROP(n, resolution) == 32)              \
							  ? UINT32_MAX                             \
							  : UINT16_MAX,                            \
				 .freq = DT_INST_PROP_OR(n, clock_frequency, 10000),               \
				 .flags = COUNTER_CONFIG_INFO_COUNT_UP,                            \
				.channels = 1						 \
			},								 \
				 .channels = 1},                                                   \
		.reg_addr = (TCPWM_CNT_Type *)DT_INST_REG_ADDR(n),                                 \
		.irq_priority = DT_INST_IRQ(n, priority),                                          \
		.irqn = DT_INST_IRQN(n),                                                           \
		.external_pin = (cyhal_gpio_t)						 \
				DT_INST_GET_CYHAL_GPIO_OR(n, external_trigger_gpios, NC) \
	};										 \
	DEVICE_DT_INST_DEFINE(n,							 \
			      ifx_cat1_counter_init,					 \
			      NULL, &ifx_cat1_counter##n##_data,			 \
		.external_pin =                                                                    \
			(cyhal_gpio_t)DT_INST_GET_CYHAL_GPIO_OR(n, external_trigger_gpios, NC)};   \
	DEVICE_DT_INST_DEFINE(n, ifx_cat1_counter_init, NULL, &ifx_cat1_counter##n##_data,         \
			      &ifx_cat1_counter##n##_config, PRE_KERNEL_1,                         \
			      CONFIG_COUNTER_INIT_PRIORITY, &counter_api);