1
/* Handles avr32 chips on Linux architecture */
2
/* by Vince Weaver <vince@deater.net> */
6
#include <stdlib.h> /* atof */
8
#include "../sysinfo.h"
9
#include "../include/generic.h"
11
int get_cpu_info(struct cpu_info_type *cpu_info) {
14
char temp_string[BUFSIZ];
15
char vendor_string[BUFSIZ],model_string[BUFSIZ],temp[BUFSIZ];
17
float megahertz=0.0,bogomips=0.0;
19
vendor_string[0]=model_string[0]=0;
21
strncpy(vendor_string,"ATMEL",6);
23
/* We get all of our info here from /proc/cpuinfo */
24
if ((fff=fopen(get_cpuinfo_file(),"r") )!=NULL) {
26
while ( (fgets(temp_string,BUFSIZ,fff)!=NULL) ) {
28
if ( !(strncmp(temp_string,"cpu type",8))) {
29
strncpy(model_string,parse_line(temp_string),BUFSIZ);
30
clip_lf(model_string,BUFSIZ);
32
else if ( !(strncmp(temp_string,"cpu family",10))) {
33
strncpy(vendor_string,parse_line(temp_string),BUFSIZ);
34
clip_lf(vendor_string,BUFSIZ);
37
if ( !(strncmp(temp_string,"bogomips",8))) {
38
bogomips+=atof(parse_line(temp_string));
39
cpu_count++; /* Cheating way to detect number of CPU's */
44
sscanf(vendor_string,"%s",temp);
45
strncpy(cpu_info->chip_vendor,temp,SYSINFO_CHIP_VENDOR_SIZE);
46
sscanf(model_string,"%s",temp);
47
strncpy(cpu_info->chip_type,temp,SYSINFO_CHIP_TYPE_SIZE);
49
cpu_info->num_cpus=cpu_count;
50
cpu_info->megahertz=megahertz/1000000.0;
51
cpu_info->bogomips=bogomips;
57
int get_hardware(char *hardware_string) {
59
char temp_string[BUFSIZ];
62
if ((fff=fopen(get_cpuinfo_file(),"r") )!=NULL) {
64
while ( (fgets(temp_string,BUFSIZ,fff)!=NULL) ) {
66
if (!(strncmp(temp_string,"cpu family",10))) {
67
strncpy(hardware_string,parse_line(temp_string),
68
SYSINFO_HARDWARE_STRING_SIZE);
76
/* Some architectures might have better ways of detecting RAM size */
77
long int get_arch_specific_mem_size(void) {
78
/* We have no special way of detecting RAM */
79
return get_mem_size_sysinfo();