/* * Copyright (C) 2006, Intel Corporation * * This file is part of the Linux-ready Firmware Developer Kit * * This program file is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation;version 2.1 of the License. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program in a file named COPYING; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../biostest.h" /* Display the PowerTop interactive window. Run the powertop tool (plugins/powertop_install/powertop) of the user chooses 'Run', and go back to the previous menu if user chooses 'Back'. */ static void do_powertop(void) { int myHelloWin; newtComponent myHelloText, myHelloForm, myBack, myRun; newtComponent resu; int W,H; newtGetScreenSize(&W,&H); myHelloWin = newtOpenWindow(1+(W-55)/2, 1+(H-11)/2, 55, 11,"PowerTop 1.11"); myHelloForm = newtForm(NULL,NULL,0); myHelloText = newtTextbox(3,2,52,8, 0); newtFormAddComponent(myHelloForm, myHelloText); newtTextboxSetText(myHelloText, "PowerTop is a tool that monitors and displays the\n" "current power usage, C-state and P-state data of\n" "your CPU. You can use this information to analyse\n" "your mostly-idle system and uncover any possible\n" "firmware bugs."); myRun = newtButton(30,7, "Run"); newtFormAddComponent(myHelloForm, myRun); myBack = newtButton(43,7, "Back"); newtFormAddComponent(myHelloForm, myBack); newtDrawForm(myHelloForm); newtRefresh(); /* If the user chooses 'Run' */ while (1) { resu = newtRunForm(myHelloForm); if (resu == myRun) { newtSuspend(); fprintf(stderr,"\n\n++++++++++++++++++++++++++++++++++++++++++++++++++\n" "Press 'Q' to return to the firmware test kit\n" "++++++++++++++++++++++++++++++++++++++++++++++++++\n\n"); system("/usr/share/LFDK/plugins/powertop_install/powertop"); newtResume(); newtRefresh(); } else break; } /* Return back to the previous menu */ newtPopWindow(); } void run_test(void) { register_interactive_test("PowerTop version 1.11", do_powertop); }