mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-26 11:42:09 +00:00
Bugfixes + Unfattening + Remove white on boot
This commit is contained in:
parent
bc67798f43
commit
39653f7678
10 changed files with 79 additions and 77 deletions
2
ipl/di.h
2
ipl/di.h
|
@ -80,6 +80,8 @@
|
|||
#define DC_COM_PIN_OUTPUT_ENABLE(x) (0x302 + (x))
|
||||
#define DC_COM_PIN_OUTPUT_POLARITY(x) (0x306 + (x))
|
||||
|
||||
#define DC_COM_DSC_TOP_CTL 0x33E
|
||||
|
||||
#define DC_DISP_DISP_WIN_OPTIONS 0x402
|
||||
#define HDMI_ENABLE (1 << 30)
|
||||
#define DSI_ENABLE (1 << 29)
|
||||
|
|
53
ipl/ff.c
53
ipl/ff.c
|
@ -27,7 +27,7 @@
|
|||
#include "gfx.h"
|
||||
extern gfx_ctxt_t gfx_ctxt;
|
||||
extern gfx_con_t gfx_con;
|
||||
#define EFSPRINTF(text, ...) print_error(); gfx_printf(&gfx_con, "%k"text"%k\n", 0xFFFFFF00, 0xFFFFFFFF);\
|
||||
#define EFSPRINTF(text, ...) print_error(); gfx_printf(&gfx_con, "%k"text"%k\n", 0xFFFFFF00, 0xFFFFFFFF);
|
||||
//#define EFSPRINTF(...)
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
|
@ -3248,7 +3248,7 @@ static FRESULT find_volume ( /* FR_OK(0): successful, !=0: an error occurred */
|
|||
stat = disk_status(fs->pdrv);
|
||||
if (!(stat & STA_NOINIT)) { /* and the physical drive is kept initialized */
|
||||
if (!FF_FS_READONLY && mode && (stat & STA_PROTECT)) { /* Check write protection if needed */
|
||||
EFSPRINTF("Write protected!");
|
||||
EFSPRINTF("WPEN1");
|
||||
return FR_WRITE_PROTECTED;
|
||||
}
|
||||
return FR_OK; /* The filesystem object is valid */
|
||||
|
@ -3262,11 +3262,11 @@ static FRESULT find_volume ( /* FR_OK(0): successful, !=0: an error occurred */
|
|||
fs->pdrv = LD2PD(vol); /* Bind the logical drive and a physical drive */
|
||||
stat = disk_initialize(fs->pdrv); /* Initialize the physical drive */
|
||||
if (stat & STA_NOINIT) { /* Check if the initialization succeeded */
|
||||
EFSPRINTF("Medium not ready or hard error!");
|
||||
EFSPRINTF("MDNR");
|
||||
return FR_NOT_READY; /* Failed to initialize due to no medium or hard error */
|
||||
}
|
||||
if (!FF_FS_READONLY && mode && (stat & STA_PROTECT)) { /* Check disk write protection if needed */
|
||||
EFSPRINTF("Write protected!");
|
||||
EFSPRINTF("WPEN2");
|
||||
return FR_WRITE_PROTECTED;
|
||||
}
|
||||
#if FF_MAX_SS != FF_MIN_SS /* Get sector size (multiple sector size cfg only) */
|
||||
|
@ -3290,11 +3290,11 @@ static FRESULT find_volume ( /* FR_OK(0): successful, !=0: an error occurred */
|
|||
} while (LD2PT(vol) == 0 && fmt >= 2 && ++i < 4);
|
||||
}
|
||||
if (fmt == 4) {
|
||||
EFSPRINTF("Could not load boot record!");
|
||||
EFSPRINTF("BRNL");
|
||||
return FR_DISK_ERR; /* An error occured in the disk I/O layer */
|
||||
}
|
||||
if (fmt >= 2) {
|
||||
EFSPRINTF("No FAT/FAT32/exFAT found!");
|
||||
EFSPRINTF("NOFAT");
|
||||
return FR_NO_FILESYSTEM; /* No FAT volume is found */
|
||||
}
|
||||
|
||||
|
@ -3312,7 +3312,7 @@ static FRESULT find_volume ( /* FR_OK(0): successful, !=0: an error occurred */
|
|||
return FR_NO_FILESYSTEM; /* Check exFAT version (must be version 1.0) */
|
||||
|
||||
if (1 << fs->win[BPB_BytsPerSecEx] != SS(fs)) { /* (BPB_BytsPerSecEx must be equal to the physical sector size) */
|
||||
EFSPRINTF("exFAT - Sector size does not match physical sector size!");
|
||||
EFSPRINTF("EX_SPS");
|
||||
return FR_NO_FILESYSTEM;
|
||||
}
|
||||
|
||||
|
@ -3324,13 +3324,12 @@ static FRESULT find_volume ( /* FR_OK(0): successful, !=0: an error occurred */
|
|||
|
||||
fs->n_fats = fs->win[BPB_NumFATsEx]; /* Number of FATs */
|
||||
if (fs->n_fats != 1) {
|
||||
EFSPRINTF("exFAT - Multiple or no file allocation tables found!");
|
||||
EFSPRINTF("EX_FNF");
|
||||
return FR_NO_FILESYSTEM; /* (Supports only 1 FAT) */
|
||||
}
|
||||
|
||||
fs->csize = 1 << fs->win[BPB_SecPerClusEx]; /* Cluster size */
|
||||
if (fs->csize == 0) {
|
||||
EFSPRINTF("exFAT - Sectors per clusters!");
|
||||
return FR_NO_FILESYSTEM; /* (Must be 1..32768) */
|
||||
}
|
||||
|
||||
|
@ -3349,14 +3348,14 @@ static FRESULT find_volume ( /* FR_OK(0): successful, !=0: an error occurred */
|
|||
|
||||
/* Check if bitmap location is in assumption (at the first cluster) */
|
||||
if (move_window(fs, clst2sect(fs, fs->dirbase)) != FR_OK) {
|
||||
EFSPRINTF("exFAT - Bitmap location not at 1st cluster!");
|
||||
EFSPRINTF("EX_BM1C");
|
||||
return FR_DISK_ERR;
|
||||
}
|
||||
for (i = 0; i < SS(fs); i += SZDIRE) {
|
||||
if (fs->win[i] == 0x81 && ld_dword(fs->win + i + 20) == 2) break; /* 81 entry with cluster #2? */
|
||||
}
|
||||
if (i == SS(fs)) {
|
||||
EFSPRINTF("exFAT - Bitmap allocation is missing!");
|
||||
EFSPRINTF("EX_BMM");
|
||||
return FR_NO_FILESYSTEM;
|
||||
}
|
||||
#if !FF_FS_READONLY
|
||||
|
@ -3367,7 +3366,7 @@ static FRESULT find_volume ( /* FR_OK(0): successful, !=0: an error occurred */
|
|||
#endif /* FF_FS_EXFAT */
|
||||
{
|
||||
if (ld_word(fs->win + BPB_BytsPerSec) != SS(fs)) {
|
||||
EFSPRINTF("FAT - Sector size does not match physical sector size!");
|
||||
EFSPRINTF("32_SPS");
|
||||
return FR_NO_FILESYSTEM; /* (BPB_BytsPerSec must be equal to the physical sector size) */
|
||||
}
|
||||
|
||||
|
@ -3540,7 +3539,7 @@ FRESULT f_mount (
|
|||
/* Get logical drive number */
|
||||
vol = get_ldnumber(&rp);
|
||||
if (vol < 0) {
|
||||
EFSPRINTF("Invalid drive!");
|
||||
EFSPRINTF("IDRIVE!");
|
||||
return FR_INVALID_DRIVE;
|
||||
}
|
||||
cfs = FatFs[vol]; /* Pointer to fs object */
|
||||
|
@ -3784,11 +3783,11 @@ FRESULT f_read (
|
|||
*br = 0; /* Clear read byte counter */
|
||||
res = validate(&fp->obj, &fs); /* Check validity of the file object */
|
||||
if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) {
|
||||
EFSPRINTF("File object Validation!");
|
||||
EFSPRINTF("FOV");
|
||||
LEAVE_FF(fs, res); /* Check validity */
|
||||
}
|
||||
if (!(fp->flag & FA_READ)) {
|
||||
EFSPRINTF("Access denied!");
|
||||
EFSPRINTF("NOACCESS");
|
||||
LEAVE_FF(fs, FR_DENIED); /* Check access mode */
|
||||
}
|
||||
remain = fp->obj.objsize - fp->fptr;
|
||||
|
@ -3812,18 +3811,17 @@ FRESULT f_read (
|
|||
}
|
||||
}
|
||||
if (clst < 2) {
|
||||
EFSPRINTF("Cluster status check or Internal error!");
|
||||
EFSPRINTF("CCHK");
|
||||
ABORT(fs, FR_INT_ERR);
|
||||
}
|
||||
if (clst == 0xFFFFFFFF) {
|
||||
EFSPRINTF("Disk error (cluster hard error)!");
|
||||
EFSPRINTF("DSKC");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
fp->clust = clst; /* Update current cluster */
|
||||
}
|
||||
sect = clst2sect(fs, fp->clust); /* Get current sector */
|
||||
if (sect == 0) {
|
||||
EFSPRINTF("Get current sector error!");
|
||||
ABORT(fs, FR_INT_ERR);
|
||||
}
|
||||
sect += csect;
|
||||
|
@ -3833,7 +3831,7 @@ FRESULT f_read (
|
|||
cc = fs->csize - csect;
|
||||
}
|
||||
if (disk_read(fs->pdrv, rbuff, sect, cc) != RES_OK) {
|
||||
EFSPRINTF("Read - Low level disk I/O!");
|
||||
EFSPRINTF("RLIO");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
#if !FF_FS_READONLY && FF_FS_MINIMIZE <= 2 /* Replace one of the read sectors with cached data if it contains a dirty sector */
|
||||
|
@ -3855,14 +3853,14 @@ FRESULT f_read (
|
|||
#if !FF_FS_READONLY
|
||||
if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */
|
||||
if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) {
|
||||
EFSPRINTF("Write-back dirty sector cache!");
|
||||
EFSPRINTF("RDC");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
fp->flag &= (BYTE)~FA_DIRTY;
|
||||
}
|
||||
#endif
|
||||
if (disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) {
|
||||
EFSPRINTF("Read - Fill sector cache");
|
||||
EFSPRINTF("RSC");
|
||||
ABORT(fs, FR_DISK_ERR); /* Fill sector cache */
|
||||
}
|
||||
}
|
||||
|
@ -3907,11 +3905,11 @@ FRESULT f_write (
|
|||
*bw = 0; /* Clear write byte counter */
|
||||
res = validate(&fp->obj, &fs); /* Check validity of the file object */
|
||||
if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) {
|
||||
EFSPRINTF("File object Validation!");
|
||||
EFSPRINTF("FOV");
|
||||
LEAVE_FF(fs, res); /* Check validity */
|
||||
}
|
||||
if (!(fp->flag & FA_WRITE)) {
|
||||
EFSPRINTF("Access denied!");
|
||||
EFSPRINTF("NOACCESS");
|
||||
LEAVE_FF(fs, FR_DENIED); /* Check access mode */
|
||||
}
|
||||
|
||||
|
@ -3941,15 +3939,15 @@ FRESULT f_write (
|
|||
}
|
||||
}
|
||||
if (clst == 0) {
|
||||
EFSPRINTF("Could not allocate a new cluster\n(disk full or low level disk I/O error)!");
|
||||
EFSPRINTF("DSKFULL");
|
||||
break; /* Could not allocate a new cluster (disk full) */
|
||||
}
|
||||
if (clst == 1) {
|
||||
EFSPRINTF("Cluster status check or Internal error!");
|
||||
EFSPRINTF("CCHK");
|
||||
ABORT(fs, FR_INT_ERR);
|
||||
}
|
||||
if (clst == 0xFFFFFFFF) {
|
||||
EFSPRINTF("Disk error (cluster hard error)!");
|
||||
EFSPRINTF("DERR");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
fp->clust = clst; /* Update current cluster */
|
||||
|
@ -3966,7 +3964,6 @@ FRESULT f_write (
|
|||
#endif
|
||||
sect = clst2sect(fs, fp->clust); /* Get current sector */
|
||||
if (sect == 0) {
|
||||
EFSPRINTF("Get current sector error!");
|
||||
ABORT(fs, FR_INT_ERR);
|
||||
}
|
||||
sect += csect;
|
||||
|
@ -3976,7 +3973,7 @@ FRESULT f_write (
|
|||
cc = fs->csize - csect;
|
||||
}
|
||||
if (disk_write(fs->pdrv, wbuff, sect, cc) != RES_OK) {
|
||||
EFSPRINTF("Write - Low level disk I/O!");
|
||||
EFSPRINTF("WLIO");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
#if FF_FS_MINIMIZE <= 2
|
||||
|
|
|
@ -619,6 +619,8 @@ int hos_launch(ini_sec_t *cfg)
|
|||
*mb_in = bootStateDramPkg2;
|
||||
*mb_out = 0;
|
||||
|
||||
display_backlight(0);
|
||||
|
||||
// Wait for secmon to get ready.
|
||||
cluster_boot_cpu0(ctxt.pkg1_id->secmon_base);
|
||||
while (!*mb_out)
|
||||
|
|
|
@ -130,3 +130,4 @@ u8 i2c_recv_byte(u32 idx, u32 x, u32 y)
|
|||
i2c_recv_buf_small(&tmp, 1, idx, x, y);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "ff.h"
|
||||
#include "heap.h"
|
||||
|
||||
|
||||
static char *_strdup(char *str)
|
||||
{
|
||||
char *res = malloc(strlen(str) + 1);
|
||||
|
@ -157,6 +156,8 @@ void ini_free(link_t *dst)
|
|||
free(ini_sec->name);
|
||||
free(ini_sec);
|
||||
}
|
||||
|
||||
dst = NULL;
|
||||
}
|
||||
|
||||
ini_sec_t *ini_clone_section(ini_sec_t *cfg)
|
||||
|
@ -190,4 +191,6 @@ void ini_free_section(ini_sec_t *cfg)
|
|||
free(kv);
|
||||
}
|
||||
free(cfg);
|
||||
|
||||
cfg = NULL;
|
||||
}
|
||||
|
|
74
ipl/main.c
74
ipl/main.c
|
@ -246,7 +246,7 @@ void mbist_workaround()
|
|||
I2S(0x388) &= 0xFFFFFFFE;
|
||||
I2S(0x4A0) |= 0x400;
|
||||
I2S(0x488) &= 0xFFFFFFFE;
|
||||
DISPLAY_A(0xCF8) |= 4;
|
||||
DISPLAY_A(_DIREG(DC_COM_DSC_TOP_CTL)) |= 4;
|
||||
VIC(0x8C) = 0xFFFFFFFF;
|
||||
usleep(2);
|
||||
|
||||
|
@ -287,7 +287,7 @@ void config_se_brom()
|
|||
SE(SE_KEY_TABLE_ACCESS_REG_OFFSET + 15 * 4) = 0x7E;
|
||||
// Clear the boot reason to avoid problems later
|
||||
PMC(APBDEV_PMC_SCRATCH200) = 0x0;
|
||||
PMC(APBDEV_PMC_RST_STATUS_0) = 0x0;
|
||||
PMC(APBDEV_PMC_RST_STATUS) = 0x0;
|
||||
}
|
||||
|
||||
void config_hw()
|
||||
|
@ -295,8 +295,8 @@ void config_hw()
|
|||
// Bootrom stuff we skipped by going through rcm.
|
||||
config_se_brom();
|
||||
//FUSE(FUSE_PRIVATEKEYDISABLE) = 0x11;
|
||||
SYSREG(0x110) &= 0xFFFFFF9F;
|
||||
PMC(0x244) = ((PMC(0x244) >> 1) << 1) & 0xFFFFFFFD;
|
||||
SYSREG(AHB_AHB_SPARE_REG) &= 0xFFFFFF9F;
|
||||
PMC(APBDEV_PMC_SCRATCH49) = ((PMC(APBDEV_PMC_SCRATCH49) >> 1) << 1) & 0xFFFFFFFD;
|
||||
|
||||
mbist_workaround();
|
||||
clock_enable_se();
|
||||
|
@ -309,7 +309,7 @@ void config_hw()
|
|||
mc_enable();
|
||||
|
||||
config_oscillators();
|
||||
APB_MISC(0x40) = 0;
|
||||
APB_MISC(APB_MISC_PP_PINMUX_GLOBAL) = 0;
|
||||
config_gpios();
|
||||
|
||||
//clock_enable_uart(UART_C);
|
||||
|
@ -349,7 +349,7 @@ void config_hw()
|
|||
mc_config_carveout();
|
||||
|
||||
sdram_init();
|
||||
//TODO: test this with LP0 wakeup.
|
||||
|
||||
sdram_lp0_save_params(sdram_get_params());
|
||||
}
|
||||
|
||||
|
@ -776,7 +776,7 @@ int dump_emmc_verify(sdmmc_storage_t *storage, u32 lba_curr, char* outFilename,
|
|||
f_close(&fp);
|
||||
return 1;
|
||||
}
|
||||
if (f_read(&fp, bufSd, num << 9, NULL) != FR_OK)
|
||||
if (f_read(&fp, bufSd, num << 9, NULL))
|
||||
{
|
||||
gfx_con.fntsz = 16;
|
||||
EPRINTFARGS("\nFailed to read %d blocks (@LBA %08X),\nfrom sd card!\n\nVerification failed..\n", num, lba_curr);
|
||||
|
@ -1399,8 +1399,11 @@ static void restore_emmc_selected(emmcPartType_t restoreType)
|
|||
gfx_printf(&gfx_con, "Are you really sure?\n\n%k", 0xFFCCCCCC);
|
||||
if ((restoreType & PART_BOOT) || (restoreType & PART_GP_ALL))
|
||||
{
|
||||
gfx_puts(&gfx_con, "The mode you selected will only restore\nthe partitions that it can find.\n");
|
||||
gfx_puts(&gfx_con, "If the appropriate named file is not found,\nit will skip it and continue with the next.\n\n");
|
||||
gfx_puts(&gfx_con, "The mode you selected will only restore\nthe ");
|
||||
if (restoreType & PART_BOOT)
|
||||
gfx_puts(&gfx_con, "boot ");
|
||||
gfx_puts(&gfx_con, "partitions that it can find.\n");
|
||||
gfx_puts(&gfx_con, "If it is not found, it will be skipped\nand continue with the next.\n\n");
|
||||
}
|
||||
gfx_con_getpos(&gfx_con, &gfx_con.savedx, &gfx_con.savedy);
|
||||
|
||||
|
@ -1628,6 +1631,7 @@ void dump_packages12()
|
|||
gfx_printf(&gfx_con, "\n%kKernel CRC32C: %k0x%08X\n\n",0xFFC7EA46, 0xFFCCCCCC, kernel_crc32);
|
||||
gfx_printf(&gfx_con, "%kKernel size: %k0x%05X\n\n", 0xFFC7EA46, 0xFFCCCCCC, pkg2_hdr->sec_size[PKG2_SEC_KERNEL]);
|
||||
gfx_printf(&gfx_con, "%kINI1 size: %k0x%05X\n\n", 0xFFC7EA46, 0xFFCCCCCC, pkg2_hdr->sec_size[PKG2_SEC_INI1]);
|
||||
|
||||
// Dump pkg2.1.
|
||||
if (sd_save_to_file(pkg2, pkg2_hdr->sec_size[PKG2_SEC_KERNEL] + pkg2_hdr->sec_size[PKG2_SEC_INI1],
|
||||
"Backup/pkg2/pkg2_decr.bin"))
|
||||
|
@ -1707,6 +1711,7 @@ void launch_firmware()
|
|||
{
|
||||
free(ments);
|
||||
ini_free(&ini_sections);
|
||||
sd_unmount();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1756,7 +1761,6 @@ void auto_launch_firmware()
|
|||
};
|
||||
|
||||
struct _bmp_data bmpData;
|
||||
int ini_freed = 1;
|
||||
int backlightEnabled = 0;
|
||||
int bootlogoFound = 0;
|
||||
char *bootlogoCustomEntry = NULL;
|
||||
|
@ -1770,7 +1774,6 @@ void auto_launch_firmware()
|
|||
{
|
||||
if (ini_parse(&ini_sections, "hekate_ipl.ini"))
|
||||
{
|
||||
ini_freed = 0;
|
||||
u32 configEntry = 0;
|
||||
u32 boot_entry_id = 0;
|
||||
|
||||
|
@ -1904,7 +1907,6 @@ void auto_launch_firmware()
|
|||
goto out;
|
||||
|
||||
ini_free(&ini_sections);
|
||||
ini_freed = 1;
|
||||
|
||||
#ifdef MENU_LOGO_ENABLE
|
||||
free(Kc_MENU_LOGO);
|
||||
|
@ -1920,8 +1922,7 @@ void auto_launch_firmware()
|
|||
|
||||
out:;
|
||||
gfx_clear_grey(&gfx_ctxt, 0x1B);
|
||||
if (!ini_freed)
|
||||
ini_free(&ini_sections);
|
||||
ini_free(&ini_sections);
|
||||
ini_free_section(cfg_sec);
|
||||
|
||||
sd_unmount();
|
||||
|
@ -2079,14 +2080,17 @@ void print_fuel_gauge_info()
|
|||
max17050_get_property(MAX17050_Age, &value);
|
||||
gfx_printf(&gfx_con, "Age: %3d%\n", value);
|
||||
|
||||
max17050_get_property(MAX17050_Cycles, &value);
|
||||
gfx_printf(&gfx_con, "Charge cycle count: %3d%\n", value);
|
||||
max17050_get_property(MAX17050_RepSOC, &value);
|
||||
gfx_printf(&gfx_con, "Capacity now: %3d%\n", value >> 8);
|
||||
|
||||
max17050_get_property(MAX17050_TEMP, &value);
|
||||
if (value >= 0)
|
||||
gfx_printf(&gfx_con, "Battery temperature: %d.%d oC\n", value / 10, value % 10);
|
||||
else
|
||||
gfx_printf(&gfx_con, "Battery temperature: -%d.%d oC\n", ~value / 10, (~value) % 10);
|
||||
max17050_get_property(MAX17050_RepCap, &value);
|
||||
gfx_printf(&gfx_con, "Capacity now: %4d mAh\n", value);
|
||||
|
||||
max17050_get_property(MAX17050_FullCAP, &value);
|
||||
gfx_printf(&gfx_con, "Capacity full: %4d mAh\n", value);
|
||||
|
||||
max17050_get_property(MAX17050_DesignCap, &value);
|
||||
gfx_printf(&gfx_con, "Capacity (design): %4d mAh\n", value);
|
||||
|
||||
max17050_get_property(MAX17050_Current, &value);
|
||||
if (value >= 0)
|
||||
|
@ -2100,6 +2104,12 @@ void print_fuel_gauge_info()
|
|||
else
|
||||
gfx_printf(&gfx_con, "Current average: -%d mA\n", ~value / 1000);
|
||||
|
||||
max17050_get_property(MAX17050_VCELL, &value);
|
||||
gfx_printf(&gfx_con, "Voltage now: %4d mV\n", value);
|
||||
|
||||
max17050_get_property(MAX17050_OCVInternal, &value);
|
||||
gfx_printf(&gfx_con, "Voltage open-circuit: %4d mV\n", value);
|
||||
|
||||
max17050_get_property(MAX17050_MinVolt, &value);
|
||||
gfx_printf(&gfx_con, "Min voltage reached: %4d mV\n", value);
|
||||
|
||||
|
@ -2109,23 +2119,11 @@ void print_fuel_gauge_info()
|
|||
max17050_get_property(MAX17050_V_empty, &value);
|
||||
gfx_printf(&gfx_con, "Empty voltage (design): %4d mV\n", value);
|
||||
|
||||
max17050_get_property(MAX17050_VCELL, &value);
|
||||
gfx_printf(&gfx_con, "Voltage now: %4d mV\n", value);
|
||||
|
||||
max17050_get_property(MAX17050_OCVInternal, &value);
|
||||
gfx_printf(&gfx_con, "Voltage open-circuit: %4d mV\n", value);
|
||||
|
||||
max17050_get_property(MAX17050_RepSOC, &value);
|
||||
gfx_printf(&gfx_con, "Capacity now: %3d%\n", value >> 8);
|
||||
|
||||
max17050_get_property(MAX17050_RepCap, &value);
|
||||
gfx_printf(&gfx_con, "Capacity now: %4d mAh\n", value);
|
||||
|
||||
max17050_get_property(MAX17050_FullCAP, &value);
|
||||
gfx_printf(&gfx_con, "Capacity full: %4d mAh\n", value);
|
||||
|
||||
max17050_get_property(MAX17050_DesignCap, &value);
|
||||
gfx_printf(&gfx_con, "Capacity (design): %4d mAh\n", value);
|
||||
max17050_get_property(MAX17050_TEMP, &value);
|
||||
if (value >= 0)
|
||||
gfx_printf(&gfx_con, "Battery temperature: %d.%d oC\n", value / 10, value % 10);
|
||||
else
|
||||
gfx_printf(&gfx_con, "Battery temperature: -%d.%d oC\n", ~value / 10, (~value) % 10);
|
||||
}
|
||||
|
||||
void print_battery_charger_info()
|
||||
|
|
|
@ -19,11 +19,6 @@
|
|||
#include "i2c.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "gfx.h"
|
||||
extern gfx_ctxt_t gfx_ctxt;
|
||||
extern gfx_con_t gfx_con;
|
||||
#define DPRINTF(...) gfx_printf(&gfx_con, __VA_ARGS__)
|
||||
|
||||
#define REGULATOR_SD 0
|
||||
#define REGULATOR_LDO 1
|
||||
|
||||
|
|
|
@ -29,22 +29,22 @@
|
|||
#define APBDEV_PMC_DDR_PWR 0xE8
|
||||
#define APBDEV_PMC_CRYPTO_OP 0xF4
|
||||
#define APBDEV_PMC_OSC_EDPD_OVER 0x1A4
|
||||
#define APBDEV_PMC_RST_STATUS 0x1B4
|
||||
#define APBDEV_PMC_IO_DPD_REQ 0x1B8
|
||||
#define APBDEV_PMC_IO_DPD2_REQ 0x1C0
|
||||
#define APBDEV_PMC_VDDP_SEL 0x1CC
|
||||
#define APBDEV_PMC_SCRATCH49 0x244
|
||||
#define APBDEV_PMC_TSC_MULT 0x2B4
|
||||
#define APBDEV_PMC_REG_SHORT 0x2CC
|
||||
#define APBDEV_PMC_WEAK_BIAS 0x2C8
|
||||
#define APBDEV_PMC_SECURE_SCRATCH21 0x334
|
||||
#define APBDEV_PMC_SECURE_SCRATCH32 0x360
|
||||
#define APBDEV_PMC_SECURE_SCRATCH49 0x3A4
|
||||
#define APBDEV_PMC_CNTRL2 0x440
|
||||
#define APBDEV_PMC_IO_DPD4_REQ 0x464
|
||||
#define APBDEV_PMC_DDR_CNTRL 0x4E4
|
||||
#define APBDEV_PMC_SCRATCH188 0x810
|
||||
#define APBDEV_PMC_SCRATCH190 0x818
|
||||
#define APBDEV_PMC_SCRATCH200 0x840
|
||||
#define APBDEV_PMC_RST_STATUS_0 0x1B4
|
||||
#define APBDEV_PMC_SECURE_SCRATCH49_0 0x3A4
|
||||
#define APBDEV_PMC_SCRATCH49_0 0x244
|
||||
|
||||
#endif
|
||||
|
|
|
@ -90,8 +90,12 @@
|
|||
#define MIPI_CAL(off) _REG(MIPI_CAL_BASE, off)
|
||||
#define I2S(off) _REG(I2S_BASE, off)
|
||||
|
||||
/*! Misc registers. */
|
||||
#define APB_MISC_PP_PINMUX_GLOBAL 0x40
|
||||
|
||||
/*! System registers. */
|
||||
#define AHB_ARBITRATION_XBAR_CTRL 0xE0
|
||||
#define AHB_AHB_SPARE_REG 0x110
|
||||
|
||||
/*! Secure boot registers. */
|
||||
#define SB_CSR 0x0
|
||||
|
|
|
@ -59,10 +59,10 @@ void tui_sbar(gfx_con_t *con, int force_update)
|
|||
|
||||
if (battVoltCurr >= 0)
|
||||
gfx_printf(con, " %k+%d mA %k%K\n",
|
||||
0xFF008000, battVoltCurr / 1000, 0xFFCCCCCC, 0xFF1B1B1B);
|
||||
0xFF008800, battVoltCurr / 1000, 0xFFCCCCCC, 0xFF1B1B1B);
|
||||
else
|
||||
gfx_printf(con, " %k-%d mA %k%K\n",
|
||||
0xFF800000, (~battVoltCurr) / 1000, 0xFFCCCCCC, 0xFF1B1B1B);
|
||||
0xFF880000, (~battVoltCurr) / 1000, 0xFFCCCCCC, 0xFF1B1B1B);
|
||||
con->fntsz = prevFontSize;
|
||||
gfx_con_setpos(con, con->savedx, con->savedy);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue