int main(){ UtInit(); //JoinTest(); /* Ex1_Test */ //SleepTest(); /* Ex2_Test */ /* Escreva programas para determinar o tempo de comutação de threads na biblioteca UThread. Para a medição de tempos, utilize a função da Windows API GetTickCount. */ SwitchTest(); /* Ex3_Test */ UtRun(); printf("\nPress any key to finish"); getchar(); UtEnd(); return 0; }
//****************************************************************************** // Main Menu //****************************************************************************** void MainMenu(void) { char choice[1]; char LED; char UART; char Audio; char Switch; char TempSensor; char* test="blank"; unsigned int validChoice = 0; ConsoleUtilsPrintf("\n\n\n\n"); ConsoleUtilsPrintf("\n**************************************************************\n"); ConsoleUtilsPrintf("* PRU Cape Demo *\n"); ConsoleUtilsPrintf("**************************************************************\n"); ConsoleUtilsPrintf(" \n"); while(!validChoice) { ConsoleUtilsPrintf("\n\nWhat test would you like to run?\n\n"); ConsoleUtilsPrintf("1. LEDs\n"); ConsoleUtilsPrintf("2. Switches\n"); ConsoleUtilsPrintf("3. Audio\n"); ConsoleUtilsPrintf("4. Uart\n"); ConsoleUtilsPrintf("5. Temp sensor\n"); ConsoleUtilsPrintf("6. All\n"); ConsoleUtilsGets(choice, 3); switch(choice[0]) { case '1': test = "LEDs"; ConsoleUtilsPrintf("\nYou chose %s\n", test); LED = LEDTest(); break; case '2': test = "Switch"; ConsoleUtilsPrintf("\nYou chose %s\n", test); Switch = SwitchTest(); break; case '3': test = "Audio"; ConsoleUtilsPrintf("\nYou chose %s\n", test); Audio = AudioTest(); break; case '4': test = "Uart"; ConsoleUtilsPrintf("\nYou chose %s\n", test); UART = UARTTest(); break; case '5': test = "Temp sensor"; ConsoleUtilsPrintf("\nYou chose %s\n", test); TempSensor = HDQTest(); break; case '6': test = "All"; ConsoleUtilsPrintf("\nYou chose %s\n", test); ConsoleUtilsPrintf("\nRunning all tests, loading... \n"); LED = LEDTest(); PRUICSSReset(); Switch = SwitchTest(); PRUICSSReset(); Audio = AudioTest(); PRUICSSReset(); UART = UARTTest(); PRUICSSReset(); TempSensor = HDQTest(); PRUICSSReset(); ConsoleUtilsPrintf("\n\n\n**************************************************************\n"); ConsoleUtilsPrintf("\n TEST RESULTS \n"); ConsoleUtilsPrintf("\n**************************************************************\n"); if((LED =='y') || (LED =='Y')) ConsoleUtilsPrintf("\nLED Pass"); else ConsoleUtilsPrintf("\nLED Fail"); if((Switch =='y') || (Switch =='Y')) ConsoleUtilsPrintf("\nSwitch Pass"); else ConsoleUtilsPrintf("\nSwitch Fail"); if((Audio =='y') || (Audio =='Y')) ConsoleUtilsPrintf("\nAUDIO Pass"); else ConsoleUtilsPrintf("\nAUDIO Fail"); if((UART =='y') || (UART =='Y')) ConsoleUtilsPrintf("\nUART Pass"); else ConsoleUtilsPrintf("\nUART Fail"); if((TempSensor =='y') || (TempSensor =='Y')) ConsoleUtilsPrintf("\nTemp Sensor Pass"); else ConsoleUtilsPrintf("\nTemp Sensor Fail"); ConsoleUtilsPrintf("\n\n\n"); break; default: ConsoleUtilsPrintf("\nInvalid input.\n\n"); break; } } validChoice = 0; }