summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInha Song <ideal.song@samsung.com>2013-10-11 17:50:24 +0900
committerJoonyoung Shim <jy0922.shim@samsung.com>2015-01-15 15:35:38 +0900
commitb5c74257e493e65b273b7331bc7a6ec5c31070bc (patch)
treef656288be8ea21202e7d557a41bd0a626bc1be2c
parent651de3ee577d90ad888200cda277f4ef4ce935dc (diff)
downloadu-boot-b5c74257e493e65b273b7331bc7a6ec5c31070bc.tar.gz
u-boot-b5c74257e493e65b273b7331bc7a6ec5c31070bc.tar.bz2
u-boot-b5c74257e493e65b273b7331bc7a6ec5c31070bc.zip
usb: thor: add screen support
cmd_thordown.c: - add libtizen header - change error handling for thor init - add call to draw_thor_fail_screen() on error f_thor.c: - thor_init(): return -EINTR on ctrl+c or if power key was pressed 3 times - thor_rx_data(): return -EINTR when pressed ctrl+c on data receiving - add display simple info screen before cable is not connected - add display download screen when connection is established - update download progress bar if data receiving Change-Id: Ia89ef48c6c2faa5eda5dda5c5b3951e675eec03b Signed-off-by: Inha Song <ideal.song@samsung.com> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
-rw-r--r--common/cmd_thordown.c13
-rw-r--r--drivers/usb/gadget/f_thor.c43
2 files changed, 52 insertions, 4 deletions
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index 8ed1dc6f9e..18a84cf243 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -12,6 +12,7 @@
#include <dfu.h>
#include <g_dnl.h>
#include <usb.h>
+#include <libtizen.h>
int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
@@ -43,7 +44,11 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ret = thor_init();
if (ret) {
error("THOR DOWNLOAD failed: %d", ret);
- ret = CMD_RET_FAILURE;
+ if (ret == -EINTR)
+ ret = CMD_RET_SUCCESS;
+ else
+ ret = CMD_RET_FAILURE;
+
goto exit;
}
@@ -59,6 +64,12 @@ exit:
done:
dfu_free_entities();
+#ifdef CONFIG_TIZEN
+ if (ret != CMD_RET_SUCCESS)
+ draw_thor_fail_screen();
+ else
+ lcd_clear();
+#endif
return ret;
}
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index 2d0410d795..21c93c9df5 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -25,6 +25,10 @@
#include <linux/usb/cdc.h>
#include <g_dnl.h>
#include <dfu.h>
+#include <libtizen.h>
+#include <samsung/misc.h>
+#include <linux/input.h>
+#include <usb.h>
#include "f_thor.h"
@@ -48,6 +52,10 @@ DEFINE_CACHE_ALIGN_BUFFER(unsigned char, thor_rx_data_buf,
/* ********************************************************** */
DEFINE_CACHE_ALIGN_BUFFER(char, f_name, F_NAME_BUF_SIZE);
static unsigned long long int thor_file_size;
+#ifdef CONFIG_TIZEN
+static unsigned long long int total_file_size;
+static unsigned long long int downloaded_file_size;
+#endif
static int alt_setting_num;
static void send_rsp(const struct rsp_box *rsp)
@@ -123,6 +131,7 @@ static int process_rqt_cmd(const struct rqt_box *rqt)
send_rsp(rsp);
g_dnl_unregister();
dfu_free_entities();
+
run_command("reset", 0);
break;
case RQT_CMD_POWEROFF:
@@ -259,6 +268,10 @@ static long long int process_rqt_download(const struct rqt_box *rqt)
switch (rqt->rqt_data) {
case RQT_DL_INIT:
thor_file_size = rqt->int_data[0];
+#ifdef CONFIG_TIZEN
+ total_file_size = thor_file_size;
+ downloaded_file_size = 0;
+#endif
debug("INIT: total %d bytes\n", rqt->int_data[0]);
break;
case RQT_DL_FILE_INFO:
@@ -544,11 +557,17 @@ static int thor_rx_data(void)
while (!dev->rxdata) {
usb_gadget_handle_interrupts();
+
if (ctrlc())
- return -1;
+ return -EINTR;
}
+
dev->rxdata = 0;
data_to_rx -= dev->out_req->actual;
+#ifdef CONFIG_TIZEN
+ downloaded_file_size += dev->out_req->actual;
+ draw_thor_progress(total_file_size, downloaded_file_size);
+#endif
} while (data_to_rx);
return tmp;
@@ -690,12 +709,28 @@ static void thor_set_dma(void *addr, int len)
int thor_init(void)
{
struct thor_dev *dev = thor_func->dev;
+ int power_key_cnt = 0;
+#ifdef CONFIG_TIZEN
+ draw_thor_init_screen();
+#endif
/* Wait for a device enumeration and configuration settings */
debug("THOR enumeration/configuration setting....\n");
- while (!dev->configuration_done)
+ while (!dev->configuration_done) {
usb_gadget_handle_interrupts();
+ power_key_cnt += key_pressed(KEY_POWER);
+
+ if (ctrlc() || power_key_cnt >= 3) {
+#ifdef CONFIG_BOOT_INFORM
+ boot_inform_clear();
+#endif
+ return -EINTR;
+ }
+ }
+#ifdef CONFIG_TIZEN
+ draw_thor_screen();
+#endif
thor_set_dma(thor_rx_data_buf, strlen("THOR"));
/* detect the download request from Host PC */
if (thor_rx_data() < 0) {
@@ -732,7 +767,7 @@ int thor_handle(void)
return ret;
} else {
printf("%s: No data received!\n", __func__);
- break;
+ return ret;
}
}
@@ -889,6 +924,8 @@ static void thor_func_disable(struct usb_function *f)
usb_ep_disable(dev->int_ep);
dev->int_ep->driver_data = NULL;
}
+
+ dev->configuration_done = 0;
}
static int thor_eps_setup(struct usb_function *f)