build/patch/u-boot/u-boot-pine64-default/change-bmp-display-functions.patch
2017-08-19 17:09:34 +03:00

137 lines
4.4 KiB
Diff

diff --git a/board/sunxi/common/power_check.c b/board/sunxi/common/power_check.c
index d427081ad2..12aa7d94ba 100644
--- a/board/sunxi/common/power_check.c
+++ b/board/sunxi/common/power_check.c
@@ -57,8 +59,8 @@ static void EnterNormalShutDownMode(void)
static void EnterLowPowerShutDownMode(void)
{
- printf("battery ratio is low without dc or ac, should be ShowDown\n");
- sunxi_bmp_display("bat\\low_pwr.bmp");
+ printf("Warning: Low battery power, shutting down\n");
+ sunxi_bmp_display("bat/low_pwr.bmp");
__msdelay(3000);
sunxi_board_shutdown();
for(;;);
@@ -66,8 +68,8 @@ static void EnterLowPowerShutDownMode(void)
static void EnterShutDownWithChargeMode(void)
{
- printf("battery low power and vol with dc or ac, should charge longer\n");
- sunxi_bmp_display("bat\\bempty.bmp");
+ printf("Warning: Low battery power, shutting down to recharge\n");
+ sunxi_bmp_display("bat/bempty.bmp");
__msdelay(3000);
sunxi_board_shutdown();
for(;;);
@@ -75,8 +77,8 @@ static void EnterShutDownWithChargeMode(void)
static void EnterAndroidChargeMode(void)
{
- printf("sunxi_bmp_charger_display\n");
- sunxi_bmp_display("bat\\battery_charge.bmp");
+ printf("Warning: shutting down\n");
+ sunxi_bmp_display("bat/battery_charge.bmp");
#if 1 /* shutdowon instead of update charge variable */
__msdelay(3000);
sunxi_board_shutdown();
@@ -88,12 +90,10 @@ static void EnterAndroidChargeMode(void)
static void EnterNormalBootMode(void)
{
- printf("sunxi_bmp_logo_display\n");
+ /* printf("sunxi_bmp_logo_display\n"); */
sunxi_bmp_display("bootlogo.bmp");
}
-
-
int ProbePreSystemMode(void)
{
int PreSysMode = 0;
diff --git a/common/cmd_sunxi_bmp.c b/common/cmd_sunxi_bmp.c
index 59f1210dc1..bfcefca44e 100644
--- a/common/cmd_sunxi_bmp.c
+++ b/common/cmd_sunxi_bmp.c
@@ -31,6 +31,8 @@
#include <malloc.h>
#include <sunxi_bmp.h>
#include <sunxi_board.h>
+#include <fs.h>
+#include <vsprintf.h>
static int sunxi_bmp_probe_info (uint addr);
static int sunxi_bmp_show(sunxi_bmp_store_t bmp_info);
@@ -179,42 +181,43 @@ U_BOOT_CMD(
int sunxi_bmp_display(char *name)
{
-
- sunxi_bmp_store_t bmp_info;
+ sunxi_bmp_store_t bmp_info;
char bmp_name[32];
- char bmp_addr[32] = {0};
- char* bmp_buff = NULL;
+ char *bmp_buff = NULL;
int ret = -1;
//const size_t bmp_buff_len = 10<<20; //10M
//size_t file_size = 0;
- char * bmp_argv[6] = { "fatload", "mmc", getenv("boot_part"), "00000000", bmp_name, NULL };
// free() function will take a long time,so not use malloc memory
- bmp_buff = (char*)CONFIG_SYS_SDRAM_BASE;
- if(bmp_buff == NULL)
+ bmp_buff = (char*)CONFIG_SYS_SDRAM_BASE;
+ if (bmp_buff == NULL)
{
printf("sunxi bmp: alloc buffer for %s fail\n", name);
return -1;
}
//set bmp decode addr is CONFIG_SYS_SDRAM_BASE
- sprintf(bmp_addr,"%lx", (ulong)bmp_buff);
- bmp_argv[3] = bmp_addr;
+ if (fs_set_blk_dev("mmc", getenv("boot_part"), FS_TYPE_ANY))
+ return -1;
- memset(bmp_name, 0, 32);
- strcpy(bmp_name, name);
- if(do_fat_fsload(0, 0, 5, bmp_argv))
+ snprintf(bmp_name, 32, "%s", name);
+ if (!file_exists("mmc", getenv("boot_part"), bmp_name, FS_TYPE_ANY))
{
- printf("sunxi bmp info error : unable to open logo file %s\n", bmp_argv[4]);
- return -1;
+ snprintf(bmp_name, 32, "/boot/%s", name);
+ if (!file_exists("mmc", getenv("boot_part"), bmp_name, FS_TYPE_ANY))
+ {
+ printf("sunxi bmp: unable to open file %s\n", bmp_name);
+ return -1;
+ }
}
- //file_size = simple_strtoul(getenv("filesize"), NULL, 16);
-
+ if (fs_set_blk_dev("mmc", getenv("boot_part"), FS_TYPE_ANY))
+ return -1;
+ fs_read(bmp_name, (ulong)bmp_buff, 0, 0);
#if defined(CONFIG_SUNXI_LOGBUFFER)
bmp_info.buffer = (void *)(CONFIG_SYS_SDRAM_BASE + gd->ram_size - SUNXI_DISPLAY_FRAME_BUFFER_SIZE);
#else
bmp_info.buffer = (void *)(SUNXI_DISPLAY_FRAME_BUFFER_ADDR);
#endif
- printf("bmp file buffer: 0x%lx, bmp_info.buffer: %lx\n",(ulong)bmp_buff,(ulong)bmp_info.buffer);
+ /* printf("bmp file buffer: 0x%lx, bmp_info.buffer: %lx\n",(ulong)bmp_buff,(ulong)bmp_info.buffer); */
if(!sunxi_bmp_decode((ulong)bmp_buff, &bmp_info))
{
debug("decode bmp ok\n");
diff --git a/include/configs/sun50iw1p1.h b/include/configs/sun50iw1p1.h
index 62eeeb1b29..80ab660011 100644
--- a/include/configs/sun50iw1p1.h
+++ b/include/configs/sun50iw1p1.h
@@ -444,6 +444,7 @@
#define CONFIG_CMD_ECHO
#define CONFIG_CMD_SOURCE
#define CONFIG_CMD_SUNXI_UMS
+#define CONFIG_SYS_VSNPRINTF
#define CONFIG_PINE64_MODEL
#define CONFIG_PINE64_MODEL_PINEBOOK_DETECTION