Hello, as I am currently using bank interrupts for GPIO banks and was about to clear the banks in my ISR,
I wondered, why said function would need its third parameter, the interrupt status.
The implementation here in our SDK is the following one:
static inline void GPIO_clearBankIntrStatus(uint32_t baseAddr, uint32_t bankNum, uint32_t intrStatus) { uint32_t regIdx = bankNum >> 1U; volatile CSL_GpioRegs* hGpio = (volatile CSL_GpioRegs*)((uintptr_t) baseAddr); /* Clear the interrupt status of gpio bank */ intrStatus &= 0xFFFFU; if(bankNum & 0x01U) { intrStatus <<= GPIO_MAX_PIN_PER_BANK; /* Odd number bank - upper 16-bits are used */ } CSL_REG32_WR(&hGpio->BANK_REGISTERS[regIdx].INTSTAT, intrStatus); return; }
As far as I understand it, it doesn't clear the interrupt status but sets the interrupt status that is provided.
Then in the examples in examples/drivers/gpio/gpio_input_interrupt/gpio_input_interrupt.c it seems as if the code
/* Get and clear bank interrupt status */ intrStatus = GPIO_getBankIntrStatus(gGpioBaseAddr, bankNum); GPIO_clearBankIntrStatus(gGpioBaseAddr, bankNum, intrStatus);
simply sets the interrupt status which is already present.
As I see it, what I actually wanted was:
/* Get and clear bank interrupt status */ intrStatus = GPIO_getBankIntrStatus(gGpioBaseAddr, bankNum); GPIO_clearBankIntrStatus(gGpioBaseAddr, bankNum, 0U);
Or for future versions of the SDK, maybe ommit the last parameter at all and simply set intrStatus to 0U inside the function.
Am I correct here?
Thank you for your help.
Best regards
Philip.