This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

crash in call_pending_DSRs_inner when DSR is called (SA1100)


Hi folks,

I'm working on a I2C-chipcard driver for a custom StrongARM 1100
platform. Every time the card is changed, an interrupt is fired. But
instead calling my DSR the cpu jumps into nirvana (but without achieving
salvation ;). I found the point where all ends up in
Cyg_Interrupt::call_pending_DSRs_inner(void) in the line

intr->dsr( intr->vector, 1, (CYG_ADDRWORD)intr->data );

to be very precise in the following line of assembly code

ldr	pc, [r12, #12]

When looking at the memory area r12 is pointing to, I found this area
full of crap but not the address of my DSR. So "intr" seems to be
initialized wrong. But why? clock and serial-handling is works nice.
I can't find differences to interrupt-creation in other driver and
testing code.

static cyg_ISR_t chipcard_isrCardChange;
static cyg_DSR_t chipcard_dsrCardChange;

[...]

//
// interrupt service routine for card changes
//
// @param pIntrVector  interrupt vector 
// @param pDataAddress  pointer to some interrupt handler specific data
//
// @returns cyg_uint32  show if DSR should be called
//
static cyg_uint32 chipcard_isrCardChange ( cyg_vector_t pIntrVector,
                                           cyg_addrword_t pDataAddress) 
{
  cyg_interrupt_mask ( pIntrVector);
  cyg_interrupt_acknowledge ( pIntrVector);

  // some LED blinking  
  if ( chipcard_isInserted ()) {
    OUTPUT_CLEAR_DATA_REG |= (1 << 6);
  } else {
    OUTPUT_SET_DATA_REG |= (1 << 6);
  }
  
  return ( CYG_ISR_HANDLED | CYG_ISR_CALL_DSR); 
}



//
// deferred interrupt service routine for card change
//
// @param pIntrVector   interrupt vector 
// @param pCounter      number of interrupts processed (?)
// @param pDataAddress  pointer to some interrupt handler specific data
//
static void chipcard_dsrCardChange ( cyg_vector_t pIntrVector,
                                     cyg_ucount32 pCounter, 
                                     cyg_addrword_t pDataAddress)
{
  if ( chipcard_isInserted ()) {
    // +++ FIXME +++ return status checking
    chipcard_init ();
    chipcard_readBlock ( gCardContentBuffer, CHIPCARD_BYTE_SIZE);
    gCardDataValid = true;
  } else {
    gCardDataValid = false;
    for ( int i = 0; i < CHIPCARD_UINT_SIZE; i++) 
    {
      ((cyg_uint32*) gCardContentBuffer)[i] = 0;
    }
  }
  
  cyg_interrupt_unmask ( pIntrVector);
}          



//
//
//                          
int chipcard_initializeInterrupt () {
 cyg_handle_t   lIntrHandle;
  cyg_interrupt  lIntr;
  cyg_vector_t   lIntrVector;
  cyg_priority_t lIntrPriority;
 
  lIntrPriority = 99;
  lIntrVector = CYGNUM_HAL_INTERRUPT_GPIO2;
 
  cyg_interrupt_create ( lIntrVector,
                         lIntrPriority,
                         (cyg_addrword_t) gCardContentBuffer,
                         chipcard_isrCardChange,
                         chipcard_dsrCardChange,
                         &lIntrHandle,
                         &lIntr);
  cyg_interrupt_attach ( lIntrHandle);
  cyg_interrupt_unmask ( lIntrVector);
}


Thanks in advance.
-----------------------------------------------------
i.A. Andreas Bürgel     GenoLogic GmbH
     Software Engineer  Joseph-von-Fraunhofer-Str. 13
                        D-44227 DORTMUND
                        Germany               
                        
     ab@genologic.de    phone  +49 (0) 231/477349-0
                        fax    +49 (0) 231/4761234


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]