Blog Code Forum

Base Clock

From Wiki.cyring.fr

Revision as of 10:06, 6 April 2012 by Cyril (Talk | contribs)
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. }
Personal tools