Package: linuxinfo / 1.1.8-34

25_avr32-support Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Description: Avr32 support.
# Author: Helge Kreutzmann <debian@helgefjell.de>
# Last-Update: 2010-02-15

Index: linuxinfo-1.1.8-31/linuxinfo_avr.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linuxinfo-1.1.8-31/linuxinfo_avr.c	2010-03-10 19:44:05.016234945 +0100
@@ -0,0 +1,64 @@
+/*
+        linuxinfo_avr.c
+
+        Copyright (C) 2010
+        All Rights Reserved.
+
+        Helge Kreutzmann <debian@helgefjell.de>
+	based on linuxinfo_sh.c from Nobuhiro Iwamatsu <iwamatsu@nigauri.org>,
+
+        Version Author  Date            Comments
+        ----------------------------------------------------------------------
+        1.0.0   KRE     20010215        Initial development
+
+        This is the avr32 port of linuxinfo
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "linuxinfo.h"
+
+#ifdef system_avr32
+
+void GetHardwareInfo(int fd, struct hw_stat *hw)
+{
+	int processors = 0;
+	float bogomips = 0.0, tempbogo;
+	char temp_string[BUFSIZ], temp_string2[BUFSIZ];
+	char chip[BUFSIZ] = "Unknown";
+	char family[BUFSIZ]="Unknown";
+	char clock[BUFSIZ]="Unknown";
+
+	while (read_line(fd, temp_string, BUFSIZ) != 0)
+	{
+		splitstring(temp_string, temp_string2);
+
+		/* CPU count */
+		if (strncmp(temp_string, "processor", strlen("processor")) == 0)
+			processors++;
+
+		/* "cpu type" -> chip */ /* FIXME Check with Brad? */
+		if (!(strncmp(temp_string, "cpu type", strlen("cpu type"))) || !(strncmp(temp_string, "cpu core", strlen("cpu core"))))
+			strcpy(chip, temp_string2);
+
+		/* cpu family */ /* FIXME Check with Brad? */
+		if (!(strncmp(temp_string, "cpu family", strlen("cpu family"))) || !(strncmp(temp_string, "cpu arch", strlen("cpu arch"))))
+			strcpy(family, temp_string2);
+
+		/* bogomips and clock FIXME clock */
+                if (!(strncmp(temp_string, "bogomips", strlen("bogomips")))) {
+			strcpy(clock, temp_string2);
+                        sscanf(temp_string2, "%f", &tempbogo);
+                        bogomips += tempbogo;
+                }
+	}
+
+	sprintf(hw->hw_memory, LONGSPEC, getphysicalmemory());
+	hw->hw_processors = processors;
+	sprintf(hw->hw_cpuinfo, "%s %s", family, chip);
+	sprintf(hw->hw_bogomips, "%0.2f", bogomips);
+	sprintf(hw->hw_megahertz, "%s", clock);
+}
+#endif /* system_avr */
Index: linuxinfo-1.1.8-31/linuxinfo.h
===================================================================
--- linuxinfo-1.1.8-31.orig/linuxinfo.h	2010-03-10 19:43:43.064417378 +0100
+++ linuxinfo-1.1.8-31/linuxinfo.h	2010-03-10 19:43:43.076418861 +0100
@@ -21,7 +21,8 @@
         1.1.5   OPAL	20021225	Added hppa
 	1.1.8   KRE     20040429        Added mips
 	1.1.8   KRE     20040807        Add support for HIGHMEM
-	1.1.8   KRE     20100201        Added sh (Nobuhiro Iwamatsu)
+	1.1.8   KRE     20010201        Added sh (Nobuhiro Iwamatsu)
+	1.1.8   KRE     20010201        Added avr32
 
 */
 
@@ -76,6 +77,10 @@
 #define system_sh
 #endif
 
+#if defined(__avr32__)
+#define system_avr32
+#endif
+
 #if (SIZEOF_LONG > 4)
 #define LONGLONG long int
 #define LONGSPEC "%ld"