int main(void) { volatile unsigned int i = 0; volatile unsigned int initFlg = 1; /* Setup the MMU and do necessary MMU configurations. */ // MMUConfigAndEnable(); /* Enable all levels of CACHE. */ CacheEnable(CACHE_ALL); /* Initialize console for communication with the Host Machine */ ConsoleUtilsInit(); /* ** Select the console type based on compile time check ** Note: This example is not fully complaint to semihosting. It is ** recommended to use Uart console interface only. */ ConsoleUtilsSetType(CONSOLE_UART); /* Enabling functional clocks for GPIO1 instance. */ // GPIO1ModuleClkConfig(); /* Enabling the GPIO module. */ // GPIOModuleEnable(GPIO_INSTANCE_ADDRESS); /* Resetting the GPIO module. */ // GPIOModuleReset(GPIO_INSTANCE_ADDRESS); /* Setting the GPIO pin as an output pin. */ // GPIODirModeSet(GPIO_INSTANCE_ADDRESS,GPIO_INSTANCE_PIN_NUMBER,GPIO_DIR_OUTPUT); // GPIOPinWrite(GPIO_INSTANCE_ADDRESS,GPIO_INSTANCE_PIN_NUMBER,GPIO_PIN_HIGH); // GPIOPinWrite(GPIO_INSTANCE_ADDRESS,GPIO_INSTANCE_PIN_NUMBER,GPIO_PIN_LOW); /* Configure the EDMA clocks. */ EDMAModuleClkConfig(); /* Configure EDMA to service the HSMMCSD events. */ HSMMCSDEdmaInit(); /* Perform pin-mux for HSMMCSD pins. */ HSMMCSDPinMuxSetup(); /* Enable module clock for HSMMCSD. */ HSMMCSDModuleClkConfig(); DelayTimerSetup(); #ifdef MMCSD_PERF PerfTimerSetup(); #endif /* Basic controller initializations */ HSMMCSDControllerSetup(); /* Initialize the MMCSD controller */ HSMMCSDControllerInit(&ctrlInfo); ctrlInfo.intrEnable(&ctrlInfo); while(1) { if(HSMMCSDIsCardInserted(ctrlInfo.memBase) == 1) { if(initFlg) { HSMMCSDFsMount(0, &sdCard); initFlg = 0; Cmd_help(0, NULL); } HSMMCSDFsProcessCmdLine(); } else { delay(1); i = (i + 1) & 0xFFF; if(i == 1) { ConsoleUtilsPrintf("Please insert the card \n\r"); } if(initFlg != 1) { /* Reinitialize all the state variables */ callbackOccured = 0; xferCompFlag = 0; dataTimeout = 0; cmdCompFlag = 0; cmdTimeout = 0; /* Initialize the MMCSD controller */ HSMMCSDControllerInit(&ctrlInfo); ctrlInfo.intrEnable(&ctrlInfo); } initFlg = 1; } } }
int main(void) { volatile unsigned int i = 0; volatile unsigned int initFlg = 1; /* Setup the MMU and do necessary MMU configurations. */ MMUConfigAndEnable(); /* Enable all levels of CACHE. */ CacheEnable(CACHE_ALL); /* Initialize UART. */ UARTStdioInit(); /* Configure the EDMA clocks. */ EDMAModuleClkConfig(); /* Configure EDMA to service the HSMMCSD events. */ HSMMCSDEdmaInit(); /* Perform pin-mux for HSMMCSD pins. */ HSMMCSDPinMuxSetup(); /* Enable module clock for HSMMCSD. */ HSMMCSDModuleClkConfig(); /* Basic controller initializations */ HSMMCSDControllerSetup(); DelayTimerSetup(); #ifdef MMCSD_PERF PerfTimerSetup(); #endif /* Basic controller initializations */ HSMMCSDControllerSetup(); /* Initialize the MMCSD controller */ MMCSDCtrlInit(&ctrlInfo); MMCSDIntEnable(&ctrlInfo); while(1) { if((HSMMCSDCardPresent(&ctrlInfo)) == 1) { if(initFlg) { HSMMCSDFsMount(0, &sdCard); initFlg = 0; Cmd_help(0, NULL); } HSMMCSDFsProcessCmdLine(); } else { delay(1); i = (i + 1) & 0xFFF; if(i == 1) { UARTPuts("Please insert the card \n\r", -1); } if(initFlg != 1) { /* Reinitialize all the state variables */ callbackOccured = 0; xferCompFlag = 0; dataTimeout = 0; cmdCompFlag = 0; cmdTimeout = 0; /* Initialize the MMCSD controller */ MMCSDCtrlInit(&ctrlInfo); MMCSDIntEnable(&ctrlInfo); } initFlg = 1; } } }
int main(void) { volatile unsigned int i = 0; volatile unsigned int initFlg = 1; /* Setup the MMU and do necessary MMU configurations. */ MMUConfigAndEnable(); /* Enable all levels of CACHE. */ CacheEnable(CACHE_ALL); /* Initialize console for communication with the Host Machine */ ConsoleUtilsInit(); /* ** Select the console type based on compile time check ** Note: This example is not fully complaint to semihosting. It is ** recommended to use Uart console interface only. */ ConsoleUtilsSetType(CONSOLE_UART); /* Configure the EDMA clocks. */ EDMAModuleClkConfig(); /* Configure EDMA to service the HSMMCSD events. */ HSMMCSDEdmaInit(); /* Perform pin-mux for HSMMCSD pins. */ HSMMCSDPinMuxSetup(); /* Enable module clock for HSMMCSD. */ HSMMCSDModuleClkConfig(); DelayTimerSetup(); #ifdef MMCSD_PERF PerfTimerSetup(); #endif /* Basic controller initializations */ HSMMCSDControllerSetup(); /* Initialize the MMCSD controller */ MMCSDCtrlInit(&ctrlInfo); MMCSDIntEnable(&ctrlInfo); while(1) { if((HSMMCSDCardPresent(&ctrlInfo)) == 1) { if(initFlg) { HSMMCSDFsMount(0, &sdCard); initFlg = 0; Cmd_help(0, NULL); } HSMMCSDFsProcessCmdLine(); } else { delay(1); i = (i + 1) & 0xFFF; if(i == 1) { ConsoleUtilsPrintf("Please insert the card \n\r"); } if(initFlg != 1) { /* Reinitialize all the state variables */ callbackOccured = 0; xferCompFlag = 0; dataTimeout = 0; cmdCompFlag = 0; cmdTimeout = 0; /* Initialize the MMCSD controller */ MMCSDCtrlInit(&ctrlInfo); MMCSDIntEnable(&ctrlInfo); } initFlg = 1; } } }