From 484fa62286f1e868286088182dfc0bbaf90f78a7 Mon Sep 17 00:00:00 2001 From: hattedsquirrel Date: Mon, 3 May 2021 21:30:10 +0200 Subject: [PATCH] Add VDDG_CCD As explained by vol2020 in #1. Also fixed memory initialisation. --- src/pm_tables.c | 8 ++++---- src/pm_tables.h | 3 ++- src/ryzen_monitor.c | 6 ++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/pm_tables.c b/src/pm_tables.c index 81d9029..3c90b15 100644 --- a/src/pm_tables.c +++ b/src/pm_tables.c @@ -172,8 +172,8 @@ void pm_table_0x380804(pm_table *pmt, void* base_addr) { pmt->DETERMINISM = pm_element(135); pmt->V_VDDM = pm_element(136); pmt->V_VDDP = pm_element(137); - pmt->V_VDDG = pm_element(138); - pmt->V_unk1 = pm_element(139); + pmt->V_VDDG_IOD = pm_element(138); + pmt->V_VDDG_CCD = pm_element(139); pmt->PEAK_TEMP = pm_element(140); //o pmt->PEAK_VOLTAGE = pm_element(141); //o @@ -364,8 +364,8 @@ void pm_table_0x380904(pm_table *pmt, void* base_addr) { pmt->DETERMINISM = pm_element(135); pmt->V_VDDM = pm_element(136); pmt->V_VDDP = pm_element(137); - pmt->V_VDDG = pm_element(138); - pmt->V_unk1 = pm_element(139); + pmt->V_VDDG_IOD = pm_element(138); + pmt->V_VDDG_CCD = pm_element(139); pmt->PEAK_TEMP = pm_element(140); pmt->PEAK_VOLTAGE = pm_element(141); pmt->unk_power = pm_element(142); diff --git a/src/pm_tables.h b/src/pm_tables.h index b09446a..d933c3c 100644 --- a/src/pm_tables.h +++ b/src/pm_tables.h @@ -126,7 +126,8 @@ typedef struct { float *V_VDDM; float *V_VDDP; float *V_VDDG; - float *V_unk1; + float *V_VDDG_IOD; + float *V_VDDG_CCD; float *PEAK_TEMP; float *PEAK_VOLTAGE; float *unk_power; diff --git a/src/ryzen_monitor.c b/src/ryzen_monitor.c index 30294b3..8ac56fd 100644 --- a/src/ryzen_monitor.c +++ b/src/ryzen_monitor.c @@ -195,7 +195,9 @@ void draw_screen(pm_table *pmt, system_info *sysinfo) { //print_line("VDDCR_SoC", "%7.3f V", pmta(SOC_SET_VOLTAGE)); //Might be the default voltage, not the actually set one print_line("cLDO_VDDM", "%7.4f V", pmta(V_VDDM)); print_line("cLDO_VDDP", "%7.4f V", pmta(V_VDDP)); - print_line("cLDO_VDDG", "%7.4f V", pmta(V_VDDG)); + if(pmt->V_VDDG) print_line("cLDO_VDDG", "%7.4f V", pmta(V_VDDG)); + if(pmt->V_VDDG_IOD) print_line("cLDO_VDDG_IOD", "%7.4f V", pmta(V_VDDG_IOD)); + if(pmt->V_VDDG_CCD) print_line("cLDO_VDDG_CCD", "%7.4f V", pmta(V_VDDG_CCD)); fprintf(stdout, "╰───────────────────────────────────────────────┴────────────────────────────────────────────────╯\n"); fprintf(stdout, "╭── Power Consumption ──────────────────────────┬────────────────────────────────────────────────╮\n"); @@ -269,7 +271,7 @@ void draw_screen(pm_table *pmt, system_info *sysinfo) { int select_pm_table_version(unsigned int version, pm_table *pmt, unsigned char *pm_buf) { //Initialize pmt to 0. This also sets all pointers to 0, which signifies non-existiting fields. //Access via pmta(...) will check if pointer is 0 before trying to access the value. - memset(pmt, 0, sizeof(pmt)); + memset(pmt, 0, sizeof(pm_table)); //Select matching PM Table switch(version) {