disable debug
[AROS.git] / workbench / tools / SysExplorer / cpu_arm.c
blobfc5484f0c289ec5f33c56c94e60b7dc129446656
1 #include <resources/processor.h>
2 #include <proto/processor.h>
4 #include <stdio.h>
5 #include <string.h>
7 #include "cpuspecific.h"
9 #ifdef __arm__
11 /* First byte of these strings is implementer ID */
12 static const char *vendors[] =
14 "\x41" "ARM Ltd",
15 "\x44" "Digital Equipment Corp",
16 "\x4D" "Freescale Semiconductor",
17 "\x51" "Qualcomm",
18 "\x56" "Marvell Inc",
19 "\x69" "Intel Corporation",
20 NULL
23 #define FLAGS_NUM 5
25 static const char *features[] =
27 "VFP",
28 "VFPv3",
29 "Neon",
30 "Thumb",
31 "ThumbEE"
34 void PrintCPUSpecificInfo(char *buffer, LONG bufsize, ULONG i, APTR ProcessorBase)
36 LONG slen;
37 char *bufptr = buffer;
39 BOOL found;
40 ULONG vendor = 0;
41 ULONG part = 0;
42 ULONG version = 0;
43 BOOL flags[FLAGS_NUM];
44 struct TagItem tags [FLAGS_NUM + 5] =
46 {GCIT_SelectedProcessor , i },
47 {GCIT_Model , (IPTR)&part },
48 {GCIT_Version , (IPTR)&version },
49 {GCIT_Vendor , (IPTR)&vendor },
50 {GCIT_SupportsVFP , (IPTR)&flags[0 ]},
51 {GCIT_SupportsVFPv3 , (IPTR)&flags[1 ]},
52 {GCIT_SupportsNeon , (IPTR)&flags[2 ]},
53 {GCIT_SupportsThumb , (IPTR)&flags[3 ]},
54 {GCIT_SupportsThumbEE , (IPTR)&flags[4 ]},
55 {TAG_DONE , 0 }
58 GetCPUInfo(tags);
60 found = FALSE;
61 for (i = 0; vendors[i]; i++)
63 const char *name = vendors[i];
65 if (name[0] == vendor)
67 snprintf(bufptr, bufsize, "%s", &name[1]);
68 slen = strlen(bufptr);
69 bufptr += slen;
70 bufsize -= slen;
72 found = TRUE;
73 break;
77 if (!found)
79 snprintf(bufptr, bufsize, "Unknown vendor (0x%X)", vendor);
80 slen = strlen(bufptr);
81 bufptr += slen;
82 bufsize -= slen;
85 snprintf(bufptr, bufsize, "0x%X revision %d variant %d\n",
86 part, ARM_REVISION(version), ARM_VARIANT(version));
87 slen = strlen(bufptr);
88 bufptr += slen;
89 bufsize -= slen;
91 if (bufsize < 1)
92 return;
94 found = FALSE;
95 for (i = 0; bufsize > 1 && i < FLAGS_NUM; i++)
98 if (flags[i])
100 found = TRUE;
101 snprintf(bufptr, bufsize, "%s ", features[i]);
102 slen = strlen(bufptr);
103 bufptr += slen;
104 bufsize -= slen;
108 if (bufsize > 5)
110 if (!found)
112 sprintf(bufptr, "None");
113 slen = strlen(bufptr);
114 bufptr += slen;
115 bufsize -= slen;
117 sprintf(bufptr, "\n");
121 #endif