2006-05-18 05:09 AM
2006-05-16 11:57 PM
Hi,
I did multiple tests and I do not understand what I notice. First of all, my str710 have a frequency of 48 MHz. First test =========== I plug a frequency generatior on a GPIO0/bit10. I bind an handler itxti() on that interrupt, call by XTI_IRQHandler() The handler generate a pulse on each interrupt. Then, I watch the result on a oscilloscope and I notice a latency between the clock and the pulse of 15 micro secondes. __arm void XTI_IRQHandler(void) { register unsigned int b=0x01; /* bigger than u8 because of condition stop i<=128 */ register unsigned int i=0; register unsigned char h = XTI->PRH&=XTI->MRH; register unsigned char l = XTI->PRL&=XTI->MRL; while ( (h || l) && b<=128) { if (h & b ) { (XTI_handler[i+0x8])(EICXTI_data[i+0x8+32]); // test_itxti is called here XTI->PRH &= ~b; h &= ~b; } if (l & b ) { (XTI_handler[i])(EICXTI_data[i+32]); XTI->PRL &= ~b; l &= ~b; } b<<=1; i++; } } static void test_itxti(void*d) { XTI_PendingBitClear(XTI_Line13); //WRITEIO(RST_CODEC,0); //GPIO_BitWrite(GPIO0, 7,0); for (int i=0;i WRITEIO(RST_CODEC,1); } Second test: ============ I did almost the same thing except I write on the IO in the function XTI_IRQHandler() Then I notice a latency of 7 micro secondes. __arm void XTI_IRQHandler(void) { register unsigned int b=0x01; /* bigger than u8 because of condition stop i<=128 */ register unsigned int i=0; register unsigned char h = XTI->PRH&=XTI->MRH; register unsigned char l = XTI->PRL&=XTI->MRL; GPIO_BitWrite(GPIO0, 7,0); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< while ( (h || l) && b<=128) { if (h & b ) { (XTI_handler[i+0x8])(EICXTI_data[i+0x8+32]); // test_itxti is called here XTI->PRH &= ~b; h &= ~b; } if (l & b ) { (XTI_handler[i])(EICXTI_data[i+32]); XTI->PRL &= ~b; l &= ~b; } b<<=1; i++; } } Third test : ============ I generate the pulse directly in the IRQHandler(71x_vect.s79). I notice a latency of 2 micro secondes addr DCD 0xE000300C IRQHandler SUB LR,LR,#4 ; adj for proper CMX return STMFD SP!,{R0-R12,LR} ; save the registers MRS R9,SPSR ; save the SPSR STMFD SP!,{R9} ; TEST IT LDR R0, addr LDRH R3,[R0] mov r4,#0x80 bic R3,R3,R4 STRH R3,[R0] ; end ... Finaly, I did this test : IRQHandler SUB LR,LR,#4 ; adj for proper CMX return STMFD SP!,{R0-R12,LR} ; save the registers MRS R9,SPSR ; save the SPSR STMFD SP!,{R9} ; LUDO TEST IT LDR R0, addr1 LDRH R3,[R0] mov r4,#0x80 ORR R3,R3,R4 STRH R3,[R0] LDR R0, addr2 LDRH R3,[R0] BIC R3,R3,R4 STRH R3,[R0] LDR R0, addr3 LDRH R3,[R0] ORR R3,R3,R4 STRH R3,[R0] LDR R0, addr LDRH R3,[R0] mov r4,#0x80 DEB: bic R3,R3,R4 STRH R3,[R0] NOP NOP NOP NOP NOP NOP NOP NOP NOP ORR R3,R3,R4 STRH R3,[R0] NOP NOP NOP NOP NOP NOP NOP NOP NOP B DEB ; LUDO Then I see a sqare signal of .68 micro seconde period. 0.68.10^-6 / 24 instructions = 0.28.10^-7 freq = 1/0.28.10^-7 = 35 MHz Conclusion : I lose time when I execute simple instruction ? I do not understand why I need 15 micro secondes to call a handler ? 15uS = 525 instructions at 35 MHz. 7uS = 250 instuctions I think I need only 50 instructions to get in the XTI_IRQHandler() ? Do you understand my questions ? Did I make mistakes in my tests ? What do you suspect ? Thanks for your help.