//***************************************************************************** // // Capture one sequence of DEVCTL register values during a session request. // //***************************************************************************** int main(void) { tRectangle sRect; // // Set the clocking to run directly from the crystal. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Set the pinout appropriately for this board. // PinoutSet(); // // Initialize the display driver. // Kitronix320x240x16_SSD2119Init(); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sKitronix320x240x16_SSD2119); // // Fill the top 15 rows of the screen with blue to create the banner. // sRect.sXMin = 0; sRect.sYMin = 0; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = 14; GrContextForegroundSet(&g_sContext, ClrDarkBlue); GrRectFill(&g_sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&g_sContext, ClrWhite); GrRectDraw(&g_sContext, &sRect); // // Put the application name in the middle of the banner. // GrContextFontSet(&g_sContext, g_pFontFixed6x8); GrStringDrawCentered(&g_sContext, "OTG Example", -1, GrContextDpyWidthGet(&g_sContext) / 2, 7, 0); #ifdef DEBUG // // Configure the relevant pins such that UART0 owns them. // ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Open the UART for I/O // UARTStdioInit(0); #endif // // Determine the number of SysCtlDelay loops required to delay 1mS. // g_ulClockMS = ROM_SysCtlClockGet() / (3 * 1000); // // Configure the required pins for USB operation. // ROM_GPIOPinTypeUSBDigital(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7); ROM_GPIOPinTypeUSBDigital(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Initialize the USB stack mode and pass in a mode callback. // USBStackModeSet(0, USB_MODE_OTG, ModeCallback); // // Initialize the host stack. // HostInit(); // // Initialize the device stack. // DeviceInit(); // // Initialize the USB controller for dual mode operation with a 2ms polling // rate. // USBOTGModeInit(0, 2000, g_pHCDPool, HCD_MEMORY_SIZE); // // Set the new state so that the screen updates on the first // pass. // g_ulNewState = 1; // // Loop forever. // while(1) { // // Tell the OTG library code how much time has passed in milliseconds // since the last call. // USBOTGMain(GetTickms()); // // Handle deferred state change. // if(g_ulNewState) { g_ulNewState =0; // // Update the status area of the screen. // ClearMainWindow(); // // Update the status bar with the new mode. // switch(g_eCurrentUSBMode) { case USB_MODE_HOST: { UpdateStatus("Host Mode", 0, true); break; } case USB_MODE_DEVICE: { UpdateStatus("Device Mode", 0, true); break; } case USB_MODE_NONE: { UpdateStatus("Idle Mode", 0, true); break; } default: { break; } } } if(g_eCurrentUSBMode == USB_MODE_DEVICE) { DeviceMain(); } else if(g_eCurrentUSBMode == USB_MODE_HOST) { HostMain(); } } }
//***************************************************************************** // // main routine. // //***************************************************************************** int main(void) { tLPMFeature sLPMFeature; // // Run from the PLL at 120 MHz. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); // // Configure the device pins. // PinoutSet(); // // Configure the UART. // UARTStdioConfig(0, 115200, g_ui32SysClock); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(g_ui32SysClock); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119); // // Draw the application frame. // FrameDraw(&g_sContext, "usb-otg-mouse"); // // Configure USB for OTG operation. // USBOTGInit(g_ui32SysClock, ModeCallback); sLPMFeature.ui32HIRD = 500; sLPMFeature.ui32Features = USBLIB_FEATURE_LPM_EN | USBLIB_FEATURE_LPM_RMT_WAKE; USBHCDFeatureSet(0, USBLIB_FEATURE_LPM, &sLPMFeature); // // Initialize the host stack. // HostInit(); // // Initialize the device stack. // DeviceInit(); // // Initialize the USB controller for dual mode operation with a 2ms polling // rate. // USBOTGModeInit(0, 2000, g_pui8HCDPool, HCD_MEMORY_SIZE); // // Set the new state so that the screen updates on the first // pass. // g_ui32NewState = 1; // // Loop forever. // while(1) { // // Tell the OTG library code how much time has passed in milliseconds // since the last call. // USBOTGMain(GetTickms()); // // Handle deferred state change. // if(g_ui32NewState) { g_ui32NewState =0; // // Update the status area of the screen. // ClearMainWindow(); // // Update the status bar with the new mode. // switch(g_iCurrentMode) { case eUSBModeHost: { UpdateStatus("Host Mode", 0, true); break; } case eUSBModeDevice: { UpdateStatus("Device Mode", 0, true); break; } case eUSBModeNone: { UpdateStatus("Idle Mode\n", 0, true); break; } default: { break; } } } if(g_iCurrentMode == eUSBModeDevice) { DeviceMain(); } else if(g_iCurrentMode == eUSBModeHost) { HostMain(); } } }
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { MyGyouretuKeisan k; MYMATRIX mat; float matf[16]; for (int i=0;i<16;i++) { mat.m[i/4][i%4] = rand() %30 + 1; matf[i] = mat.m[i/4][i%4]; } float mat_out[16]; float edayo[16]; k.getMatrixInverse(matf,4,mat_out); k.getMatrixMultiply(4,4,matf,4,4,mat_out, edayo); MYMATRIX inv_mat; for (int i=0;i<16;i++) { inv_mat.m[i/4][i%4] = mat_out[i]; } // MyMatrixMultiply(mat,inv_mat,mat); MyMatrixInverse(mat,NULL,mat); /* float matdayo[12*12]; float matdayo2[12*12]; float out_matdayo[12*12]; for (int i=0;i<144;i++) { matdayo[i] = rand() % 30 + 1; } k.getMatrixInverse(matdayo,12,matdayo2); k.getMatrixMultiply(12,12,matdayo,12,12,matdayo2,out_matdayo); */ UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); #ifdef _DEBUG _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #define D3D_DEBUG_INFO #endif setlocale( LC_ALL, "Japanese" ); if (AnotherInstance()) { return 0; } Input* input = new Input(); MSG msg = {0}; try { if(FAILED( InitWindow(hInstance, nCmdShow, input))){ return 0; } } catch (KTROBO::GameError* err) { KTROBO::mylog::writelog(KTROBO::FATAL_ERROR, "init device failure"); KTROBO::mylog::writelog(err->getErrorCode(),err->getMessage()); // MessageBoxA(g_hWnd,err->getMessage(),KTROBO::GameError::getErrorCodeString(err->getErrorCode()),MB_OK); delete err; goto ktrobo_error; } catch (...) { goto ktrobo_error; } game = new KTROBO::Game(); try { game->Init(g_hWnd); } catch (KTROBO::GameError* err) { KTROBO::mylog::writelog(KTROBO::FATAL_ERROR, "init device failure"); KTROBO::mylog::writelog(err->getErrorCode(),err->getMessage()); // MessageBoxA(g_hWnd,err->getMessage(),KTROBO::GameError::getErrorCodeString(err->getErrorCode()),MB_OK); delete err; goto ktrobo_error; } catch (...) { goto ktrobo_error; } // Main message loop //MSG msg = {0}; try { while( WM_QUIT != msg.message ){ if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ){ TranslateMessage( &msg ); DispatchMessage( &msg ); }else{ Sleep(1); InputMessageDispatcher::messageMake(); } } }catch (KTROBO::GameError& err) { KTROBO::mylog::writelog(err.getErrorCode(),err.getMessage()); // MessageBoxA(g_hWnd,err.getMessage(),KTROBO::GameError::getErrorCodeString(err.getErrorCode()),MB_OK); } catch (...) { // MessageBoxW(g_hWnd,L"unknown error",L"ERROR",MB_OK); } ktrobo_error: ClearMainWindow(hInstance); if (input) { delete input; input = 0; } if (game) { game->Del(); delete game; game = 0; } KTROBO::CS::instance()->Del(); return 0;//(int)msg.wParam; }