Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

IRQ handlers

IRQ handlers

2006-05-04 by jk jlkj

Hi Friends,
   
  I wanted to know how to write code, which will cause a jump to a interrupt handler routine when any interrupt is generated.
   
  The code given in the IAR manual is 
   
  I donot understand how a function can be passed to a parameter 
  "unsigned int    function" in the function declaration given below.
   
   
  unsigned int
  install_handler(unsigned int *vector, unsigned int function)
  {
  unsigned int vec, old_vec;
   
  I cannot understand the below statement.
   
  vec = ((function - (unsigned int)vector - 8) >> 2);
   
   
  old_vec = *vector;
  vec |= 0xea000000; /* add opcode for B instruction */
  *vector = vec;
   
  I cannot understand the below 2 statement's.
   
  old_vec &= ~0xea000000;
  old_vec = ( old_vec << 2 ) + (unsigned int)vector + 8;
   
  return(old_vec);
  }
   
  Is the above code efficient or is there a better or simpler way of doing this. 
   
  Regards,
  Jerome

				
---------------------------------
 Yahoo! India Answers: Share what you know. Learn something new. Click here

[Non-text portions of this message have been removed]

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.