Merge branch 'master' of github.com:optixx/quickdev16

This commit is contained in:
optixx 2009-09-03 09:03:23 +02:00
commit e3067c7256
2 changed files with 45 additions and 0 deletions

View File

@ -33,6 +33,10 @@
#include "config.h" #include "config.h"
#include "usbdrv/usbdrv.c" #include "usbdrv/usbdrv.c"
/* /*
* USBasp requests, taken from the original USBasp sourcecode * USBasp requests, taken from the original USBasp sourcecode
*/ */
@ -74,6 +78,10 @@
(LED_DIR ^= (1 << LED_PIN)));} (LED_DIR ^= (1 << LED_PIN)));}
#define AVR_BTLDR_EN_PORT PORTC
#define AVR_BTLDR_EN_DIR DDRC
#define AVR_BTLDR_EN_PIN PC1
#define AVR_BTLDR_EN_IN PINC
/* /*
@ -449,6 +457,18 @@ int __attribute__ ((noreturn, OS_main)) main(void)
uint16_t delay = 0; uint16_t delay = 0;
timeout = TIMEOUT; timeout = TIMEOUT;
DDRC &= ~(1 << AVR_BTLDR_EN_PIN);
PORTC &= ~(1 << AVR_BTLDR_EN_PIN);
if ((AVR_BTLDR_EN_IN & ( 1 << AVR_BTLDR_EN_PIN)) == 0){
banner();
uart_puts("Bootloader flashing is disabled\n\r");
MCUSR = 0;
leave_bootloader();
}
/* /*
* if power-on reset, quit bootloader via watchdog reset * if power-on reset, quit bootloader via watchdog reset

View File

@ -31,6 +31,7 @@
#include "debug.h" #include "debug.h"
#include "crc.h" #include "crc.h"
#include "info.h" #include "info.h"
#include "dump.h"
void test_read_write() void test_read_write()
{ {
@ -92,6 +93,30 @@ void test_non_zero_memory(uint32_t bottom_addr, uint32_t top_addr)
} }
void test_memory_pattern(uint32_t bottom_addr, uint32_t top_addr, uint32_t bank_size)
{
uint32_t addr = 0;
uint8_t pattern = 0x55;
info_P(PSTR("test_memory_pattern: bottom_addr=0x%08lx top_addr=0x%08lx\n"), bottom_addr, top_addr);
sram_bulk_write_start(bottom_addr);
for (addr = bottom_addr; addr < top_addr; addr++) {
if (addr % bank_size == 0){
pattern++;
info_P(PSTR("test_memory_pattern: write addr=0x%08lx pattern=0x%08lx\n"), addr, pattern);
}
sram_bulk_write(pattern);
}
sram_bulk_write_end();
for (addr = bottom_addr; addr < top_addr; addr+=bank_size) {
info_P(PSTR("test_memory_pattern: dump bottom_addr=0x%08lx top_addr=0x%08lx\n"), addr, addr + bank_size);
dump_memory(addr, addr + bank_size );
info_P(PSTR("----------------------------------------------------------------\n"));
}
crc_check_bulk_memory((uint32_t)bottom_addr,top_addr, bank_size);
}
void test_crc() void test_crc()
{ {