lib: tizen: thor screen update
authorPrzemyslaw Marczak <p.marczak@samsung.com>
Wed, 2 Apr 2014 14:13:59 +0000 (16:13 +0200)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 4 Apr 2017 09:17:15 +0000 (18:17 +0900)
Now cable connection message is displayed on thor screen.
When cable is connected then only unneeded lcd console lines are overwritten.

Main changes:
- add new function: draw_thor_connected()
- update function draw_thor_screen()
- usb: gadget: thor:
  - move call to draw_thor_screen(),
  - add call to draw_thor_connected()

other change:
- remove draw_thor_init_screen() function

Changes for v2015.04-rc1:
- Replace <lcd.h> to <lcd_console.h>

Changes for v2015.10-rc5
- correct usage of removed typedef 'bmp_image_t'

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
drivers/usb/gadget/f_thor.c
include/libtizen.h
lib/tizen/tizen.c

index e3a2aed..e2c5d04 100644 (file)
@@ -719,6 +719,7 @@ int thor_init(void)
 #ifdef CONFIG_TIZEN
 #ifdef CONFIG_LCD      /* TODO : Need to enable LCD*/
        draw_thor_init_screen();
+       draw_thor_screen();
 #endif
 #endif
        /* Wait for a device enumeration and configuration settings */
@@ -738,6 +739,7 @@ int thor_init(void)
 #ifdef CONFIG_TIZEN
 #ifdef CONFIG_LCD      /* TODO : Need to enable LCD*/
        draw_thor_screen();
+       draw_thor_connected();
 #endif
 #endif
        thor_set_dma(thor_rx_data_buf, strlen("THOR"));
index 2560cbc..911fcd3 100644 (file)
@@ -15,8 +15,8 @@
 #ifdef CONFIG_LCD
 void get_tizen_logo_info(vidinfo_t *vid);
 void draw_thor_progress(unsigned long long int total_file_size, unsigned long long int downloaded_file_size);
-void draw_thor_init_screen(void);
 void draw_thor_screen(void);
+void draw_thor_connected(void);
 void draw_thor_fail_screen(void);
 void draw_thor_cable_info(void);
 #endif
index f804fbd..0c856aa 100644 (file)
@@ -8,7 +8,6 @@
 #include <common.h>
 #include <lcd.h>
 #include <malloc.h>
-#include <lcd.h>
 #include <version.h>
 #include <libtizen.h>
 
@@ -63,11 +62,25 @@ void draw_thor_fail_screen(void)
        bmp_display((unsigned long)download_fail_text, x, y);
 }
 
-void draw_thor_init_screen(void)
+static unsigned int tmp_msg_x, tmp_msg_y;
+
+void draw_thor_connected(void)
 {
-       lcd_clear();
-       lcd_printf("\n\n\tConnect USB cable for start THOR.");
-       lcd_printf("\n\n\tFor EXIT press POWERKEY 3 times.\n");
+       unsigned int prev_console_x, prev_console_y;
+
+       /* Get curent lcd xy */
+       lcd_get_position_cursor(&prev_console_x, &prev_console_y);
+
+       /* Set proper lcd xy position for clean unneeded messages */
+       lcd_set_position_cursor(tmp_msg_x, tmp_msg_y);
+       lcd_puts("\n\n                                          ");
+       lcd_puts("\n\n                                          ");
+
+       lcd_set_position_cursor(tmp_msg_x, tmp_msg_y);
+       lcd_printf("\n\n\tConnection established.");
+
+       /* Restore last lcd x y position */
+       lcd_set_position_cursor(prev_console_x, prev_console_y);
 }
 
 void draw_thor_screen(void)
@@ -75,6 +88,22 @@ void draw_thor_screen(void)
        int x, y;
 
        lcd_clear();
+       lcd_printf("\n\n\tTHOR Tizen Downloader");
+
+       lcd_printf("\n\n\tU-BOOT bootloader info:");
+       lcd_printf("\n\tCompilation date: %s\n\tBinary version: %s\n",
+                  U_BOOT_DATE, PLAIN_VERSION);
+
+       char *pit_compatible = getenv("dfu_alt_pit_compatible");
+       if (pit_compatible) {
+               lcd_printf("\tPlatform compatible with PIT Version: %s\n",
+                          pit_compatible);
+       };
+
+       lcd_get_position_cursor(&tmp_msg_x, &tmp_msg_y);
+
+       lcd_printf("\n\n\tPlease connect USB cable.");
+       lcd_printf("\n\n\tFor EXIT press POWERKEY 3 times.\n");
 
        x = 199 + LOGO_X_OFS;
        y = 272 + LOGO_Y_OFS;
@@ -91,21 +120,12 @@ void draw_thor_screen(void)
 
        bmp_display((unsigned long)prog_base, x, y);
 
-       lcd_printf("%s (%s)\n", U_BOOT_VERSION, U_BOOT_DATE);
-
-       lcd_printf("\nConnection established\n");
-
-       char *pit_compatible = getenv("dfu_alt_pit_compatible");
-       if (pit_compatible) {
-               lcd_printf("Platform compatible with PIT Version: %s\n",
-                          pit_compatible);
-       };
 }
 
 void draw_thor_progress(unsigned long long int total_file_size,
                   unsigned long long int downloaded_file_size)
 {
-       static bmp_image_t *progress_bar = NULL;
+       static struct bmp_image *progress_bar = NULL;
        static int last_percent;
 
        void *bar_bitmap;
@@ -141,7 +161,7 @@ void draw_thor_progress(unsigned long long int total_file_size,
                                          NULL, &bar_bitmap);
 
        if (!progress_bar)
-               progress_bar = (bmp_image_t *)prog_middle;
+               progress_bar = (struct bmp_image *)prog_middle;
 
        /* set bar position */
        x = 40 + LOGO_X_OFS;