Пример #1
0
//------------------------------------------------------------------------------
/// Initializes the CCID driver and runs it.
/// \return Unused (ANSI-C compatibility)
//------------------------------------------------------------------------------
int main( void )
{
    // Initialize traces
    TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK);
    printf("-- USB Device CCID Project %s --\n\r", SOFTPACK_VERSION);
    printf("-- %s\n\r", BOARD_NAME);
    printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);

    // If they are present, configure Vbus & Wake-up pins
    PIO_InitializeInterrupts(0);

    // Configure IT on Smart Card
    ConfigureCardDetection();

    // Configure ISO7816 driver
    PIO_Configure(pinsISO7816, PIO_LISTSIZE(pinsISO7816));
    PIO_Configure(pinsPower, PIO_LISTSIZE(pinsPower));

    /* power up the card */
    PIO_Set(&pinsPower[0]);

    ISO7816_Init( pinIso7816RstMC );

    // USB audio driver initialization
    CCIDDriver_Initialize();

    // connect if needed
    VBUS_CONFIGURE();
    while (USBD_GetState() < USBD_STATE_CONFIGURED);

    CCID_Insertion();

    // Infinite loop
    while (1) {

        if( USBState == STATE_SUSPEND ) {
            TRACE_DEBUG("suspend  !\n\r");
            LowPowerMode();
            USBState = STATE_IDLE;
        }
        if( USBState == STATE_RESUME ) {
            // Return in normal MODE
            TRACE_DEBUG("resume !\n\r");
            NormalPowerMode();
            USBState = STATE_IDLE;
        }
        CCID_SmartCardRequest();
    }
    return 0;
}
Пример #2
0
Файл: main.c Проект: gstroe/Arm
/**
 * Initializes the DBGU and ISO7816 driver, and starts some tests.
 * \return Unused (ANSI-C compatibility)
 */
extern int main( void )
{
	uint8_t pAtr[MAX_ATR_SIZE];
	uint8_t ucSize;

	/* Disable watchdog*/
	WDT_Disable(WDT);

	SCB_EnableICache();
	SCB_EnableDCache();

	/*  Initialize Atr buffer */
	memset(pAtr, 0, sizeof(pAtr));

	printf("-- USART ISO7816 Example %s --\n\r", SOFTPACK_VERSION);
	printf("-- %s\n\r", BOARD_NAME);
	printf("-- Compiled: %s %s With %s--\n\r", __DATE__, __TIME__, COMPILER_NAME);

	/*  Configure IT on Smart Card */
	ConfigureCardDetection();

	/*  Configure ISO7816 driver */
	PIO_Configure(pinsISO7816, PIO_LISTSIZE(pinsISO7816));

	ISO7816_Init(USART, ID_USART, pinIso7816RstMC);

	/*  Read ATR */
	ISO7816_warm_reset();

	ISO7816_Datablock_ATR(pAtr, &ucSize);

	/*  Decode ATR */
	ISO7816_Decode_ATR(pAtr);

	/*  Allow user to send some commands */
	SendReceiveCommands();

	return 0;
}