Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Debug_SocID.diff
- optional Show CPU X1000 SocID stored in EFUSE (under Debug->View HW Info->Audio)
- copied and coding style transformed for Rockbox from Original Mess at
- github FiiO_Kernel_M3K/arch/mips/xburst/soc-x1000/common/socid.c
- (Credit) ZappBranigan2972 on forums / F. Jacobsen on the Theme Site
- ---
- --- a/firmware/target/mips/ingenic_x1000/debug-x1000.c.orig 2024-08-01 12:25:50.731598530 +0200
- +++ b/firmware/target/mips/ingenic_x1000/debug-x1000.c 2024-08-01 12:18:41.223494647 +0200
- @@ -32,6 +32,66 @@
- #include "gpio-x1000.h"
- #include "lcd-x1000.h"
- +/* X1000 SocID, copied and coding style transformed for Rockbox *
- + * From github FiiO_Kernel_M3K/arch/mips/xburst/soc-x1000/common/socid.c */
- +
- +#include <x1000/cpm.h>
- +#include <x1000/efuse.h>
- +
- +static int32_t x1000_socid;
- +
- +enum socid {
- + ID_X1000 = 0xff00,
- + ID_X1000E = 0xff01,
- + ID_X1500 = 0xff02,
- + ID_X1000_NEW = 0xff08,
- + ID_X1000E_NEW = 0xff09,
- + ID_X1500_NEW = 0xff0a,
- +};
- +
- +uint32_t read_socid(void) {
- + uint32_t val = 0, timeout = 100;
- + int ret = 0;
- +
- + jz_writef(CPM_CLKGR, EFUSE(0)); // EFUSE Clk on
- + jz_write(EFUSE_STATE, 0);
- +
- + val = 0x3c << 21 | 1 << 16 | 1; // Addr 0x3c | Length 0x01 | READ
- + jz_write(EFUSE_CTRL, val);
- +
- + while(!jz_readf(EFUSE_STATE, RD_DONE)) {
- + if(!timeout--) {
- + ret = -1;
- + goto efuse_fail;
- + }
- + }
- + ret = REG_EFUSE_DATA(0); // Read one Entry
- +
- +efuse_fail:
- + jz_writef(CPM_CLKGR, EFUSE(1)); // EFUSE Clk off
- + return ret;
- +}
- +
- +void debug_socid(void) {
- + char str[12];
- + if (x1000_socid < 0) {
- + lcd_puts(0, 17, "socid: efuse busy !\n");
- + return;
- + }
- +#define ID(_ID) snprintf(str, sizeof(str), "%s", _ID); break
- + switch(x1000_socid) {
- + case ID_X1000: ID("X1000");
- + case ID_X1000E: ID("X1000E");
- + case ID_X1500: ID("X1500");
- + case ID_X1000_NEW: ID("X1000_NEW");
- + case ID_X1000E_NEW: ID("X1000E_NEW");
- + case ID_X1500_NEW: ID("X1500_NEW");
- + default: ID("unknown");
- + }
- + lcd_putsf(0, 17, "SocID: %0x, %s", x1000_socid, str);
- +#undef ID
- +}
- +
- static bool dbg_clocks(void)
- {
- do {
- @@ -145,6 +205,7 @@
- }
- #endif
- debug_x1000_lcd();
- + debug_socid();
- lcd_update();
- } while(get_action(CONTEXT_STD, HZ) != ACTION_STD_CANCEL);
- @@ -241,6 +302,7 @@
- bool dbg_hw_info(void)
- {
- + x1000_socid = read_socid();
- struct simplelist_info info;
- simplelist_info_init(&info, MODEL_NAME " debug menu",
- ARRAYLEN(menuitems), NULL);
Advertisement
Add Comment
Please, Sign In to add comment