[ML] List of Interrupt Service Routines (ISRs) in the 5D2 2.0.4 DryOs

64 views
Skip to first unread message

Antony Newman

unread,
Jul 13, 2011, 6:20:09 PM7/13/11
to Magic Lantern firmware development
On the 5D2 - There is a list of 256 ISRs.

Structure:
0x400006F8 -> 256 x ISR addresses
0x40000AF8 -> 256 x ISR 4 Byte parameter

The following code lists them, and attached X.log which I have annotated for each ISR to show what the ISR calls.

AJ

==================================================

static unsigned int first=0;

if (first==0)
{
   first = 1;

      FILE * prop_logfile = INVALID_PTR;

      prop_logfile =  FIO_CreateFile(  "A:X.log" );

      if ( prop_logfile != INVALID_PTR )
      {
         fprintf( prop_logfile,
                 "\nDump of all ISRs%s\n",
                  "");


         unsigned int i=0;

         for (i=0; i<256; i++)
         {
            unsigned int sub_addr  = 0x400006F8 + i*4;
            unsigned int parm_addr = 0x40000AF8 + i*4;

            fprintf( prop_logfile,
                    "[%02X]  ISR=%08X PARM=0x%08X\n",
                      i,
                      (unsigned int) *( (unsigned int *) sub_addr),
                      (unsigned int) *( (unsigned int *) parm_addr)
                   );
         }

         FIO_CloseFile( prop_logfile );

         prop_logfile = INVALID_PTR;
      }

}

X.log

arm.indy

unread,
Jul 14, 2011, 3:09:50 AM7/14/11
to Magic Lantern firmware development
Hi Antony,
How did you find them? It is to find them on other models...
Indy
>  X.log
> 17KViewDownload

Antony Newman

unread,
Jul 14, 2011, 5:07:15 PM7/14/11
to ml-d...@googlegroups.com
AI,

Oops .. forgot to give you any information about them :D

+) If you search for create_init_task() in your stub file 
-> the first it calls a routine I've called AJ_Guess_Init_task_related_ISR_setup()

If you look inside that routine, you'll see the base address of the ISR list in your firmware.  (0x400006F8 in Screen_capture_1)

(old Wiki page:) http://magiclantern.wikia.com/wiki/2.0.4_Interrupt_Handlers

AJ
Screen capture 1 [1].png
Screen capture 2 [1].png

arm.indy

unread,
Jul 16, 2011, 2:55:49 PM7/16/11
to Magic Lantern firmware development
thank you Antony for the details.
it seems very similar in 550d, same base address.

Indy
>  Screen capture 1 [1].png
> 408KViewDownload
>
>  Screen capture 2 [1].png
> 401KViewDownload

Andrew Coutts

unread,
Jul 16, 2011, 4:55:09 PM7/16/11
to Magic Lantern firmware development
same for 500d, same address

Alex

unread,
Jul 29, 2011, 11:47:05 AM7/29/11
to ml-d...@googlegroups.com
550D 109.

> --
> http://magiclantern.wikia.com/
>
> To post to this group, send email to ml-d...@googlegroups.com
> To unsubscribe from this group, send email to ml-devel+u...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/ml-devel?hl=en

550D-109-ISR.txt

Antony Newman

unread,
Jul 30, 2011, 12:44:38 PM7/30/11
to ml-d...@googlegroups.com
If the position of the ISR is the same on different cameras ... the following maybe of interest:

The aj_hijack_ISR() :
+) makes a copy of the current Interrupt Service Routine table (sub + parm)
+) replaces it with calls to aj_ISR() with the parameter the ISR number

Calls to aj_ISR_info() displays counts (modulo 256), on the screen (ISR 0..15 down the left most collumn,   ISR  0,16,32  top row)

Main use (other than cross-eyed screen saver) is to determine which ISRs are calls when, and an 'easy' way to hijack them / experiment with the ISR firing..

AJ



