Part Number: TDA2HG
Hi, master
complete code:
//gpio2_6
#define gpio_pin 6 //14//6 //14// //gpio2-6
uint32_t gpio_base_address = SOC_GPIO2_BASE;
uint32_t interrupt_num = 52;//30//26;//51//52//29;//6;
#define IRQ_XBAR_CPU_ID CSL_XBAR_IRQ_CPU_ID_IPU1
#define IRQ_XBAR_INST_NO CSL_XBAR_INST_IPU2_IRQ_52//CSL_XBAR_INST_IPU1_IRQ_33
#define IRQ_XBAR_INDEX CSL_XBAR_GPIO2_IRQ_1//CSL_XBAR_DSP1_IRQ_MMU0
//isr thread
void gpioIsr(void *arg)
{
Vps_printf("I");
//GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin); //cam4 934 intb //GPIO2_6_PD cam4 int
#if 1
uint32_t gpio_pin_value;//,cam4_pin_value = 6;
/*Disable interrupt*/
GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin); //cam4 934 intb //GPIO2_6_PD cam4 int
/*Read pin*/
gpio_pin_value = GPIOPinRead(gpio_base_address, gpio_pin);
GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
printf( "I\n");
/*Enable interrupt interrupt*/
GPIOPinIntEnable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
#endif
}
int cam_intb_init(void)
{
//m4pid0
/*Configure interrupt controller*/
BspOsal_irqXbarConnect(CSL_XBAR_INST_IPU2_IRQ_52,CSL_XBAR_GPIO2_IRQ_1);
BspOsal_registerIntr(interrupt_num,gpioIsr,(void *) 0);
GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
#if 1
/*Enable GPIO*/
GPIOModuleEnable(gpio_base_address);
/*Configure and enable debouncing feature*/
GPIODebounceTimeConfig(gpio_base_address, 0xFF);
Vps_printf("GPIODebounceTimeConfig\n");
GPIODebounceFuncControl(gpio_base_address, gpio_pin,
GPIO_DEBOUNCE_FUNC_ENABLE);
Vps_printf("GPIODebounceFuncContro\n");
GPIOIntTypeSet(gpio_base_address, gpio_pin,GPIO_INT_TYPE_FALL_EDGE);
Vps_printf("GPIOIntTypeSet\n");
/* Set pin direction as input*/
GPIODirModeSet(gpio_base_address, gpio_pin, GPIO_DIR_INPUT);
Vps_printf("GPIODirModeSet\n");
/*Clear interrupt*/
GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
Vps_printf("GPIOPinIntDisable\n");
GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
Vps_printf("GPIOPinIntClear\n");
/*Enable interrupt*/
GPIOPinIntEnable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin);
Vps_printf("GPIOPinIntEnable\n");
#endif
return 0;
}
I am not sure if the interrupt_num = 52 and gpio_pin = 6 of gpio2_6 are correct.
I'm not sure GPIO2_6 is configured correctly as follows
BspOsal_irqXbarConnect (CSL_XBAR_INST_IPU2_IRQ_52, CSL_XBAR_GPIO2_IRQ_1);
