1
/* Handle m32r architecture */
5
#include <stdlib.h> /* atof */
7
#include "../sysinfo.h"
8
#include "../include/generic.h"
10
int get_cpu_info(struct cpu_info_type *cpu_info) {
13
char temp_string[BUFSIZ];
14
char vendor_string[BUFSIZ],model_string[BUFSIZ];
16
float megahertz=0.0,bogomips=0.0;
18
vendor_string[0]=model_string[0]=0;
20
strncpy(vendor_string,"m32r",5);
22
/* We get all of our info here from /proc/cpuinfo */
23
if ((fff=fopen(get_cpuinfo_file(),"r") )!=NULL) {
25
while ( (fgets(temp_string,BUFSIZ,fff)!=NULL) ) {
27
if ( !(strncmp(temp_string,"cpu family",10))) {
28
strncpy(model_string,parse_line(temp_string),BUFSIZ);
29
clip_lf(model_string,BUFSIZ);
32
if ( !(strncmp(temp_string,"CPU clock",9))) {
33
megahertz=atof(parse_line(temp_string));
36
/* Ugh why must people play with capitalization */
37
if ( !(strncmp(temp_string,"bogomips",8)) ||
38
!(strncmp(temp_string,"BogoMips",8)) ||
39
!(strncmp(temp_string,"BogoMIPS",8))) {
40
bogomips+=atof(parse_line(temp_string));
41
cpu_count++; /* Cheating way to detect number of CPUs */
46
strncpy(cpu_info->chip_vendor,vendor_string,SYSINFO_CHIP_VENDOR_SIZE);
47
strncpy(cpu_info->chip_type,model_string,SYSINFO_CHIP_TYPE_SIZE);
49
cpu_info->num_cpus=cpu_count;
50
cpu_info->megahertz=megahertz;
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,"system type",11))) {
67
strncpy(hardware_string,parse_line(temp_string),
68
SYSINFO_HARDWARE_STRING_SIZE);
75
/* Some architectures might have better ways of detecting RAM size */
76
long int get_arch_specific_mem_size(void) {
77
/* We have no special way of detecting RAM */
78
return get_mem_size_sysinfo();