int main(void) { /* Initialize console for communication with the Host Machine */ ConsoleUtilsInit(); /* Select the console type based on compile time check */ ConsoleUtilsSetType(CONSOLE_UART); /* Configure EDMA module clock */ EDMAModuleClkConfig(); /* Initialize EDMA */ EDMA3Init(EDMAAPP_EDMACC_BASE_ADDRESS, EDMAAPP_DMA_EVTQ); _EDMAAppRegisterEdma3Interrupts(); #ifdef CH_TYPE_DMA EDMAAppEDMA3Test(); #else EDMAAppQDMA3Test(); #endif EDMA3Deinit(EDMAAPP_EDMACC_BASE_ADDRESS, EDMAAPP_DMA_EVTQ); return 0; }
int main(void) { /* Setup the MMU and do necessary MMU configurations. */ MMUConfigAndEnable(); /* Enable all levels of CACHE. */ CacheEnable(CACHE_ALL); /* Initialize the UART console */ ConsoleUtilsInit(); /* Select the console type based on compile time check */ ConsoleUtilsSetType(CONSOLE_UART); ConsoleUtilsPrintf("McASP Example Application. "); ConsoleUtilsPrintf("Please connect headphone/speaker to the LINE OUT"); ConsoleUtilsPrintf(" of the EVM to listen to the audio tone."); /* Enable the module clock for I2C0 Instance. */ I2C0ModuleClkConfig(); /* Set up the pin mux for I2C0 instance. */ I2CPinMuxSetup(0); /* Enable the module clock for McASP1 Instance. */ McASP1ModuleClkConfig(); /* Enable pin-mux for McASP1 instance. */ McASP1PinMuxSetup(); /* Enable the EDMA module clocks. */ EDMAModuleClkConfig(); /* Initialize the ARM Interrupt Controller.*/ IntAINTCInit(); /* Enable EDMA Interrupt. */ EDMA3IntSetup(); /* Enable McASP Interrupt. */ McASPIntSetup(); /* Initialize the I2C interface for the codec AIC31 */ I2CCodecIfInit(I2C_INST_BASE, I2C_SLAVE_CODEC_AIC31); /* Enable the interrupts generation at global level */ IntMasterIRQEnable(); /* Configure the Codec for I2S mode */ AudioCodecInit(); /* Initialize the looping of tone. */ ToneLoopInit(); /* Start playing tone. */ AudioTxActivate(); while(1); }
/* ** This function configures the power supply for EDMA3 Channel Controller 0 ** and Transfer Controller 0, registers the EDMA interrupts in AINTC. */ static void EDMA3Initialize(void) { /* Enable module clock for EDMA */ EDMAModuleClkConfig(); /* Initialization of EDMA3 */ EDMA3Init(SOC_EDMA30CC_0_REGS, EVT_QUEQUE_NUM); /* Configuring the AINTC to receive EDMA3 Interrupts */ EDMA3AINTCConfigure(); }
/* ** Enable all the peripherals in use */ static void PeripheralsSetUp(void) { DMTimer2ModuleClkConfig(); DMTimer3ModuleClkConfig(); DMTimer4ModuleClkConfig(); RTCModuleClkConfig(); CPSWPinMuxSetup(); CPSWClkEnable(); EDMAModuleClkConfig(); GPIO1ModuleClkConfig(); GPIO1Pin23PinMuxSetup(); HSMMCSDPinMuxSetup(); HSMMCSDModuleClkConfig(); }
/* ** Enable all the peripherals in use */ static void PeripheralsSetUp(void) { enableModuleClock(CLK_UART0); enableModuleClock(CLK_I2C0); /* Timer6 is used for Standby wakeup */ enableModuleClock(CLK_TIMER6); GPIO0ModuleClkConfig(); DMTimer2ModuleClkConfig(); DMTimer3ModuleClkConfig(); DMTimer4ModuleClkConfig(); RTCModuleClkConfig(); CPSWPinMuxSetup(); CPSWClkEnable(); EDMAModuleClkConfig(); GPIO1ModuleClkConfig(); GPIO1Pin23PinMuxSetup(); HSMMCSDPinMuxSetup(); HSMMCSDModuleClkConfig(); I2CPinMuxSetup(0); }
/* ** Enter the desired power save mode */ void PowerSaveModeEnter(deepSleepData dsData, unsigned int slpMode) { unsigned int i = 0; unsigned int index = 0; unsigned int noOfElements = sizeof(pmModuleList)/sizeof(pmModuleList[0]); PeripheralsContextSave(slpMode, wakeSource); PeripheralsHalt(); dsData.dsDataBits.wakeSources = wakeSource; /* Configure CMD_ID and other parameters which are to be ** communicated with CM3 */ configIPCRegs(dsData); syncCm3(); if(SLEEP_STAND_BY_MODE == slpMode) { /* Enable wake source interupt */ enableStandbyWakeSrc(dsData.dsDataBits.wakeSources); } else { /* Enable wake source */ enableWakeSource(dsData.dsDataBits.wakeSources); } /* Include MPU Clock in the disable list */ for(index = 0; index < noOfElements; index++) { if(CLK_MPU_CLK == pmModuleList[index].module) { pmModuleList[index].select = TRUE; } } /* Disable clock */ while(true != disableSelModuleClock(pmModuleList, (sizeof(pmModuleList)/sizeof(pmModuleList[0])))); /* Configure for minimum OPP supported by SoC */ ConfigMinimumOPP(); disableModuleClock(CLK_I2C0, TRUE); /* Disable IRQ */ IntMasterIRQDisable(); if(SLEEP_MODE_DS0 == slpMode) { PowerDownConfig(); } /* ** Save A8 context ** WFI ** Restore A8 context */ saveRestoreContext(slpMode, deviceVersion); /* Enable Timer3 for DS2 */ enableModuleClock(CLK_TIMER3); /* Enable IRQ */ IntMasterIRQEnable(); enableModuleClock(CLK_I2C0); /* Restore OPP configuration */ DemoOppChange(mpuOpp); /* Exclude MPU Clock from the disable list */ for(index = 0; index < noOfElements; index++) { if(CLK_MPU_CLK == pmModuleList[index].module) { pmModuleList[index].select = FALSE; } } /* Device clock enable */ enableSelModuleClock(pmModuleList, (sizeof(pmModuleList)/sizeof(pmModuleList[0]))); EDMAModuleClkConfig(); /* disable wake source */ if(SLEEP_STAND_BY_MODE == slpMode) { disableStandbyWakeSrc(dsData.dsDataBits.wakeSources); } else { disableWakeSource(dsData.dsDataBits.wakeSources); } PeripheralsContextRestore(slpMode, dsData.dsDataBits.wakeSources); PeripheralsResume(); /* ** Print string name of the sleep mode. */ ConsoleUtilsPrintf("\n\r%s", sleepModeStrMap[slpMode].str); /* Check the DS status */ if(PM_CMD_FAIL == (readCmdStatus() & (PM_CMD_FAIL))) { ConsoleUtilsPrintf(" attempt failed"); } else { ConsoleUtilsPrintf(" attempt passed"); } /* Reset CM3 State Machine */ configIPCRegs(dsDataM3reset); syncCm3(); if(slpMode & SLEEP_MODE_DS1) { /* delay to reduce the frequency of sleep/wake cycle for DS1 */ delay(500); } for(i = 0; i < 2; i++) { x_data[i] = 0; y_data[i] = 0; } /* Reset sleep trigger flag */ IsTSPress = 0; }
/* ** Main function. */ int main(void) { unsigned int numByteChunks = 0; unsigned char *pBuffer = NULL; unsigned int remainBytes = 0; /* Configure and enable the MMU. */ MMUConfigAndEnable(); /* Enable all levels of Cache. */ CacheEnable(CACHE_ALL); /* Configuring the system clocks for EDMA. */ EDMAModuleClkConfig(); /* Configuring the system clocks for UART0 instance. */ UART0ModuleClkConfig(); /* Performing Pin Multiplexing for UART0 instance. */ UARTPinMuxSetup(0); /* Enabling IRQ in CPSR of ARM processor. */ IntMasterIRQEnable(); /* Initializing the ARM Interrupt Controller. */ IntAINTCInit(); /* Initializing the EDMA. */ EDMA3Initialize(); /* Initializing the UART0 instance for use. */ UARTInitialize(); /* Select the console type based on compile time check */ ConsoleUtilsSetType(CONSOLE_UART); /* ** Configuring the EDMA. */ /* Request DMA Channel and TCC for UART Transmit*/ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_TX_CHA_NUM, EDMA3_UART_TX_CHA_NUM, EVT_QUEUE_NUM); /* Registering Callback Function for TX*/ cb_Fxn[EDMA3_UART_TX_CHA_NUM] = &callback; /* Request DMA Channel and TCC for UART Receive */ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_RX_CHA_NUM, EDMA3_UART_RX_CHA_NUM, EVT_QUEUE_NUM); /* Registering Callback Function for RX*/ cb_Fxn[EDMA3_UART_RX_CHA_NUM] = &callback; /******************** Transmission of a string **************************/ numByteChunks = (sizeof(welcome) - 1) / txBytesPerEvent; remainBytes = (sizeof(welcome) - 1) % txBytesPerEvent; /* Configuring EDMA PaRAM sets to transmit data. */ UARTTxEDMAPaRAMSetConfig(welcome, numByteChunks * txBytesPerEvent, EDMA3_UART_TX_CHA_NUM, EDMA3CC_OPT(DUMMY_CH_NUM), EDMA3_UART_TX_CHA_NUM); /* Configuring the PaRAM set for Dummy Transfer. */ TxDummyPaRAMConfEnable(); /* Enable EDMA Transfer */ EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /* Remaining bytes are transferred through polling method. */ if(0 != remainBytes) { pBuffer = welcome + (sizeof(welcome) - 1) - remainBytes; UARTPuts((char*)pBuffer, remainBytes); } /******************** Transmission of a string **************************/ numByteChunks = (sizeof(intent) - 1) / txBytesPerEvent; remainBytes = (sizeof(intent) - 1) % txBytesPerEvent; /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring EDMA PaRAM sets to transmit data. */ UARTTxEDMAPaRAMSetConfig(intent, numByteChunks * txBytesPerEvent, EDMA3_UART_TX_CHA_NUM, EDMA3CC_OPT(DUMMY_CH_NUM), EDMA3_UART_TX_CHA_NUM); /* Configuring the PaRAM set for Dummy Transfer. */ TxDummyPaRAMConfEnable(); /* Enable EDMA Transfer */ EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /* Remaining bytes are transferred through polling method. */ if(0 != remainBytes) { pBuffer = intent + (sizeof(intent) - 1) - remainBytes; UARTPuts((char*)pBuffer, remainBytes); } /******************** Transmission of a string **************************/ numByteChunks = (sizeof(enter) - 1) / txBytesPerEvent; remainBytes = (sizeof(enter) - 1) % txBytesPerEvent; /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring EDMA PaRAM sets to transmit data. */ UARTTxEDMAPaRAMSetConfig(enter, numByteChunks * txBytesPerEvent, EDMA3_UART_TX_CHA_NUM, EDMA3CC_OPT(DUMMY_CH_NUM), EDMA3_UART_TX_CHA_NUM); /* Configuring the PaRAM set for Dummy Transfer. */ TxDummyPaRAMConfEnable(); /* Enable EDMA Transfer */ EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /* Remaining bytes are transferred through polling method. */ if(0 != remainBytes) { pBuffer = enter + (sizeof(enter) - 1) - remainBytes; UARTPuts((char*)pBuffer, remainBytes); } /********************* Receiving Data from User *************************/ /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring the PaRAM set for reception. */ UARTRxEDMAPaRAMSetConfig(rxBuffer, NUM_RX_BYTES, EDMA3_UART_RX_CHA_NUM, 0xFFFF, EDMA3_UART_RX_CHA_NUM); /* Enable EDMA Transfer */ EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_UART_RX_CHA_NUM, EDMA3_TRIG_MODE_EVENT); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /******************* Echoing received bytes *****************************/ numByteChunks = (NUM_RX_BYTES) / txBytesPerEvent; remainBytes = (NUM_RX_BYTES) % txBytesPerEvent; /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring EDMA PaRAM sets to transmit data. */ UARTTxEDMAPaRAMSetConfig(rxBuffer, numByteChunks * txBytesPerEvent, EDMA3_UART_TX_CHA_NUM, EDMA3CC_OPT(DUMMY_CH_NUM), EDMA3_UART_TX_CHA_NUM); /* Configuring the PaRAM set for Dummy Transfer. */ TxDummyPaRAMConfEnable(); /* Enable EDMA Transfer */ EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /* Remaining bytes are transferred through polling method. */ if(0 != remainBytes) { pBuffer = rxBuffer + NUM_RX_BYTES - remainBytes; UARTPuts((char*)pBuffer, remainBytes); } /******************* Freeing of allocated channels **********************/ /* Free EDMA3 Channels for TX and RX */ EDMA3FreeChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT, EDMA3_UART_TX_CHA_NUM, EVT_QUEUE_NUM); EDMA3FreeChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_RX_CHA_NUM, EDMA3_TRIG_MODE_EVENT, EDMA3_UART_RX_CHA_NUM, EVT_QUEUE_NUM); /* Support for Automation Testing. */ PRINT_STATUS(S_PASS); while(1); }
int main(void) { /* Configuring the system clocks for EDMA. */ EDMAModuleClkConfig(); /* Configuring the system clocks for UART0 instance. */ UART0ModuleClkConfig(); /* Performing Pin Multiplexing for UART0 instance. */ UARTPinMuxSetup(0); /* Enabling IRQ in CPSR of ARM processor. */ IntMasterIRQEnable(); /* Initializing the ARM Interrupt Controller. */ IntAINTCInit(); /* Initializing the EDMA. */ EDMA3Initialize(); /* Initializing the UART0 instance for use. */ UARTInitialize(); /* ** Configuring the EDMA. */ /* Request DMA Channel and TCC for UART Transmit*/ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_TX_CHA_NUM, EDMA3_UART_TX_CHA_NUM, EVT_QUEUE_NUM); /* Registering Callback Function for TX*/ cb_Fxn[EDMA3_UART_TX_CHA_NUM] = &callback; /* Request DMA Channel and TCC for UART Receive */ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_RX_CHA_NUM, EDMA3_UART_RX_CHA_NUM, EVT_QUEUE_NUM); /* Registering Callback Function for RX*/ cb_Fxn[EDMA3_UART_RX_CHA_NUM] = &callback; /******************** Transmission of a string **************************/ /* Configuring EDMA PaRAM sets to transmit 'welcome' message. */ UartEDMATxConfTransfer(EDMA3_UART_TX_CHA_NUM, EDMA3_UART_TX_CHA_NUM, welcome, sizeof(welcome) - 1); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /******************** Transmission of a string **************************/ /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring EDMA PaRAM sets to transmit 'enter' message. */ UartEDMATxConfTransfer(EDMA3_UART_TX_CHA_NUM, EDMA3_UART_TX_CHA_NUM, enter, sizeof(enter) - 1); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /********************* Receiving Data from User *************************/ /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring the PaRAM set for reception. */ UartEDMARxConfTransfer(EDMA3_UART_RX_CHA_NUM, EDMA3_UART_RX_CHA_NUM, rxBuffer, sizeof(rxBuffer)); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /******************* Echoing received bytes *****************************/ /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring the PaRAM set to transmit the bytes that were received. */ UartEDMATxConfTransfer(EDMA3_UART_TX_CHA_NUM, EDMA3_UART_TX_CHA_NUM, rxBuffer, sizeof(rxBuffer)); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /******************* Freeing of allocated channels **********************/ /* Free EDMA3 Channels for TX and RX */ EDMA3FreeChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT, EDMA3_UART_TX_CHA_NUM, EVT_QUEUE_NUM); EDMA3FreeChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_RX_CHA_NUM, EDMA3_TRIG_MODE_EVENT, EDMA3_UART_RX_CHA_NUM, EVT_QUEUE_NUM); while(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; #ifdef ARM_SUPPORTED /* Setup the MMU and do necessary MMU configurations. */ MMUConfigAndEnable(); #endif #ifdef CACHE_SUPPORTED /* Enable all levels of CACHE. */ CacheEnable(CACHE_ALL); #endif /* Initialize UART. */ UARTStdioInit(); /* Configure the EDMA clocks. */ EDMAModuleClkConfig(); /* Configure EDMA to service the MMCSD events. */ MMCSDEdmaInit(); /* Perform pin-mux for MMCSD pins. */ MMCSDPinMuxSetup(); /* Enable module clock for MMCSD. */ MMCSDModuleClkConfig(); DelayTimerSetup(); #ifdef MMCSD_PERF PerfTimerSetup(); #endif /* Basic controller initializations */ MMCSDControllerSetup(); /* Initialize the MMCSD controller */ MMCSDCtrlInit(&ctrlInfo); MMCSDIntEnable(&ctrlInfo); #if 0 UARTPuts("Test timer:wait 5s\r\n", -1); delay(5000); UARTPuts("Test timer:Done\r\n", -1); #endif for(;;) { if((MMCSDCardPresent(&ctrlInfo)) == 1) { #if DEBUG_PRINT UARTPuts("Card is present\r\n", -1); #endif if(initFlg) { UARTPuts("Call MMCSDFsMount\r\n", -1); MMCSDFsMount(0, &sdCard); UARTPuts("Back MMCSDFsMount\r\n", -1); initFlg = 0; UARTPuts("Call Cmd_help\r\n", -1); Cmd_help(0, NULL); } MMCSDFsProcessCmdLine(); } else { UARTPuts("Card is not present\r\n", -1); delay(1000); // delay(1); i = (i + 1) & 0xFFF; if(i == 1) { UARTPuts("Please insert the card \r\n", -1); } if(initFlg != 1) { /* Reinitialize all the state variables */ dmaIsRunning = 0; xferCompFlag = 0; dataTimeout = 0; dataCRCError = 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); /* 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 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; } } }