summaryrefslogtreecommitdiffstats
path: root/utils/hwstub/stub/rk27xx/target.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-02-04 00:10:41 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2014-02-10 23:14:24 +0100
commitc17d30f20466861a244c603665c580feb7758abf (patch)
treec5044f599f89d89de0b1419bd40e92211f8c8b8a /utils/hwstub/stub/rk27xx/target.c
parent6d64111b3c2f772cfc3539bb13851f78d4b55870 (diff)
downloadrockbox-c17d30f20466861a244c603665c580feb7758abf.tar.gz
rockbox-c17d30f20466861a244c603665c580feb7758abf.tar.bz2
rockbox-c17d30f20466861a244c603665c580feb7758abf.zip
utils/hwstub: completely rework the protocol, drop unused features
The protocol has evolved a lot during the 2.x.y lifetime, bringing more features which later got unused. This commit removes all the unused stuff and simplifies everything: - drop the feature mask: everything is mandatory or stalled on error - remove the info request and put all static information in standard USB descriptors which are part of the configuration descriptor (and can be retrieved using the standard GetDescriptor request). - remove the USB interface, we had only one anyway - remove all endpoint descriptors - remove the exit/atexit stuff, it never worked as intended anyway - update the hwstub library and make it able to handle any device - update the tools (mostly renaming and removing of code) Change-Id: I1872bba7f4177fc3891180e8f944aab88f5bde31
Diffstat (limited to 'utils/hwstub/stub/rk27xx/target.c')
-rw-r--r--utils/hwstub/stub/rk27xx/target.c59
1 files changed, 11 insertions, 48 deletions
diff --git a/utils/hwstub/stub/rk27xx/target.c b/utils/hwstub/stub/rk27xx/target.c
index f9efccaef0..ff2e952909 100644
--- a/utils/hwstub/stub/rk27xx/target.c
+++ b/utils/hwstub/stub/rk27xx/target.c
@@ -33,7 +33,6 @@ enum rk27xx_family_t
};
static enum rk27xx_family_t g_rk27xx_family = UNKNOWN;
-static int g_atexit = HWSTUB_ATEXIT_OFF;
static void _enable_irq(void)
{
@@ -43,23 +42,6 @@ static void _enable_irq(void)
);
}
-static void power_off(void)
-{
- GPIO_PCCON &= ~(1<<0);
- while(1);
-}
-
-static void rk27xx_reset(void)
-{
- /* use Watchdog to reset */
- SCU_CLKCFG &= ~CLKCFG_WDT;
- WDTLR = 1;
- WDTCON = (1<<4) | (1<<3);
-
- /* Wait for reboot to kick in */
- while(1);
-}
-
/* us may be at most 2^31/200 (~10 seconds) for 200MHz max cpu freq */
void target_udelay(int us)
{
@@ -132,41 +114,22 @@ void target_init(void)
}
}
-static struct usb_resp_info_target_t g_target =
+struct hwstub_target_desc_t __attribute__((aligned(2))) target_descriptor =
{
- .id = HWSTUB_TARGET_RK27,
- .name = "Rockchip RK27XX"
+ sizeof(struct hwstub_target_desc_t),
+ HWSTUB_DT_TARGET,
+ HWSTUB_TARGET_RK27,
+ "Rockchip RK27XX"
};
-int target_get_info(int info, void **buffer)
+void target_get_desc(int desc, void **buffer)
{
- if(info == HWSTUB_INFO_TARGET)
- {
- *buffer = &g_target;
- return sizeof(g_target);
- }
- else
- return -1;
+ (void) desc;
+ *buffer = NULL;
}
-int target_atexit(int method)
+void target_get_config_desc(void *buffer, int *size)
{
- g_atexit = method;
- return 0;
-}
-
-void target_exit(void)
-{
- switch(g_atexit)
- {
- case HWSTUB_ATEXIT_OFF:
- power_off();
- // fallthrough in case of return
- case HWSTUB_ATEXIT_REBOOT:
- rk27xx_reset();
- // fallthrough in case of return
- case HWSTUB_ATEXIT_NOP:
- default:
- return;
- }
+ (void) buffer;
+ (void) size;
}