示例#1
0
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;
        }
    }
}
示例#2
0
//*****************************************************************************
//
// main loop - sets up UART1, UART 0, and the command loop to process commands
//
//*****************************************************************************
int
main(void)
{
	int nStatus;
	int x;
	
    //
    // Enable lazy stacking for interrupt handlers.  This allows floating-point
    // instructions to be used within interrupt handlers, but at the expense of
    // extra stack usage.
    //
    ROM_FPUEnable();
    ROM_FPULazyStackingEnable();

    //
    // Set the clocking to run directly from the crystal.
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);

	//Setup UART1 on PB0 / PB1
		SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
		GPIOPinConfigure(GPIO_PB0_U1RX);
		GPIOPinConfigure(GPIO_PB1_U1TX);
		GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
		UARTStdioConfig(1, 9600, SysCtlClockGet());
	
		ConfigureUART(); //UART0
		
		//
    // Enable the UART1 interrupt.
    //
    ROM_IntEnable(INT_UART1);
    ROM_UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT);


	//Initialize LED's
		SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOF;
		x = SYSCTL_RCGC2_R; //dummy cycle
    GPIO_PORTF_DIR_R |= 0x08;
    GPIO_PORTF_DEN_R |= 0x08;
		GPIO_PORTF_DIR_R |= 0x04;
    GPIO_PORTF_DEN_R |= 0x04;
		GPIO_PORTF_DIR_R |= 0x02;
    GPIO_PORTF_DEN_R |= 0x02;
		
		//
    // Enable processor interrupts.
    //
    ROM_IntMasterEnable();
		
		//
    // Enter an infinite loop for reading and processing commands from the
    // user.
    //
		Cmd_help(0,0);
    while(1)
    {
        //
        // Print a prompt to the console.  Show the CWD.
        //
        UARTprintf("\n> ");

        //
        // Get a line of text from the user.
        //
        UARTgets(g_pcCmdBuf, sizeof(g_pcCmdBuf));

        //
        // Pass the line from the user to the command processor.  It will be
        // parsed and valid commands executed.
        //
        nStatus = CmdLineProcess(g_pcCmdBuf);

        //
        // Handle the case of bad command.
        //
        if(nStatus == CMDLINE_BAD_CMD)
        {
            UARTprintf("Bad command!\n");
        }

        //
        // Handle the case of too many arguments.
        //
        else if(nStatus == CMDLINE_TOO_MANY_ARGS)
        {
            UARTprintf("Too many arguments for command processor!\n");
        }

        //
        // Otherwise the command was executed.  Print the error code if one was
        // returned.
        //
        else if(nStatus != 0)
        {
            UARTprintf("Command returned error code\n");
        }
    }
			
    
}
示例#3
0
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;
        }
    }
}
示例#4
0
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;
        }
    }
}
示例#5
0
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;
        }
    }
}
//*****************************************************************************
//
// Main application entry function.
//
//*****************************************************************************
int main(void)
{
    int nStatus;

    //
    // Set the system clock to run at 50MHz from the PLL
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);

    //
    // Set the default pinout (and query any daughter board that may be
    // there already.  This has the side-effect of initializing the I2C
    // controller for us too.
    //
    PinoutSet();

    //
    // Enable UART0.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //
    // Initialize the UART standard I/O.
    //
    UARTStdioInit(0);
    UARTprintf("\n\nDaughter Board ID EEPROM Read/Write\n");
    UARTprintf(    "-----------------------------------\n\n");
    UARTprintf("Use this tool to read or repair the information stored\n");
    UARTprintf("in the 128 byte ID EEPROM on optional development kit\n");
    UARTprintf("daughter boards.\n");

    //
    // Output our help screen.
    //
    Cmd_help(0, 0);

    //
    // Tell the user which daughter board we have detected.
    //
    UARTprintf("\nCurrent daughter board: ");

    switch(g_eDaughterType)
    {
        case DAUGHTER_NONE:
        {
            UARTprintf("None or SDRAM\n");
            break;
        }

        case DAUGHTER_SRAM_FLASH:
        case DAUGHTER_FPGA:
        case DAUGHTER_EM2:
        {
            UARTprintf(g_pcIDNames[g_eDaughterType - 1]);
            break;
        }

        default:
        {
            UARTprintf("Unrecognized\n");
            break;
        }
    }

    //
    //
    // Fall into the command line processing loop.
    //
    while (1)
    {
        //
        // Print a prompt to the console
        //
        UARTprintf("\n> ");

        //
        // Get a line of text from the user.
        //
        UARTgets(g_cCmdBuf, sizeof(g_cCmdBuf));

        //
        // Pass the line from the user to the command processor.
        // It will be parsed and valid commands executed.
        //
        nStatus = CmdLineProcess(g_cCmdBuf);

        //
        // Handle the case of bad command.
        //
        if(nStatus == CMDLINE_BAD_CMD)
        {
            UARTprintf("Bad command!\n");
        }

        //
        // Handle the case of too many arguments.
        //
        else if(nStatus == CMDLINE_TOO_MANY_ARGS)
        {
            UARTprintf("Too many arguments for command processor!\n");
        }
    }
}