Using ksdk on a Cortex M4. Using kdsk if your accessing hardware from inside and outside interrupts do you need to add disable and enable interrupts around the hardware access in the main thread? see //### below
Like this:
void main(void)
{
GPIO_PinInit(); //init some kdsk hardware
enableInterruptXYZ();
while (1)
{
disableInterruptXYZ(); //### need this line?
GPIO_WritePinOutput(); //access some kdsk hardware
enableInterruptXYZ(); //### also need this line?
//do other stuff
}
}
InterruptXYZ-Handler()
{
GPIO_WritePinOutput(); //access the same kdsk hardware
}
Ok. So your saying GPIO_WritePinOutput() is reentrant? If yes, seen an documentation confirming this?
Hi,
i think GPIO_WritePinOutput() is reentrant function.
BR
xiangjun Rong
Hi, Peter,
I think it is unnecessary to disable interrupt when you want to set or clear a GPIO pins no matter whether the setting/clearing GPIO pin is inside main loop or ISR. when you run the code GPIO_WritePinOutput(); the GPIO pin logic changes immediately.
Hope it can help you
BR
XiangJun Rong