diff mbox

[U-Boot,v5,5/5] samsung: misc: remove download mode info screen

Message ID 1398857290-22028-5-git-send-email-p.marczak@samsung.com
State Accepted
Delegated to: Minkyu Kang
Headers show

Commit Message

Przemyslaw Marczak April 30, 2014, 11:28 a.m. UTC
This change removes LCD menu download mode info screen.
Now key press timeout is checked in function download_menu()
and menu options are displayed directly after PWR + VOLUP keys.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>

---
Changes v4:
- new commit

Changes v5:
- none

---
 board/samsung/common/misc.c | 73 +++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 42 deletions(-)

Comments

Minkyu Kang May 5, 2014, 1:27 p.m. UTC | #1
Dear Przemyslaw Marczak,


On 30 April 2014 20:28, Przemyslaw Marczak <p.marczak@samsung.com> wrote:

> This change removes LCD menu download mode info screen.
> Now key press timeout is checked in function download_menu()
> and menu options are displayed directly after PWR + VOLUP keys.
>
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
>
> ---
> Changes v4:
> - new commit
>
> Changes v5:
> - none
>
> ---
>  board/samsung/common/misc.c | 73
> +++++++++++++++++++--------------------------
>  1 file changed, 31 insertions(+), 42 deletions(-)
>
> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> index 2ea275e..03106fd 100644
> --- a/board/samsung/common/misc.c
> +++ b/board/samsung/common/misc.c
> @@ -261,7 +261,7 @@ static void display_download_menu(int mode)
>         selection[mode] = "[=>]";
>
>         lcd_clear();
> -       lcd_printf("\n\t\tDownload Mode Menu\n");
> +       lcd_printf("\n\n\t\tDownload Mode Menu\n\n");
>
>         for (i = 0; i <= BOOT_MODE_EXIT; i++)
>                 lcd_printf("\t%s  %s - %s\n\n", selection[i],
> @@ -274,10 +274,38 @@ static void download_menu(void)
>         int mode = 0;
>         int last_mode = 0;
>         int run;
> -       int key;
> +       int key = 0;
> +       int timeout = 15; /* sec */
> +       int i;
>
>         display_download_menu(mode);
>
> +       lcd_puts("\n");
> +
> +       /* Start count if no key is pressed */
> +       while (check_keys())
> +               continue;
> +
> +       while (timeout--) {
> +               lcd_printf("\r\tNormal boot will start in: %2.d seconds.",
> +                          timeout);
> +
> +               /* about 1000 ms in for loop */
> +               for (i = 0; i < 10; i++) {
> +                       mdelay(100);
> +                       key = check_keys();
> +                       if (key)
> +                               break;
> +               }
> +               if (key)
>

maybe, unnecessary if statement.


> +                       break;
> +       }
> +
> +       if (!key) {
> +               lcd_clear();
> +               return;
> +       }
> +
>         while (1) {
>                 run = 0;
>
> @@ -315,45 +343,6 @@ static void download_menu(void)
>         lcd_clear();
>  }
>
> -static void display_mode_info(void)
> -{
> -       lcd_position_cursor(4, 4);
> -       lcd_printf("%s\n", U_BOOT_VERSION);
> -       lcd_puts("\nDownload Mode Menu\n");
> -#ifdef CONFIG_SYS_BOARD
> -       lcd_printf("Board name: %s\n", CONFIG_SYS_BOARD);
> -#endif
> -       lcd_printf("Press POWER KEY to display MENU options.");
> -}
> -
> -static int boot_menu(void)
> -{
> -       int key = 0;
> -       int timeout = 10;
> -
> -       display_mode_info();
> -
> -       while (timeout--) {
> -               lcd_printf("\rNormal boot will start in: %d seconds.",
> timeout);
> -               mdelay(1000);
> -
> -               key = key_pressed(KEY_POWER);
> -               if (key)
> -                       break;
> -       }
> -
> -       lcd_clear();
> -
> -       /* If PWR pressed - show download menu */
> -       if (key) {
> -               printf("Power pressed - go to download menu\n");
> -               download_menu();
> -               printf("Download mode exit.\n");
> -       }
> -
> -       return 0;
> -}
> -
>  void check_boot_mode(void)
>  {
>         int pwr_key;
> @@ -366,7 +355,7 @@ void check_boot_mode(void)
>         power_key_pressed(KEY_PWR_INTERRUPT_REG);
>
>         if (key_pressed(KEY_VOLUMEUP))
> -               boot_menu();
> +               download_menu();
>         else if (key_pressed(KEY_VOLUMEDOWN))
>                 mode_leave_menu(BOOT_MODE_THOR);
>  }
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>

Thanks,
Minkyu Kang.
Przemyslaw Marczak May 6, 2014, 8:45 a.m. UTC | #2
Hello Minkyu,

On 05/05/2014 03:27 PM, Minkyu Kang wrote:
> Dear Przemyslaw Marczak,
>
>
> On 30 April 2014 20:28, Przemyslaw Marczak <p.marczak@samsung.com
> <mailto:p.marczak@samsung.com>> wrote:
>
>     This change removes LCD menu download mode info screen.
>     Now key press timeout is checked in function download_menu()
>     and menu options are displayed directly after PWR + VOLUP keys.
>
>     Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com
>     <mailto:p.marczak@samsung.com>>
>     Cc: Minkyu Kang <mk7.kang@samsung.com <mailto:mk7.kang@samsung.com>>
>
>     ---
>     Changes v4:
>     - new commit
>
>     Changes v5:
>     - none
>
>     ---
>       board/samsung/common/misc.c | 73
>     +++++++++++++++++++--------------------------
>       1 file changed, 31 insertions(+), 42 deletions(-)
>
>     diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>     index 2ea275e..03106fd 100644
>     --- a/board/samsung/common/misc.c
>     +++ b/board/samsung/common/misc.c
>     @@ -261,7 +261,7 @@ static void display_download_menu(int mode)
>              selection[mode] = "[=>]";
>
>              lcd_clear();
>     -       lcd_printf("\n\t\tDownload Mode Menu\n");
>     +       lcd_printf("\n\n\t\tDownload Mode Menu\n\n");
>
>              for (i = 0; i <= BOOT_MODE_EXIT; i++)
>                      lcd_printf("\t%s  %s - %s\n\n", selection[i],
>     @@ -274,10 +274,38 @@ static void download_menu(void)
>              int mode = 0;
>              int last_mode = 0;
>              int run;
>     -       int key;
>     +       int key = 0;
>     +       int timeout = 15; /* sec */
>     +       int i;
>
>              display_download_menu(mode);
>
>     +       lcd_puts("\n");
>     +
>     +       /* Start count if no key is pressed */
>     +       while (check_keys())
>     +               continue;
>     +
>     +       while (timeout--) {
>     +               lcd_printf("\r\tNormal boot will start in: %2.d
>     seconds.",
>     +                          timeout);
>     +
>     +               /* about 1000 ms in for loop */
>     +               for (i = 0; i < 10; i++) {
>     +                       mdelay(100);
>     +                       key = check_keys();
>     +                       if (key)
>     +                               break;
>     +               }
>     +               if (key)
>
>
> maybe, unnecessary if statement.
>

Please take a notice that there are two loops: "while" and "for",
so the second "if (key)" is necessary for break a "while" loop on "user 
event".

>     +                       break;
>     +       }
>     +
>     +       if (!key) {
>     +               lcd_clear();
>     +               return;
>     +       }
>     +
>              while (1) {
>                      run = 0;
>
>     @@ -315,45 +343,6 @@ static void download_menu(void)
>              lcd_clear();
>       }
>
>     -static void display_mode_info(void)
>     -{
>     -       lcd_position_cursor(4, 4);
>     -       lcd_printf("%s\n", U_BOOT_VERSION);
>     -       lcd_puts("\nDownload Mode Menu\n");
>     -#ifdef CONFIG_SYS_BOARD
>     -       lcd_printf("Board name: %s\n", CONFIG_SYS_BOARD);
>     -#endif
>     -       lcd_printf("Press POWER KEY to display MENU options.");
>     -}
>     -
>     -static int boot_menu(void)
>     -{
>     -       int key = 0;
>     -       int timeout = 10;
>     -
>     -       display_mode_info();
>     -
>     -       while (timeout--) {
>     -               lcd_printf("\rNormal boot will start in: %d
>     seconds.", timeout);
>     -               mdelay(1000);
>     -
>     -               key = key_pressed(KEY_POWER);
>     -               if (key)
>     -                       break;
>     -       }
>     -
>     -       lcd_clear();
>     -
>     -       /* If PWR pressed - show download menu */
>     -       if (key) {
>     -               printf("Power pressed - go to download menu\n");
>     -               download_menu();
>     -               printf("Download mode exit.\n");
>     -       }
>     -
>     -       return 0;
>     -}
>     -
>       void check_boot_mode(void)
>       {
>              int pwr_key;
>     @@ -366,7 +355,7 @@ void check_boot_mode(void)
>              power_key_pressed(KEY_PWR_INTERRUPT_REG);
>
>              if (key_pressed(KEY_VOLUMEUP))
>     -               boot_menu();
>     +               download_menu();
>              else if (key_pressed(KEY_VOLUMEDOWN))
>                      mode_leave_menu(BOOT_MODE_THOR);
>       }
>     --
>     1.9.1
>
>     _______________________________________________
>     U-Boot mailing list
>     U-Boot@lists.denx.de <mailto:U-Boot@lists.denx.de>
>     http://lists.denx.de/mailman/listinfo/u-boot
>
>
> Thanks,
> Minkyu Kang.
> --
> from. prom.
> www.promsoft.net <http://www.promsoft.net>

Thank you
Minkyu Kang May 7, 2014, 8:07 a.m. UTC | #3
Dear Przemyslaw Marczak,

On 06/05/14 17:45, Przemyslaw Marczak wrote:
> Hello Minkyu,
> 
> On 05/05/2014 03:27 PM, Minkyu Kang wrote:
>> Dear Przemyslaw Marczak,
>>
>>
>> On 30 April 2014 20:28, Przemyslaw Marczak <p.marczak@samsung.com
>> <mailto:p.marczak@samsung.com>> wrote:
>>
>>     This change removes LCD menu download mode info screen.
>>     Now key press timeout is checked in function download_menu()
>>     and menu options are displayed directly after PWR + VOLUP keys.
>>
>>     Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com
>>     <mailto:p.marczak@samsung.com>>
>>     Cc: Minkyu Kang <mk7.kang@samsung.com <mailto:mk7.kang@samsung.com>>
>>
>>     ---
>>     Changes v4:
>>     - new commit
>>
>>     Changes v5:
>>     - none
>>
>>     ---
>>       board/samsung/common/misc.c | 73
>>     +++++++++++++++++++--------------------------
>>       1 file changed, 31 insertions(+), 42 deletions(-)
>>
>>     diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>>     index 2ea275e..03106fd 100644
>>     --- a/board/samsung/common/misc.c
>>     +++ b/board/samsung/common/misc.c
>>     @@ -261,7 +261,7 @@ static void display_download_menu(int mode)
>>              selection[mode] = "[=>]";
>>
>>              lcd_clear();
>>     -       lcd_printf("\n\t\tDownload Mode Menu\n");
>>     +       lcd_printf("\n\n\t\tDownload Mode Menu\n\n");
>>
>>              for (i = 0; i <= BOOT_MODE_EXIT; i++)
>>                      lcd_printf("\t%s  %s - %s\n\n", selection[i],
>>     @@ -274,10 +274,38 @@ static void download_menu(void)
>>              int mode = 0;
>>              int last_mode = 0;
>>              int run;
>>     -       int key;
>>     +       int key = 0;
>>     +       int timeout = 15; /* sec */
>>     +       int i;
>>
>>              display_download_menu(mode);
>>
>>     +       lcd_puts("\n");
>>     +
>>     +       /* Start count if no key is pressed */
>>     +       while (check_keys())
>>     +               continue;
>>     +
>>     +       while (timeout--) {
>>     +               lcd_printf("\r\tNormal boot will start in: %2.d
>>     seconds.",
>>     +                          timeout);
>>     +
>>     +               /* about 1000 ms in for loop */
>>     +               for (i = 0; i < 10; i++) {
>>     +                       mdelay(100);
>>     +                       key = check_keys();
>>     +                       if (key)
>>     +                               break;
>>     +               }
>>     +               if (key)
>>
>>
>> maybe, unnecessary if statement.
>>
> 
> Please take a notice that there are two loops: "while" and "for",
> so the second "if (key)" is necessary for break a "while" loop on "user event".

Ah, I see :)
actually, I doubt that need to two loops... anyway OK.

Thanks,
Minkyu Kang.
Minkyu Kang May 8, 2014, 2:36 a.m. UTC | #4
On 30/04/14 20:28, Przemyslaw Marczak wrote:
> This change removes LCD menu download mode info screen.
> Now key press timeout is checked in function download_menu()
> and menu options are displayed directly after PWR + VOLUP keys.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> 
> ---
> Changes v4:
> - new commit
> 
> Changes v5:
> - none
> 
> ---
>  board/samsung/common/misc.c | 73 +++++++++++++++++++--------------------------
>  1 file changed, 31 insertions(+), 42 deletions(-)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.
diff mbox

Patch

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 2ea275e..03106fd 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -261,7 +261,7 @@  static void display_download_menu(int mode)
 	selection[mode] = "[=>]";
 
 	lcd_clear();
-	lcd_printf("\n\t\tDownload Mode Menu\n");
+	lcd_printf("\n\n\t\tDownload Mode Menu\n\n");
 
 	for (i = 0; i <= BOOT_MODE_EXIT; i++)
 		lcd_printf("\t%s  %s - %s\n\n", selection[i],
@@ -274,10 +274,38 @@  static void download_menu(void)
 	int mode = 0;
 	int last_mode = 0;
 	int run;
-	int key;
+	int key = 0;
+	int timeout = 15; /* sec */
+	int i;
 
 	display_download_menu(mode);
 
+	lcd_puts("\n");
+
+	/* Start count if no key is pressed */
+	while (check_keys())
+		continue;
+
+	while (timeout--) {
+		lcd_printf("\r\tNormal boot will start in: %2.d seconds.",
+			   timeout);
+
+		/* about 1000 ms in for loop */
+		for (i = 0; i < 10; i++) {
+			mdelay(100);
+			key = check_keys();
+			if (key)
+				break;
+		}
+		if (key)
+			break;
+	}
+
+	if (!key) {
+		lcd_clear();
+		return;
+	}
+
 	while (1) {
 		run = 0;
 
@@ -315,45 +343,6 @@  static void download_menu(void)
 	lcd_clear();
 }
 
-static void display_mode_info(void)
-{
-	lcd_position_cursor(4, 4);
-	lcd_printf("%s\n", U_BOOT_VERSION);
-	lcd_puts("\nDownload Mode Menu\n");
-#ifdef CONFIG_SYS_BOARD
-	lcd_printf("Board name: %s\n", CONFIG_SYS_BOARD);
-#endif
-	lcd_printf("Press POWER KEY to display MENU options.");
-}
-
-static int boot_menu(void)
-{
-	int key = 0;
-	int timeout = 10;
-
-	display_mode_info();
-
-	while (timeout--) {
-		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
-		mdelay(1000);
-
-		key = key_pressed(KEY_POWER);
-		if (key)
-			break;
-	}
-
-	lcd_clear();
-
-	/* If PWR pressed - show download menu */
-	if (key) {
-		printf("Power pressed - go to download menu\n");
-		download_menu();
-		printf("Download mode exit.\n");
-	}
-
-	return 0;
-}
-
 void check_boot_mode(void)
 {
 	int pwr_key;
@@ -366,7 +355,7 @@  void check_boot_mode(void)
 	power_key_pressed(KEY_PWR_INTERRUPT_REG);
 
 	if (key_pressed(KEY_VOLUMEUP))
-		boot_menu();
+		download_menu();
 	else if (key_pressed(KEY_VOLUMEDOWN))
 		mode_leave_menu(BOOT_MODE_THOR);
 }