summaryrefslogtreecommitdiff
path: root/openpcd/firmware/src/start/Cstartup.S
diff options
context:
space:
mode:
author(no author) <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-09-12 16:54:59 +0000
committer(no author) <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-09-12 16:54:59 +0000
commitad18651cdc0da907b0343651c73aa4b5e8f6af43 (patch)
tree2b1d879a334d35660d5f6669ef98ed6d8f0248a5 /openpcd/firmware/src/start/Cstartup.S
parentf71a643ed688a4ab373c68a9df0933e4acbee809 (diff)
- fix bootloader switch detection
git-svn-id: https://svn.openpcd.org:2342/trunk@182 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpcd/firmware/src/start/Cstartup.S')
-rw-r--r--openpcd/firmware/src/start/Cstartup.S23
1 files changed, 23 insertions, 0 deletions
diff --git a/openpcd/firmware/src/start/Cstartup.S b/openpcd/firmware/src/start/Cstartup.S
index 1c9f1db..e91fd86 100644
--- a/openpcd/firmware/src/start/Cstartup.S
+++ b/openpcd/firmware/src/start/Cstartup.S
@@ -16,6 +16,8 @@
//*- 1.1 01/Apr/05 JPP : save SPSR
//*-----------------------------------------------------------------------------*/
+#define CONFIG_DFU_SWITCH
+
//#define DEBUG_LL
#ifdef DEBUG_LL
@@ -59,6 +61,13 @@
.equ AIC_EOICR, (304)
.equ AIC_MCR_RCR, (0xf00)
.equ AT91C_BASE_AIC, (0xFFFFF000)
+ .equ AT91C_PMC_PCER, (0xFFFFFC10)
+ .equ AT91C_BASE_PIOA, (0xFFFFF400)
+ .equ AT91C_ID_PIOA, (2)
+ .equ PIOA_PDSR, (0x3c)
+ .equ PIO_BOOTLDR, (1 << 27)
+ #.equ PIO_BOOTLDR, (1 << 6)
+
/* #include "AT91SAM7S64_inc.h" */
@@ -170,9 +179,23 @@ _remap:
mov r2, #0x01
str r2, [r1, #AIC_MCR_RCR]
+ /* prepare c function call to main */
mov r0, #0 /* argc = 0 */
ldr lr,=exit
ldr r10,=main
+
+#ifdef CONFIG_DFU_SWITCH
+ /* check whether bootloader button is pressed */
+ ldr r1, =AT91C_PMC_PCER
+ mov r2, #(1 << AT91C_ID_PIOA)
+ str r2, [r1]
+
+ ldr r1, =AT91C_BASE_PIOA
+ ldr r2, [r1, #PIOA_PDSR]
+ tst r2, #PIO_BOOTLDR
+ ldrne r10,=dfu_main
+#endif
+
bx r10
.size remap, . - remap
.endfunc
personal git repositories of Harald Welte. Your mileage may vary