diff options
author | Inha Song <ideal.song@samsung.com> | 2013-10-11 17:50:24 +0900 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2024-10-24 09:54:30 +0900 |
commit | 0a56201563d08007ffd2119f9a471cf91010218d (patch) | |
tree | 17db3c7ba5538976864724f47a2a2f57143b6212 /drivers | |
parent | 6b8c5092f99b00ea4801b85c9c99ca63a9e1892f (diff) | |
download | u-boot-0a56201563d08007ffd2119f9a471cf91010218d.tar.gz u-boot-0a56201563d08007ffd2119f9a471cf91010218d.tar.bz2 u-boot-0a56201563d08007ffd2119f9a471cf91010218d.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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/f_thor.c | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index 5437211834..ec1b6cd60b 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -32,6 +32,10 @@ #include <g_dnl.h> #include <dfu.h> #include <thor.h> +#include <libtizen.h> +#include <samsung/misc.h> +#include <linux/input.h> +#include <usb.h> #include "f_thor.h" @@ -55,6 +59,10 @@ DEFINE_CACHE_ALIGN_BUFFER(unsigned char, thor_rx_data_buf, /* ********************************************************** */ DEFINE_CACHE_ALIGN_BUFFER(char, f_name, F_NAME_BUF_SIZE + 1); 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(struct udevice *udc, const struct rsp_box *rsp) @@ -272,7 +280,11 @@ static long long int process_rqt_download(struct udevice *udc, const struct rqt_ thor_file_size = (uint64_t)(uint32_t)rqt->int_data[0] + (((uint64_t)(uint32_t)rqt->int_data[1]) << 32); - debug("INIT: total %llu bytes\n", thor_file_size); +#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: file_type = rqt->int_data[0]; @@ -561,10 +573,17 @@ static int thor_rx_data(struct udevice *udc) while (!dev->rxdata) { dm_usb_gadget_handle_interrupts(udc); 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; +#ifdef CONFIG_LCD /* TODO : Need to enable LCD*/ + draw_thor_progress(total_file_size, downloaded_file_size); +#endif +#endif } while (data_to_rx); return tmp; @@ -690,12 +709,34 @@ static void thor_set_dma(void *addr, int len) int thor_init(struct udevice *udc) { struct thor_dev *dev = thor_func->dev; + int power_key_cnt = 0; +#ifdef CONFIG_TIZEN +#ifdef CONFIG_LCD /* TODO : Need to enable LCD*/ + draw_thor_init_screen(); +#endif +#endif /* Wait for a device enumeration and configuration settings */ debug("THOR enumeration/configuration setting....\n"); while (!dev->configuration_done) dm_usb_gadget_handle_interrupts(udc); + +#ifdef CONFIG_LCD_MENU + power_key_cnt += key_pressed(KEY_POWER); +#endif + if (ctrlc() || power_key_cnt >= 3) { +#ifdef CONFIG_BOOT_INFORM + boot_inform_clear(); +#endif + return -EINTR; + } + } +#ifdef CONFIG_TIZEN +#ifdef CONFIG_LCD /* TODO : Need to enable LCD*/ + draw_thor_screen(); +#endif +#endif thor_set_dma(thor_rx_data_buf, strlen("THOR")); /* detect the download request from Host PC */ if (thor_rx_data(udc) < 0) { @@ -736,7 +777,7 @@ int thor_handle(struct udevice *udc) return ret; } else { printf("%s: No data received!\n", __func__); - break; + return ret; } if (dfu_reinit_needed) return THOR_DFU_REINIT_NEEDED; @@ -901,6 +942,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) |