MCPcopy Create free account
hub / github.com/OAID/Tengine / get_cpu_model_arch

Function get_cpu_model_arch

driver/cpu/cpu_probe.cpp:175–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175static int get_cpu_model_arch(int id, struct cpu_cluster* cluster)
176{
177 char cpu_fname[256];
178 FILE* fp;
179 char* line;
180 int cur_id = 0;
181
182 /* set the pre-set default info, in case of failure */
183
184 cluster->l1_size = 32 << 10;
185 cluster->l2_size = 512 << 10;
186
187#if __ARM_ARCH >= 8
188 cluster->cpu_arch = ARCH_ARM_V8;
189 cluster->cpu_model = CPU_A53;
190#else
191 cluster->cpu_arch = ARCH_ARM_V7;
192 cluster->cpu_model = CPU_A7;
193#endif
194
195 sprintf(cpu_fname, "/proc/cpuinfo");
196
197 fp = fopen(cpu_fname, "r");
198
199 if(!fp)
200 return 0;
201
202 while(get_target_line(fp, "processor"))
203 {
204 if(cur_id == id)
205 break;
206
207 cur_id++;
208 }
209
210 if(cur_id != id)
211 {
212 fclose(fp);
213 return 0;
214 }
215
216 /*
217 processor : 4
218 BogoMIPS : 48.00
219 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
220 CPU implementer : 0x41
221 CPU architecture: 8
222 CPU variant : 0x0
223 CPU part : 0xd08
224 CPU revision : 2
225 */
226
227 /*
228 line=get_target_line(fp,"CPU architecture");
229
230 if(!line)
231 {
232 fclose(fp);

Callers 1

probe_system_cpuFunction · 0.85

Calls 1

get_target_lineFunction · 0.85

Tested by

no test coverage detected