/********************************************************************

*                                                                   *
*  aj_ISR() - Replaces all ISRs called by DryOs                     *
*             Increases that ISR counter -> Then calls the ISR      *
*                                                                   *
********************************************************************/

volatile unsigned int g_ISR[256];        // Copy of 256 ISR sub addresses
volatile unsigned int g_ISR_parm[256];   // Copy of 256 ISR sub parms
volatile unsigned int g_ISR_count[256];  // How many times ISR called?

volatile unsigned int g_isr_errors = 0;

void aj_ISR(unsigned int i)     // i = isr_number
{
   /*************************************
   *  Make sure that Parm is in range!  *
   *************************************/

   if (i <256)
   {
      void (*isr_sub)(unsigned int) = (void *) g_ISR[i];

      isr_sub( g_ISR_parm[i] );

      g_ISR_count[i]++ ;
   }
   else
   {
      g_isr_errors ++;
   }
}  /* end of aj_ISR() */


/********************************************************************
*                                                                   *
*  aj_hijack_ISR() -  Steal the ISR lookup table and replace it     *
*                     will a call to aj_ISR()                       *
*                                                                   *
********************************************************************/

void aj_hijack_ISR()
{
   /********************************
   *  Only run the Hi-hack once!   *
   ********************************/

   static unsigned int first=0;

   if (first != 0)
   {
      return;
   }

   first = 1;

   /**********************************************************
   *   First time - copy all ISR_addresses, and ISR_Parms    *
   **********************************************************/


   unsigned int i=0;

   for (i=0; i<256; i++)
   {
      unsigned int sub_addr  = 0x400006F8 + i*4;
      unsigned int parm_addr = 0x40000AF8 + i*4;

     g_ISR[i]       = * (unsigned int *) sub_addr;
     g_ISR_parm[i]  = * (unsigned int *) parm_addr;
     
     g_ISR_count[i] = 0; // initialise the number of times this ISR has been called.
     
   }

   /***************************************************************************
   *   OK .. this time around .. overwrite the DryOs array with the AJ_ISR()  *
   ***************************************************************************/


   for (i=0; i<256; i++)
   {
      unsigned int sub_addr  = 0x400006F8 + i*4;
      unsigned int parm_addr = 0x40000AF8 + i*4;

     * (unsigned int *) sub_addr = (unsigned int) aj_ISR;   // point at AJ_ISR
     * (unsigned int *) parm_addr = i;                      // parm is now the ISR_number
     
     g_ISR_count[i] = 0; // initialise the number of times this ISR has been called.
     
   }

}  /* end of aj_hijack_ISR() */






/********************************************************************
*                                                                   *
*  aj_ISR_info() - How are we doing?                                *
*                                                                   *
********************************************************************/

void aj_ISR_info(void)    
{
   /*****************************************************
   *  Any ISR_parms passed to aj_ISR() out of range()?  *
   *****************************************************/

   bmp_printf( FONT_MED,
               0,0,
               "Err=%d ", g_isr_errors) ;


   /*************************************
   *  Make sure that Parm is in range!  *
   *************************************/

   unsigned int i;

   for(i=0; i<256; i++)
   {
      unsigned int x = i % 16;
      unsigned int y = i / 16;

      unsigned int count = g_ISR_count[i] % 256 ;

      bmp_printf( FONT_MED,
                  x*40, y*24 + 30,
                 "%02X", count) ;
   }

}  /* end of aj_ISR() */


=====================

void aj_main(void)
{
   // your main loop

   aj_hijack_ISR();   // Hijacks all the ISR to point at aj_ISR()

   aj_ISR_info();      // screen update of number of times each ISR called

} /* end of aj_main() */

X.log
TEST.BMP

Thomas Berndt

unread,
Oct 9, 2011, 4:59:03 AM10/9/11
to ml-d...@googlegroups.com

Wonderin‘ if erverything is okay with Antony Newman.

I last saw him on this board 30.7.2011.

 

Antony, everything ok? We’re missing you

 

Greetings!

careyer

--

Reply all
Reply to author
Forward
0 new messages