diff options
author | laforge <laforge@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2006-09-22 22:10:46 +0000 |
---|---|---|
committer | laforge <laforge@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2006-09-22 22:10:46 +0000 |
commit | 1ba82b71074e31e0a9451e80c2de4bca2716adf2 (patch) | |
tree | e5ea5d41d2487af9e7a38e8b1ca69d0a5707e526 /firmware/src | |
parent | 706ffa9f3b986eff193377142459fbfde2362036 (diff) |
make sure DFU loader always prints some informational / copyright message upon startup
git-svn-id: https://svn.openpcd.org:2342/trunk@220 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'firmware/src')
-rw-r--r-- | firmware/src/dfu/dbgu.c | 24 | ||||
-rw-r--r-- | firmware/src/dfu/dbgu.h | 12 | ||||
-rw-r--r-- | firmware/src/dfu/dfu.c | 18 |
3 files changed, 28 insertions, 26 deletions
diff --git a/firmware/src/dfu/dbgu.c b/firmware/src/dfu/dbgu.c index 367a399..9bfefc3 100644 --- a/firmware/src/dfu/dbgu.c +++ b/firmware/src/dfu/dbgu.c @@ -24,8 +24,6 @@ #include <stdio.h> #include <string.h> -#ifdef DEBUG - #define USART_SYS_LEVEL 4 void AT91F_DBGU_Ready(void) { @@ -70,7 +68,6 @@ void AT91F_DBGU_Init(void) DBGU_irq_handler); AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_SYS); - AT91F_DBGU_Printk("\n\rsam7dfu (C) 2006 by Harald Welte\n\r"); } void AT91F_DBGU_Printk(char *buffer) @@ -81,6 +78,18 @@ void AT91F_DBGU_Printk(char *buffer) } } +int AT91F_DBGU_Get(char *val) +{ + if ((AT91F_US_RxReady((AT91PS_USART) AT91C_BASE_DBGU)) == 0) + return (0); + else { + *val = AT91F_US_GetChar((AT91PS_USART) AT91C_BASE_DBGU); + return (-1); + } +} + +#ifdef DEBUG + void AT91F_DBGU_Frame(char *buffer) { unsigned char len; @@ -91,15 +100,6 @@ void AT91F_DBGU_Frame(char *buffer) (unsigned char *)buffer, len, 0, 0); } -int AT91F_DBGU_Get(char *val) -{ - if ((AT91F_US_RxReady((AT91PS_USART) AT91C_BASE_DBGU)) == 0) - return (0); - else { - *val = AT91F_US_GetChar((AT91PS_USART) AT91C_BASE_DBGU); - return (-1); - } -} const char * hexdump(const void *data, unsigned int len) diff --git a/firmware/src/dfu/dbgu.h b/firmware/src/dfu/dbgu.h index 9f4f002..358a066 100644 --- a/firmware/src/dfu/dbgu.h +++ b/firmware/src/dfu/dbgu.h @@ -7,21 +7,19 @@ #define DEBUGPCR(x, args ...) DEBUGP(x "\r\n", ## args)
#define DEBUGPCRF(x, args ...) DEBUGPCR("%s(%d): " x, __FUNCTION__, __LINE__, ## args)
+extern void AT91F_DBGU_Init(void);
+extern void AT91F_DBGU_Printk(char *buffer);
+extern int AT91F_DBGU_Get(char *val);
+extern void AT91F_DBGU_Ready(void);
+
#ifdef DEBUG
extern void debugp(const char *format, ...);
extern const char *hexdump(const void *data, unsigned int len);
-extern void AT91F_DBGU_Init(void);
-extern void AT91F_DBGU_Printk(char *buffer);
extern void AT91F_DBGU_Frame(char *buffer);
-extern int AT91F_DBGU_Get(char *val);
#else
#define debugp(x, args ...)
#define hexdump(x, args ...)
-#define AT91F_DBGU_Get(x, args ...) 0;
#define AT91F_DBGU_Frame(x)
-#define AT91F_DBGU_Printk(x)
-#define AT91F_DBGU_Init()
-#define AT91F_DBGU_Ready()
#endif
#endif /* dbgu_h */
diff --git a/firmware/src/dfu/dfu.c b/firmware/src/dfu/dfu.c index 693f2eb..7e7c575 100644 --- a/firmware/src/dfu/dfu.c +++ b/firmware/src/dfu/dfu.c @@ -808,7 +808,6 @@ static __dfufunc void dfu_udp_irq(void) AT91F_AIC_ClearIt(AT91C_BASE_AIC, AT91C_ID_UDP); - { volatile int i; for (i=0; i< 0x3ff; i++) ; } led1off(); } @@ -817,6 +816,7 @@ static void dfu_switch(void) { AT91PS_AIC pAic = AT91C_BASE_AIC; + DEBUGE("\r\nsam7dfu: switching to DFU mode\r\n"); AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, OPENPCD_PIO_LED1); AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, OPENPCD_PIO_LED2); led1off(); @@ -830,6 +830,9 @@ static void dfu_switch(void) pAic->AIC_SVR[AT91C_ID_UDP] = (unsigned int) &dfu_udp_irq; dfu_state = DFU_STATE_dfuIDLE; dfu_status = DFU_STATUS_OK; + //AT91F_DBGU_Printk("You may now start the DFU up/download process\r\n"); + AT91F_DBGU_Printk("\r\nTHIS DOES NOT WORK YET, " + " PLEASE PUSH THE BUTTON WHILE POWERING UP\r\n"); } void __dfufunc dfu_main(void) @@ -840,11 +843,12 @@ void __dfufunc dfu_main(void) led2off(); AT91F_DBGU_Init(); - DEBUGE("sam7dfu startup\r\n"); - - AT91F_DBGU_Printk("\n\r"); - AT91F_DBGU_Printk(COMPILE_DATE " " COMPILE_BY " " COMPILE_SVNREV); - AT91F_DBGU_Printk("\n\r"); + AT91F_DBGU_Printk("\n\r\n\rsam7dfu - AT91SAM7 USB DFU bootloader\n\r" + "(C) 2006 by Harald Welte <hwelte@hmw-consulting.de>\n\r" + "This software is FREE SOFTWARE licensed under GNU GPL\n\r"); + AT91F_DBGU_Printk("Version " COMPILE_SVNREV + " compiled " COMPILE_DATE + " by " COMPILE_BY "\n\r\n\r"); udp_init(); @@ -871,7 +875,7 @@ void __dfufunc dfu_main(void) flash_init(); - DEBUGE("sam7dfu entering main loop\r\n"); + AT91F_DBGU_Printk("You may now start the DFU up/download process\r\n"); /* do nothing, since all of DFU is interrupt driven */ while (1) ; } |