Hi,
I am trying to write a GPIO interrupt program on Beaglebone Block (BBB) based on the SDK
AM335X_StarterWare_02_00_01_01. However, I encounter two problems. One is a
segmentation fault occurred in the function IntAINTCInit() invoked. I found the statement HWREG(SOC_AINTC_REGS + INTC_SYSCONFIG) = INTC_SYSCONFIG_SOFTRESET;
introduces a segmentation fault. The SOC_AINTC_REGS address seems to be invalid for
direct access. How to resolve this issue?
Second, I used mmap() to give a virtual address instead of the physical address of
SOC_AINTC_REGS, but the BBB crashes after running my program. How to do for
programming the interrupt correctly on BBB? Thank you!
void IntAINTCInit(void)
{
unsigned int intrNum;
/* Reset the ARM interrupt controller */
HWREG(SOC_AINTC_REGS + INTC_SYSCONFIG) = INTC_SYSCONFIG_SOFTRESET;
/* Wait for the reset to complete */
while((HWREG(SOC_AINTC_REGS + INTC_SYSSTATUS)
& INTC_SYSSTATUS_RESETDONE) != INTC_SYSSTATUS_RESETDONE);
/* Enable any interrupt generation by setting priority threshold */
HWREG(SOC_AINTC_REGS + INTC_THRESHOLD) =
INTC_THRESHOLD_PRIORITYTHRESHOLD;
/* Register the default handler for all interrupts */
for(intrNum = 0; intrNum < NUM_INTERRUPTS; intrNum++)
{
fnRAMVectors[intrNum] = IntDefaultHandler;
}
}