diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-26 17:34:58 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-26 17:34:58 +0200 |
commit | 27111d83be815602ac35354e6a8e4e158c5968f9 (patch) | |
tree | 255d35b82fb0a877d695ddae523a7406cfc6de64 | |
parent | 1085d15a3ed01807c3e55f36652c3a69c14bfc46 (diff) | |
download | rockbox-27111d8.tar.gz rockbox-27111d8.zip |
hwstub: fix stmp3600
The microseconds register has a different address
Change-Id: I29d2e7feea9eb34b0d539ee217babd092542b612
-rw-r--r-- | utils/hwstub/stub/stmp/target.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/utils/hwstub/stub/stmp/target.c b/utils/hwstub/stub/stmp/target.c index 9b005063bd..55cb344955 100644 --- a/utils/hwstub/stub/stmp/target.c +++ b/utils/hwstub/stub/stmp/target.c @@ -144,7 +144,10 @@ void clkctrl_reset(void) #define HW_DIGCTL_CTRL (*(volatile uint32_t *)(HW_DIGCTL_BASE + 0)) #define HW_DIGCTL_CTRL__USB_CLKGATE (1 << 2) +/* STMP3700+ */ #define HW_DIGCTL_MICROSECONDS (*(volatile uint32_t *)(HW_DIGCTL_BASE + 0xC0)) +/* STMP3600 */ +#define HW_DIGCTL_MICROSECONDS2 (*(volatile uint32_t *)(HW_DIGCTL_BASE + 0xB0)) #define HW_DIGCTL_CHIPID (*(volatile uint32_t *)(HW_DIGCTL_BASE + 0x310)) #define HW_DIGCTL_CHIPID__PRODUCT_CODE_BP 16 @@ -276,12 +279,13 @@ void target_exit(void) void target_udelay(int us) { - uint32_t cur = HW_DIGCTL_MICROSECONDS; + volatile uint32_t *reg = g_stmp_family == STMP3600 ? &HW_DIGCTL_MICROSECONDS2 : &HW_DIGCTL_MICROSECONDS; + uint32_t cur = *reg; uint32_t end = cur + us; if(cur < end) - while(HW_DIGCTL_MICROSECONDS < end) {} + while(*reg < end) {} else - while(HW_DIGCTL_MICROSECONDS >= cur) {} + while(*reg >= cur) {} } void target_mdelay(int ms) |