Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Avoid strict-aliasing related issues when compiling with optimization
[palacios.git] / linux_usr / v3_user_dvfs.c
1 #include <unistd.h>
2 #include <sys/stat.h>
3 #include <fcntl.h>
4 #include <malloc.h>
5 #include <string.h>
6 #include <stdio.h>
7
8 #include "v3_ctrl.h"
9 #include "v3_user_dvfs.h"
10
11 int v3_user_dvfs_acquire_direct(uint32_t core)
12 {
13     struct v3_dvfs_ctrl_request r;
14
15     r.cmd=V3_DVFS_ACQUIRE;
16     r.acq_type=V3_DVFS_DIRECT;
17     r.pcore=core;
18     r.freq_khz=0;
19     r.pstate=0;
20
21     return v3_dev_ioctl(V3_DVFS_CTRL,&r);
22 }
23
24 int v3_user_dvfs_acquire_external(uint32_t core)
25 {
26     struct v3_dvfs_ctrl_request r;
27
28     r.cmd=V3_DVFS_ACQUIRE;
29     r.acq_type=V3_DVFS_EXTERNAL;
30     r.pcore=core;
31     r.freq_khz=0;
32     r.pstate=0;
33
34     return v3_dev_ioctl(V3_DVFS_CTRL,&r);
35 }
36
37 int v3_user_dvfs_release(uint32_t core)
38 {
39     struct v3_dvfs_ctrl_request r;
40
41     r.cmd=V3_DVFS_RELEASE;
42     r.acq_type=V3_DVFS_DIRECT;
43     r.pcore=core;
44     r.freq_khz=0;
45     r.pstate=0;
46
47     return v3_dev_ioctl(V3_DVFS_CTRL,&r);
48 }
49
50
51 int v3_user_dvfs_set_pstate(uint32_t core, uint64_t pstate)
52 {
53     struct v3_dvfs_ctrl_request r;
54
55     r.cmd=V3_DVFS_SETPSTATE;
56     r.acq_type=V3_DVFS_DIRECT;
57     r.pcore=core;
58     r.freq_khz=0;
59     r.pstate=pstate;
60
61     return v3_dev_ioctl(V3_DVFS_CTRL,&r);
62 }
63
64 int v3_user_dvfs_set_freq(uint32_t core, uint64_t freq_khz)
65 {
66     struct v3_dvfs_ctrl_request r;
67
68     r.cmd=V3_DVFS_SETFREQ;
69     r.acq_type=V3_DVFS_EXTERNAL;
70     r.pcore=core;
71     r.freq_khz=freq_khz;
72     r.pstate=0;
73
74     return v3_dev_ioctl(V3_DVFS_CTRL,&r);
75 }
76