aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorliamstask <liamstask@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-12-08 01:11:29 +0000
committerliamstask <liamstask@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-12-08 01:11:29 +0000
commit348922bb1cf72c4812256ee4b0317ac492d78ddb (patch)
treef422d97c01ab85442cde04e0b8d47fa9c417a5fd /os/hal
parent0b8fd860fa71b35bfe0a242471d3bc4b56c93089 (diff)
downloadChibiOS-348922bb1cf72c4812256ee4b0317ac492d78ddb.tar.gz
ChibiOS-348922bb1cf72c4812256ee4b0317ac492d78ddb.tar.bz2
ChibiOS-348922bb1cf72c4812256ee4b0317ac492d78ddb.zip
* [AT91SAM7] wait for hardware reset before setting up the clock, otherwise USB doesn't come up successfully
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1382 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/platforms/AT91SAM7/hal_lld.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/os/hal/platforms/AT91SAM7/hal_lld.c b/os/hal/platforms/AT91SAM7/hal_lld.c
index 876e60e78..6da681fcd 100644
--- a/os/hal/platforms/AT91SAM7/hal_lld.c
+++ b/os/hal/platforms/AT91SAM7/hal_lld.c
@@ -97,6 +97,12 @@ void hal_lld_init(void) {
*/
void at91sam7_clock_init(void) {
+ /* wait for reset */
+ while((AT91C_BASE_RSTC->RSTC_RSR & (AT91C_RSTC_SRCMP | AT91C_RSTC_NRSTL)) != AT91C_RSTC_NRSTL)
+ ;
+ /* enable reset */
+ AT91C_BASE_RSTC->RSTC_RMR = ((0xA5 << 24) | AT91C_RSTC_URSTEN);
+
/* Flash Memory: 1 wait state, about 50 cycles in a microsecond.*/
AT91C_BASE_MC->MC_FMR = (AT91C_MC_FMCN & (50 << 16)) | AT91C_MC_FWS_1FWS;