Hello,
Could you help to install the ST timer on the AT91Rm9200? I don't know how to setup the AIC registers correct. Maybe there are more than one big mistake.
void initialize_pit() { unsigned int flag, period, irq_id, mask, oldHandler, src_type, priority; volatile int status; void *newHandler; //period Timer0->ST_PIMR = period << 5; AT91F_ST_SetPeriodInterval(Timer0, period); //state //status = Timer0->ST_SR; //enable interrupt flag=1; Timer0->ST_IER = flag; AT91F_ST_EnableIt( Timer0, flag); //enable PMC AT91F_PMC_EnablePeriphClock(AT91C_BASE_PMC, 1 << AT91C_ID_IRQ0); //config AIC irq_id = 0; oldHandler = pAic->AIC_SVR[irq_id]; mask = 0x1 << irq_id; pAic->AIC_IDCR = mask ; pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ; //* Store the Source Mode Register pAic->AIC_SMR[irq_id] = src_type | priority ; AT91F_AIC_ConfigureIt(pAic, irq_id, priority, src_type, newHandler); //enable AIC AT91F_AIC_EnableIt(pAic, 1); }
I hope somebody could help me with this problem...
best regards johannes
Please read all the comments above, and then explain why you think that you should use the __irq keyword in the function call.
The information you have received is that your Interrupt Service Routine (ISR) should be declared with the __isr keyword. You have even received an explicit example how that source line should be written.
Have you looked at _any_ example code for your processor? You can hardly find any example code that doesn't contain at least one ISR.
yes, but when I write
void ST_interrupt(void) __irq
I get a error in this line
AT91F_AIC_ConfigureIt(pAic, AT91C_ID_SYS, AT91C_AIC_PRIOR_HIGHEST - 6, AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE, ST_interrupt);
because the typ void (*)() __irg is not compatible with parameter of type void (*) ()
johannes
In that case, some typecasting might be required:
AT91F_AIC_ConfigureIt(pAic, AT91C_ID_SYS, AT91C_AIC_PRIOR_HIGHEST - 6, AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE, (void (*) ()) ST_interrupt);