11-04-2018 05:58 PM
Hi! dear all, There's been a problem lately,when I set -DUSE_AMP=1 for Compiler options in vivado,through Linux by core0 can startup core1,but core1's timer interrupt can not be trigger,when I was close this options, isolated to run core1 and timer interrupt,it would be trigger, but the Linux by core0 can not startup for this way,how can I solve this problem,waiting and Thank you.
11-04-2018 06:14 PM
How did you setup timer in core-1? You have to setup global timer in core-1 before you can use timer interrupt. For your reference, I paste my code here, hope it helps.
/* Interrupt Controller setup */ static int app_gic_initialize(void) { u32 Status; XScuGic_Config *IntcConfig; /* The configuration parameters of the interrupt controller */ Xil_ExceptionDisable(); /* * Initialize the interrupt controller driver */ IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID); if (NULL == IntcConfig) { return XST_FAILURE; } Status = XScuGic_CfgInitialize(&xInterruptController, IntcConfig, IntcConfig->CpuBaseAddress); if (Status != XST_SUCCESS) { return XST_FAILURE; } ConfigPtr = XScuTimer_LookupConfig(TIMER_DEVICE_ID); Status = XScuTimer_CfgInitialize(&Timer, ConfigPtr, ConfigPtr->BaseAddr); if (Status != XST_SUCCESS) {return XST_FAILURE; } XScuGic_Enable(&xInterruptController, (u16)TIMER_IRPT_INTR); /* * Register the interrupt handler to the hardware interrupt handling * logic in the ARM processor. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT, (Xil_ExceptionHandler)XScuGic_InterruptHandler, &xInterruptController); Xil_ExceptionEnable(); /* Connect IPI0 Interrupt ID with ISR */ XScuGic_Connect(&xInterruptController, VRING0_IPI_INTR_VECT, (Xil_ExceptionHandler)metal_irq_isr, (void *)VRING0_IPI_INTR_VECT); /* Connect IPI1 Interrupt ID with ISR */ XScuGic_Connect(&xInterruptController, VRING1_IPI_INTR_VECT, (Xil_ExceptionHandler)metal_irq_isr, (void *)VRING1_IPI_INTR_VECT); XScuGic_Connect(&xInterruptController, (u16)TIMER_IRPT_INTR, (Xil_ExceptionHandler)TimerIntrHandler, &Timer); XScuTimer_EnableAutoReload(&Timer); XScuTimer_LoadTimer(&Timer, (u32)TIMER_LOAD_VALUE); return 0; }
note it is part of the helper.cc file in openAMP framework.
11-04-2018 07:00 PM
think you for your answer.
Here is my initialize code,can you give me some advice? Think you.
void TimerIntrHandler(void)
{
XScuTimer_ClearInterruptStatus(&Timer);
Isr_125us();
}
void SET_TIM0_FREQ(uint32_t _ulFreq)
{
u8 usPrescaler;
u32 usPeriod;
usPeriod = 333*1000*1000/_ulFreq -1;
XScuTimer_ClearInterruptStatus(&Timer);
//XScuTimer_SetPrescaler(&Timer, usPrescaler);
XScuTimer_LoadTimer(&Timer, usPeriod);
XScuTimer_EnableAutoReload(&Timer);
XScuTimer_EnableInterrupt(&Timer);//enable interrupt on the timer
XScuTimer_Start(&Timer);
}
void TIM0_Configuration(XScuGic *GicInstancePtr,
XScuTimer *TimerInstancePtr, u16 TimerIntrId)
{
XScuGic_Config *IntcConfig; //GIC config
u32 IntID;
Xil_ExceptionInit();
//initialise the GIC
IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
XScuGic_CfgInitialize(GicInstancePtr, IntcConfig,
IntcConfig->CpuBaseAddress);
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
(Xil_ExceptionHandler)XScuGic_InterruptHandler,//connect to the hardware
GicInstancePtr);
XScuGic_Connect(GicInstancePtr, TimerIntrId,
(Xil_ExceptionHandler)TimerIntrHandler,//set up the timer interrupt
(void *)TimerInstancePtr);
XScuGic_Enable(GicInstancePtr, TimerIntrId);//enable the interrupt for the Timer at GIC
XScuTimer_EnableInterrupt(TimerInstancePtr);//enable interrupt on the timer
Xil_ExceptionEnableMask(XIL_EXCEPTION_IRQ); //Enable interrupts in the Processor.
}
void InitPrivateTimer(void)
{
int xStatus;
XScuTimer_Config *TMRConfigPtr;//TM
TMRConfigPtr = XScuTimer_LookupConfig(TIMER_DEVICE_ID);
XScuTimer_CfgInitialize(&Timer, TMRConfigPtr,TMRConfigPtr->BaseAddr);
TIM0_Configuration(&Intc,&Timer,TIMER_IRPT_INTR);
SET_TIM0_FREQ(8000);
}