Base Clock
From Wiki.cyring.fr
(Difference between revisions)
(Created page with "== How to read the Base Clock ==") |
|||
(3 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | == | + | ===== Source code to read the Base Clock of the ASUS Rampage II GENE ===== |
+ | <br /> | ||
+ | <syntaxhighlight lang="c" line start="1"> | ||
+ | // bclk.c | ||
+ | #include | ||
+ | #include | ||
+ | #include | ||
+ | |||
+ | int bios_bclk() | ||
+ | { | ||
+ | int fd = -1; | ||
+ | ssize_t br = 1; | ||
+ | char buf[2]; | ||
+ | int clk = 0; | ||
+ | |||
+ | if( (fd = open("/dev/mem", O_RDONLY)) != -1 ) | ||
+ | { | ||
+ | if( (lseek(fd, 0xf08d9 + 0x12, SEEK_SET ) != -1) | ||
+ | && ((br = read(fd, buf, 2)) !=1) ) | ||
+ | clk = ((unsigned char) (buf[0])) + ((unsigned char) (buf[1] << 8)); | ||
+ | close(fd); | ||
+ | } | ||
+ | else | ||
+ | clk = 0; | ||
+ | |||
+ | return(clk); | ||
+ | } | ||
+ | |||
+ | int main(int argc, char **argv) | ||
+ | { | ||
+ | printf( "BCLK=%d MHzn", bios_bclk() ); | ||
+ | } | ||
+ | </syntaxhighlight><br /> | ||
+ | <br /> | ||
+ | Copy and past the code into a source file, for instance bclk.c<br /> | ||
+ | Execute as root to be able to read the [http://www.dmtf.org/standards/smbios DMI] | ||
+ | <br /><br /> | ||
+ | <syntaxhighlight lang="bash" line start="1"> | ||
+ | # nano bclk.c | ||
+ | # clang bclk.c -o bclk | ||
+ | # ./bclk | ||
+ | BCLK=160 MHz | ||
+ | </syntaxhighlight> |
Latest revision as of 15:54, 6 April 2012
Source code to read the Base Clock of the ASUS Rampage II GENE
// bclk.c
#include
#include
#include
int bios_bclk()
{
int fd = -1;
ssize_t br = 1;
char buf[2];
int clk = 0;
if( (fd = open("/dev/mem", O_RDONLY)) != -1 )
{
if( (lseek(fd, 0xf08d9 + 0x12, SEEK_SET ) != -1)
&& ((br = read(fd, buf, 2)) !=1) )
clk = ((unsigned char) (buf[0])) + ((unsigned char) (buf[1] << 8));
close(fd);
}
else
clk = 0;
return(clk);
}
int main(int argc, char **argv)
{
printf( "BCLK=%d MHzn", bios_bclk() );
}
Copy and past the code into a source file, for instance bclk.c
Execute as root to be able to read the DMI
# nano bclk.c
# clang bclk.c -o bclk
# ./bclk
BCLK=160 MHz