mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 16:00:39 +01:00
[v1.03][RISCV] Implementing basic skeleton for RISC-V backend
This commit is contained in:
@@ -3,8 +3,35 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "../common/global.h"
|
||||
#include "../common/udev.h"
|
||||
|
||||
struct frequency* get_frequency_info(uint32_t core) {
|
||||
struct frequency* freq = emalloc(sizeof(struct frequency));
|
||||
|
||||
freq->base = UNKNOWN_DATA;
|
||||
freq->max = get_max_freq_from_file(core);
|
||||
|
||||
return freq;
|
||||
}
|
||||
|
||||
struct cpuInfo* get_cpu_info(void) {
|
||||
return NULL;
|
||||
struct cpuInfo* cpu = malloc(sizeof(struct cpuInfo));
|
||||
//init_cpu_info(cpu);
|
||||
int ncores = get_ncores_from_cpuinfo();
|
||||
cpu->hv = emalloc(sizeof(struct hypervisor));
|
||||
cpu->hv->present = false;
|
||||
//cpu->soc = get_soc();
|
||||
//cpu->peak_performance = get_peak_performance(cpu);
|
||||
cpu->peak_performance = 0;
|
||||
cpu->freq = get_frequency_info(0);
|
||||
cpu->cpu_vendor = CPU_VENDOR_RISCV;
|
||||
|
||||
return cpu;
|
||||
}
|
||||
|
||||
char* get_str_topology(struct cpuInfo* cpu, struct topology* topo) {
|
||||
return "Many cores";
|
||||
}
|
||||
|
||||
void print_debug(struct cpuInfo* cpu) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "../common/cpu.h"
|
||||
|
||||
struct cpuInfo* get_cpu_info(void);
|
||||
char* get_str_topology(struct cpuInfo* cpu, struct topology* topo);
|
||||
void print_debug(struct cpuInfo* cpu);
|
||||
|
||||
#endif
|
||||
|
||||
9
src/riscv/soc.c
Normal file
9
src/riscv/soc.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "soc.h"
|
||||
|
||||
char* get_str_process(struct system_on_chip* soc) {
|
||||
return "-1 nm";
|
||||
}
|
||||
|
||||
char* get_soc_name(struct system_on_chip* soc) {
|
||||
return "Unknown";
|
||||
}
|
||||
20
src/riscv/soc.h
Normal file
20
src/riscv/soc.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef __SOC__
|
||||
#define __SOC__
|
||||
|
||||
#include "../common/cpu.h"
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int32_t SOC;
|
||||
|
||||
struct system_on_chip {
|
||||
SOC soc_model;
|
||||
VENDOR soc_vendor;
|
||||
int32_t process;
|
||||
char* soc_name;
|
||||
char* raw_name;
|
||||
};
|
||||
|
||||
char* get_soc_name(struct system_on_chip* soc);
|
||||
char* get_str_process(struct system_on_chip* soc);
|
||||
|
||||
#endif
|
||||
@@ -1,11 +1,18 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "uarch.h"
|
||||
#include "../common/global.h"
|
||||
|
||||
struct uarch {
|
||||
//MICROARCH uarch;
|
||||
char* uarch_str;
|
||||
int32_t process; // measured in nanometers
|
||||
};
|
||||
|
||||
char* get_str_uarch(struct cpuInfo* cpu) {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
void free_uarch_struct(struct uarch* arch) {
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
struct uarch;
|
||||
|
||||
char* get_str_uarch(struct cpuInfo* cpu);
|
||||
void free_uarch_struct(struct uarch* arch);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user