Remove check for PIO_ISR interrue

At first I thought I had to check the interrupt source when my interrupt
handler was called. But then, the smart card insertion pin was never
marked as the interrupt source in the PIO_ISR.

It turns out, the ISR register is cleared on read, which is done by the
atmel lib function PioInterruptHandler.
This commit is contained in:
Christina Quast
2015-11-05 10:57:50 +01:00
parent 89690c98dd
commit 442dc27bc9

View File

@@ -2,6 +2,7 @@
* ATMEL Microcontroller Software Support * ATMEL Microcontroller Software Support
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* Copyright (c) 2009, Atmel Corporation * Copyright (c) 2009, Atmel Corporation
* Copyright (c) 2014, Christina Quast
* *
* All rights reserved. * All rights reserved.
* *
@@ -74,33 +75,21 @@ static const Pin pinSmartCard = SMARTCARD_CONNECT_PIN;
*/ */
static void ISR_PioSmartCard( const Pin *pPin ) static void ISR_PioSmartCard( const Pin *pPin )
{ {
/* FIXME: why is pinSmartCard.pio->PIO_ISR the wrong number? /* Check current level on pin */
printf("+++++ Trying to check for pending interrupts (PIO ISR: 0x%X)\n\r", pinSmartCard.pio->PIO_ISR); /* The interrupt is already erased on read from the PIO_ISR (PIO Interrupt
printf("+++++ Mask: 0x%X\n\r", pinSmartCard.mask); * Status Register) by the calling higher level interrupt handler
Output: */
+++++ Trying to check for pending interrupts (PIO ISR: 0x400)) = 1<<10 if ( PIO_Get( &pinSmartCard ) == 0 )
+++++ Mask: 0x100 = 1<<8
*/
// PA10 is DTXD, which is the debug uart transmit pin
printf("Interrupt!!\n\r");
/* Check all pending interrupts */
// FIXME: this if condition is not always true...
// if ( (pinSmartCard.pio->PIO_ISR & pinSmartCard.mask) != 0 )
{ {
/* Check current level on pin */ sim_inserted = 1;
if ( PIO_Get( &pinSmartCard ) == 0 ) printf( "-I- Smartcard inserted\n\r" ) ;
{ CCID_Insertion();
sim_inserted = 1; }
printf( "-I- Smartcard inserted\n\r" ) ; else
CCID_Insertion(); {
} sim_inserted = 0;
else printf( "-I- Smartcard removed\n\r" ) ;
{ CCID_Removal();
sim_inserted = 0;
printf( "-I- Smartcard removed\n\r" ) ;
CCID_Removal();
}
} }
} }