Updated test program paths.
[AROS.git] / workbench / tools / SysExplorer / cpu_arm.c
blob66168ac84d1258d796f802e70237d759f63ab6d9
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 snprintf(bufptr, bufsize, "Features: ");
95 slen = strlen(bufptr);
96 bufptr += slen;
97 bufsize -= slen;
99 if (bufsize < 1)
100 return;
102 found = FALSE;
103 for (i = 0; bufsize > 1 && i < FLAGS_NUM; i++)
106 if (flags[i])
108 found = TRUE;
109 snprintf(bufptr, bufsize, "%s ", features[i]);
110 slen = strlen(bufptr);
111 bufptr += slen;
112 bufsize -= slen;
116 if (bufptr > 5)
118 if (!found)
120 sprintf(bufptr, "None");
121 slen = strlen(bufptr);
122 bufptr += slen;
123 bufsize -= slen;
125 sprintf(bufptr, "\n");
129 #endif