示例#1
0
void APP_Run(void) {
  LED1_Neg();
  LED2_Neg();
  LED3_Neg();
  LED4_Neg();
  DiskTest();
}
示例#2
0
/**
 *  \brief hsmci_multimedia_card Application entry point.
 *
 *  \return Unused (ANSI-C compatibility).
 */
int main(void)
{
    uint8_t connected = 0;

    /* Disable watchdog */
    WDT_Disable( WDT ) ;
    
    SCB_EnableICache();        
    SCB_EnableDCache();
    TimeTick_Configure();

    /* Output example information*/
    printf("-- MultiMedia Card Example %s --\n\r", SOFTPACK_VERSION);
    printf("-- %s\n\r", BOARD_NAME);
    printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);
    bMciID = 0;
    /* Initialize PIO pins */
    _ConfigurePIOs();

    /* Initialize drivers */
    _ConfigureDrivers();


    /* Card insert detection loop */
    for(;;) {

        if (CardIsConnected(bMciID)) {
            if (connected == 0) {
                connected = 1;
                /* Delay before card initialize */
                Wait(300);
                /* Do card test */
                CardInit(bMciID);
                DumpMenu();
            }
        }
        else if (connected) {
            connected = 0;
            printf("** Card Disconnected\n\r");
        }


        if (DBG_IsRxReady()) 
        {
            uint8_t key = DBG_GetChar();
            switch(key) 
            {
                /* Change performance test block size */
                case 'c':
                case 'C': 
                    {   
                        if (performanceMultiBlock >= NB_MULTI_BLOCKS)
                            performanceMultiBlock = 1;
                        else
                            performanceMultiBlock <<= 1;
                        printf("-!- Performance Multi set to %d\n\r", (int)performanceMultiBlock);
                    }
                    break;
                /* Show help information */
                default:
                    if (!connected) 
                    {
                        DumpMenu();
                    }
                    else 
                    {
                        switch(key){
                            /* Dump block contents */
                            case 'd':
                            case 'D':
                                BlockDump(bMciID);  
                                break;
                            /* Initialize the card again */
                            case 'I':  
                            case 'i':    
                                CardInit(bMciID);   
                                break;
                            /* Run test on whole disk */
                            case 't':
                            case 'T':
                                if (SD_GetCardType(&sdDrv[bMciID]) & CARD_TYPE_bmSDIO)
                                    SdioTest(bMciID);
                                if (SD_GetCardType(&sdDrv[bMciID]) & CARD_TYPE_bmSDMMC)
                                    DiskTest(bMciID, 1, 1, 1);
                                printf("\n\r");  
                                break;
                            /* Run performance test */
                            case 'P':
                            case 'p':
                                if (SD_GetCardType(&sdDrv[bMciID]) & CARD_TYPE_bmSDIO)
                                    SdioPerformanceTest(bMciID);
                                if (SD_GetCardType(&sdDrv[bMciID]) & CARD_TYPE_bmSDMMC)
                                    DiskPerformanceTest(bMciID, 1, 1, 0);
                                printf("\n\r");
                                break;
                            /* Read/Verify ONLY test */
                            case 'r': 
                            case 'R':
                                DiskTest(bMciID, 0, 0, 1);
                                printf("\n\r");
                                break;
                            /* Read/Verify ONLY performance test */
                            case 'V':
                            case 'v':
                                DiskPerformanceTest(bMciID, 0, 1, 1);
                                printf("\n\r");
                                break;
                            /* Show help information */
                            default:   
                                DumpMenu();
                        }
                    }
                    break;
            }
        }
    }
}