DllExport s32 CALLBACK PADopen(void* pDisplay) // PAD OPEN { DebugFunc(); Input::Pause(false); GetDisplay(pDisplay); KeyboardOpen(); KeepAwake(KEEPAWAKE_INIT); return emupro::pad::ERR_SUCCESS; }
//***************************************************************************** // // The main application loop. // //***************************************************************************** int main(void) { int32_t i32Status, i32Idx; uint32_t ui32SysClock, ui32PLLRate; #ifdef USE_ULPI uint32_t ui32Setting; #endif ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); // // Set the part pin out appropriately for this device. // PinoutSet(); #ifdef USE_ULPI // // Switch the USB ULPI Pins over. // USBULPIPinoutSet(); // // Enable USB ULPI with high speed support. // ui32Setting = USBLIB_FEATURE_ULPI_HS; USBOTGFeatureSet(0, USBLIB_FEATURE_USBULPI, &ui32Setting); // // Setting the PLL frequency to zero tells the USB library to use the // external USB clock. // ui32PLLRate = 0; #else // // Save the PLL rate used by this application. // ui32PLLRate = 480000000; #endif // // Initialize the hub port status. // for(i32Idx = 0; i32Idx < NUM_HUB_STATUS; i32Idx++) { g_psHubStatus[i32Idx].bConnected = false; } // // Enable Clocking to the USB controller. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); // // Enable Interrupts // ROM_IntMasterEnable(); // // Initialize the USB stack mode and pass in a mode callback. // USBStackModeSet(0, eUSBModeHost, 0); // // Register the host class drivers. // USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ui32NumHostClassDrivers); // // Open the Keyboard interface. // KeyboardOpen(); MSCOpen(ui32SysClock); // // Open a hub instance and provide it with the memory required to hold // configuration descriptors for each attached device. // USBHHubOpen(HubCallback); // // Initialize the power configuration. This sets the power enable signal // to be active high and does not enable the power fault. // USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER); // // Tell the USB library the CPU clock and the PLL frequency. // USBOTGFeatureSet(0, USBLIB_FEATURE_CPUCLK, &ui32SysClock); USBOTGFeatureSet(0, USBLIB_FEATURE_USBPLL, &ui32PLLRate); // // Initialize the USB controller for Host mode. // USBHCDInit(0, g_pui8HCDPool, sizeof(g_pui8HCDPool)); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(ui32SysClock); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119); // // Draw the application frame. // FrameDraw(&g_sContext, "usb-host-hub"); // // Calculate the number of characters that will fit on a line. // Make sure to leave a small border for the text box. // g_ui32CharsPerLine = (GrContextDpyWidthGet(&g_sContext) - 16) / GrFontMaxWidthGet(g_psFontFixed6x8); // // Calculate the number of lines per usable text screen. This requires // taking off space for the top and bottom banners and adding a small bit // for a border. // g_ui32LinesPerScreen = (GrContextDpyHeightGet(&g_sContext) - (2*(DISPLAY_BANNER_HEIGHT + 1)))/ GrFontHeightGet(g_psFontFixed6x8); // // Initial update of the screen. // UpdateStatus(0); UpdateStatus(1); UpdateStatus(2); UpdateStatus(3); g_ui32CmdIdx = 0; g_ui32CurrentLine = 0; // // Initialize the file system. // FileInit(); // // The main loop for the application. // while(1) { // // Print a prompt to the console. Show the CWD. // WriteString("> "); // // Is there a command waiting to be processed? // while((g_ui32Flags & FLAG_CMD_READY) == 0) { // // Call the YSB library to let non-interrupt code run. // USBHCDMain(); // // Call the keyboard and mass storage main routines. // KeyboardMain(); MSCMain(); } // // Pass the line from the user to the command processor. // It will be parsed and valid commands executed. // i32Status = CmdLineProcess(g_pcCmdBuf); // // Handle the case of bad command. // if(i32Status == CMDLINE_BAD_CMD) { WriteString("Bad command!\n"); } // // Handle the case of too many arguments. // else if(i32Status == CMDLINE_TOO_MANY_ARGS) { WriteString("Too many arguments for command processor!\n"); } // // Otherwise the command was executed. Print the error // code if one was returned. // else if(i32Status != 0) { WriteString("Command returned error code\n"); WriteString((char *)StringFromFresult((FRESULT)i32Status)); WriteString("\n"); } // // Reset the command flag and the command index. // g_ui32Flags &= ~FLAG_CMD_READY; g_ui32CmdIdx = 0; } }