From 63d587cf2ef26b5737f9293d03c86ffd183d5a04 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 30 Jul 2011 23:19:06 +0200 Subject: ccid main: fix PIO configuration and PIO interrupt --- usb-device-ccid-project/main.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/usb-device-ccid-project/main.c b/usb-device-ccid-project/main.c index ab1874a..3f25f58 100644 --- a/usb-device-ccid-project/main.c +++ b/usb-device-ccid-project/main.c @@ -142,9 +142,9 @@ static const Pin pinsISO7816[] = {PINS_ISO7816}; static const Pin pinIso7816RstMC = PIN_ISO7816_RSTMC; static const Pin pinsPower[] = { - /* low = off */ + /* Swlf Power (LDO): low = off */ {1 << 5, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}, - /* high = off */ + /* Phone pass-through power: high = off */ {1 << 26, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}, }; @@ -162,23 +162,14 @@ static const Pin pinSmartCard = PIN_SMARTCARD_CONNECT; //------------------------------------------------------------------------------ static void ISR_PioSmartCard(const Pin *pPin) { - printf("-H- ISR_PioSmartCard\n\r"); - // Check all pending interrupts - if ((pinSmartCard.pio->PIO_ISR & pinSmartCard.mask) != 0) { - printf("-H- SmartCard.mask\n\r"); - - // Check current level on pin - if (PIO_Get(&pinSmartCard) == 0) { - + // Check current level on pin + if (PIO_Get(&pinSmartCard) == 0) { printf("-H- Insert\n\r"); - CCID_Insertion(); - } - else { - + CCID_Insertion(); + } else { printf("-H- Removal\n\r"); - CCID_Removal(); - } - } + CCID_Removal(); + } } //------------------------------------------------------------------------------ @@ -539,8 +530,8 @@ int main( void ) ConfigureCardDetection(); // Configure ISO7816 driver - PIO_Configure(pinsISO7816, PIO_LISTSIZE(&pinsISO7816)); - PIO_Configure(pinsPower, PIO_LISTSIZE(&pinsPower)); + PIO_Configure(pinsISO7816, PIO_LISTSIZE(pinsISO7816)); + PIO_Configure(pinsPower, PIO_LISTSIZE(pinsPower)); /* power up the card */ PIO_Set(&pinsPower[0]); -- cgit v1.2.3