5 #include "v3_user_dvfs.h"
9 fprintf(stderr,"usage: v3_dvfs core|core..core command\n");
10 fprintf(stderr," where command is one of the following\n");
11 fprintf(stderr," acquire direct|external\n");
12 fprintf(stderr," pstate number\n");
13 fprintf(stderr," freq number (kHz)\n");
14 fprintf(stderr," release\n\n");
15 fprintf(stderr,"Look at /proc/v3vee/v3-dvfs to see state\n\n");
20 int main(int argc, char *argv[])
22 if (argc!=4 && argc!=3) {
28 uint32_t corestart, coreend, core ;
32 if (strstr(argv[1],"..")) {
33 if (sscanf(argv[1],"%u..%u",&corestart,&coreend)!=2) {
38 corestart=coreend=atoi(argv[1]);
42 if (argc==3 && strcasecmp(cmd,"release")) {
51 for (core=corestart;core<=coreend;core++) {
52 if (!strcasecmp(cmd,"acquire")) {
53 if (!strcasecmp(arg,"direct")) {
54 if (v3_user_dvfs_acquire_direct(core)) {
55 fprintf(stderr,"Failed to set core %u to direct\n",core);
58 fprintf(stderr,"Core %u set to direct\n",core);
60 } else if (!strcasecmp(arg,"external")) {
61 if (v3_user_dvfs_acquire_external(core)) {
62 fprintf(stderr,"Failed to set core %u to external\n",core);
65 fprintf(stderr,"Core %u set to external\n",core);
71 } else if (!strcasecmp(cmd,"pstate")) {
72 if (v3_user_dvfs_set_pstate(core,atoll(arg))) {
73 fprintf(stderr,"Failed to set core %u to pstate %d\n",core,atoi(arg));
76 fprintf(stderr,"Core %u set to pstate %d\n",core,atoi(arg));
78 } else if (!strcasecmp(cmd,"freq")) {
79 if (v3_user_dvfs_set_freq(core,atoll(arg))) {
80 fprintf(stderr,"Failed to set core %u to frequency %lld kHz\n",core,atoll(arg));
83 fprintf(stderr,"Core %u set to frequency %lld kHz\n",core,atoll(arg));
85 } else if (!strcasecmp(cmd,"release")) {
86 if (v3_user_dvfs_release(core)) {
87 fprintf(stderr,"Failed to release core %u to host control\n",core);
90 fprintf(stderr,"Released core %u to host control\n",core);