I'm working on T1042RDB and The board have duart for serial communication. I dont want to use polling method to receive or transmit data and because of that i try to write an interrupt handler for UART but i am also new to powerpc family. I'll tell what I tried to write an interrupt handler but i'm sold i'm wrong : )
btw, i dont use any operating systems, the application which i try to write is standalone.
I firstly read the T1040 reference manual and chapter 5 is about Interrupt Assignments.
in that chapter ;
there is a table for internal interrupt sources and it says 20th internal interrupt corresponds to DUART 1 interrrupt source.
the explanation for IVPR from e5500 reference manual ;
"IVPR[0-47] provides the high-order 484 bits of the address of the exception processing routines. the 16-bit vector offsets(IVORs) are concatenated to the right of IVPR to form the address of the exception processing routine."
the explanation for IVOR from e5500 reference manual;
" ....... but use only IVORn[48-59], as shown in figure 2-5, to hold the quad-word index from the base address provided by the IVPR for each interrupt type".
then, let's assume i set IVOR20 register to 0x190 and IVPR register to 0.
IVPR + IVOR20 = 0.....0 + 000110010000 + 0000 = 0x1900 is interrupt service routine address or interrupt handler address.
and then i should place my interrupt service routine to 0x1900 memory address when i initialize some basic stuff.
by the way, there is a IVOR20 register, isnt it ? i have doubt it's a register which we can access or not .
and my question is rising, i'm wrong or not ? if i'm wrong, engliht me, and please , if dont use sophisticated word to explain, i will appericate you.
thanks in advance.
You could refer to the sample project provided in CodeWarrior 10.5.1 for T1040RDB.
Please download and install CodeWarrior 10.5.1 from CodeWarrior Dev Tools for Networked Apps v11.4.0 | NXP .
Please create a bareboard project following new project wazards from File->New->CodeWarrior Bareboard Project.
Please refer to interrupt.c, pa_exception.asm and "Interrupt vectors initialization" section in T1040RDB_init.c in Sources folder in the sample project.
Thanks,
Yiping
thanks for your reply but i have still some problems.
i wrote a interrupt handler but returning handler function to main function is never happened. the following application runs on u-boot as standalone application.
void myInterruptHandler(void)
{
inline assembly code ; isr_prologue from pa_exception.asm
printf("this is an interrupt\n");
inline assembly code; isr_epilogue from pa_exception.asm here
}
int main(int argc, char *argv[])
{
while(1)
{
Printf("Here\n");
}
}
"here" message is always displayed but after first interrupt happens "This is an interrupt" message is displayed and after that "here" message is not displayed.
Application is frozen forever and not returning to u-boot function which it calls the application.
i guess returning from myInterruptHandler function to main function is not happened. how can i solve this problem ?
thanks in advance.
void InterruptHandler(long cause);
extern void __init_hardware(void);
#ifdef __cplusplus
}
#endif
void InterruptHandler(long cause)
{
unsigned long proc_id;
/* recover computation mode */
__init_hardware();
/* read processor id */
asm ("mfpir %0" : "=r" (proc_id));
printf("Core%lu: InterruptHandler: %#lx exception.\r\n", proc_id>>5, cause);
}
#include <stdio.h>
int main()
{
int i=0;
unsigned long proc_id;
asm ("mfpir %0" : "=r" (proc_id));
printf("Core%lu: Welcome to CodeWarrior!\r\n", proc_id>>5);
asm("sc"); // generate a system call exception to demonstrate the ISR
while (1) { i++; } // loop forever
}
thanks for your effort but the problem is same when interrupt happpens interrupt handler runs once and doesnt return to main function and application is pending i dont know how it's pending because it doesnt crash u-boot code but it's hanging forever.