Blog Code Forum

Base Clock

From Wiki.cyring.fr

Jump to: navigation, search
Source code to read the Base Clock of the ASUS Rampage II GENE


  1. // bclk.c
  2. #include 
  3. #include 
  4. #include 
  5.  
  6. int bios_bclk()
  7. {
  8. 	int	fd = -1;
  9. 	ssize_t	br = 1;
  10. 	char	buf[2];
  11. 	int	clk = 0;
  12.  
  13. 	if( (fd = open("/dev/mem", O_RDONLY)) != -1 )
  14. 	{
  15. 	  if( (lseek(fd, 0xf08d9 + 0x12, SEEK_SET ) != -1)
  16. 		&& ((br = read(fd, buf, 2)) !=1) )
  17. 		  clk = ((unsigned char) (buf[0])) + ((unsigned char) (buf[1] << 8));
  18. 	  close(fd);
  19. 	}
  20. 	else
  21. 	  clk = 0;
  22.  
  23. 	return(clk);
  24. }
  25.  
  26. int main(int argc, char **argv)
  27. {
  28. 	printf( "BCLK=%d MHzn", bios_bclk() );
  29. }


Copy and past the code into a source file, for instance bclk.c
Execute as root to be able to read the DMI

  1. # nano bclk.c
  2. # clang bclk.c -o bclk
  3. # ./bclk
  4. BCLK=160 MHz
Personal tools