#include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <sys/sysmgr.h> #include <sys/neutrino.h> #include <errno.h> int main(int argc, char *argv[]) { int mode = 0; int ret = 0; int verbose = 0; int opt; while ((opt = getopt(argc, argv, "m:v")) != -1) { switch(opt) { case 'v': verbose++; break; case 'm': // Obtain the desired CPU power mode mode = atoi(optarg); break; } } // Obtain I/O privileges ThreadCtl( _NTO_TCTL_IO, 0 ); // NOTE: Any printf's called before the call to sysmgr_cpumode() may // cause the CPU to wake up due to a serial TX interrupt. errno = 0; // Call the power callout in startup ret = sysmgr_cpumode(mode); if(ret == -1) { if(verbose) perror("sysmgr_cpumode()"); } else { if(verbose) printf("\nCPU powered UP!\n\n"); } return 0; }