[bsp][driver][Infineon]Fix timer interrupt callback conflict
This commit is contained in:
parent
3f26998f9c
commit
f3cbb8d58e
|
@ -16,6 +16,7 @@
|
|||
//#define DRV_DEBUG
|
||||
#define LOG_TAG "drv.hwtimer"
|
||||
#include <drv_log.h>
|
||||
|
||||
static void isr_timer(void *callback_arg, cyhal_timer_event_t event);
|
||||
|
||||
#ifdef RT_USING_HWTIMER
|
||||
|
@ -140,6 +141,7 @@ static rt_err_t timer_start(rt_hwtimer_t *timer, rt_uint32_t t, rt_hwtimer_mode_
|
|||
|
||||
/* Assign the ISR to execute on timer interrupt */
|
||||
cyhal_timer_register_callback(tim, isr_timer, NULL);
|
||||
|
||||
/* Set the event on which timer interrupt occurs and enable it */
|
||||
cyhal_timer_enable_event(tim, CYHAL_TIMER_IRQ_TERMINAL_COUNT, 1, true);
|
||||
|
||||
|
@ -214,7 +216,7 @@ static rt_err_t timer_ctrl(rt_hwtimer_t *timer, rt_uint32_t cmd, void *arg)
|
|||
static const struct rt_hwtimer_info _info = TIM_DEV_INFO_CONFIG;
|
||||
|
||||
static const struct rt_hwtimer_ops _ops =
|
||||
{
|
||||
{
|
||||
.init = timer_init,
|
||||
.start = timer_start,
|
||||
.stop = timer_stop,
|
||||
|
@ -222,7 +224,6 @@ static const struct rt_hwtimer_ops _ops =
|
|||
.control = timer_ctrl,
|
||||
};
|
||||
|
||||
#ifdef BSP_USING_TIM1
|
||||
static void isr_timer(void *callback_arg, cyhal_timer_event_t event)
|
||||
{
|
||||
/* enter interrupt */
|
||||
|
@ -230,28 +231,15 @@ static void isr_timer(void *callback_arg, cyhal_timer_event_t event)
|
|||
|
||||
(void)callback_arg;
|
||||
(void)event;
|
||||
|
||||
#ifdef BSP_USING_TIM1
|
||||
rt_device_hwtimer_isr(&cyp_hwtimer_obj[TIM1_INDEX].time_device);
|
||||
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
#endif
|
||||
#ifdef BSP_USING_TIM2
|
||||
static void isr_timer(void *callback_arg, cyhal_timer_event_t event)
|
||||
{
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
(void)callback_arg;
|
||||
(void)event;
|
||||
|
||||
rt_device_hwtimer_isr(&cyp_hwtimer_obj[TIM2_INDEX].time_device);
|
||||
|
||||
#endif
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
#endif
|
||||
|
||||
int cyp_hwtimer_init(void)
|
||||
{
|
||||
|
|
|
@ -143,6 +143,8 @@ if GetDepend(['RT_USING_DAC']):
|
|||
|
||||
if GetDepend(['RT_USING_HWTIMER']):
|
||||
src += ['mtb-hal-cat1/source/cyhal_timer.c']
|
||||
src += ['mtb-hal-cat1/source/cyhal_tcpwm_common.c']
|
||||
src += ['mtb-pdl-cat1/drivers/source/cy_tcpwm_counter.c']
|
||||
|
||||
path = [cwd + '/retarget-io',
|
||||
cwd + '/core-lib/include',
|
||||
|
|
Loading…
Reference in New Issue