Question

This is specific to XILINX-7000 family boards which has dual core A9 cortex CPU. In the function OEMInterruptHandler I want to find out the core on which the current code is executing. This is for debug purpose as I found out that when the GPIO IRQ is targeted to CORE0 everything works fine but on CORE1 the GPIO IRQ is being preempted. The priority of GPIO IRQ is 0. The priority of all other IRQs are 0xA0. IRQs 0-31 are targeted on both cores and all other SPI except GPIO are targeted to core0. The OS is Windows CE 2013. Here is code from OEMInterruptHandler

    ULONG sys_intr = SYSINTR_NOP;
    UINT32 gic_iar = 0;
    UINT32 core;
    UINT32 irq = 0;

    gic_iar = (INREG32(&g_GICCpu->INTACK));
    irq = ((gic_iar & GIC_CPU_INTACK_INTID_MASK) << GIC_CPU_INTACK_INTID_SHIFT);
    // read the core 
    core = readcore();
    // enable interrupts
    INTERRUPTS_ON();
    ....

I am looking for the implementation of readcore() function.

Thanks

Was it helpful?

Solution

If you're in an interrupt handler you're presumably at PL1, in which case you can just read the MPIDR directly:

readcore:
    MRC  p15, 0, r0, c0, c0, 5
    AND  r0, r0, #3
    BX   lr
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top