diff --git a/avr/usbload/Makefile b/avr/usbload/Makefile index 167353a..c82f93b 100644 --- a/avr/usbload/Makefile +++ b/avr/usbload/Makefile @@ -1,8 +1,8 @@ DEVICE = atmega644 F_CPU = 20000000 # in Hz -FUSE_L = # see below for fuse values for particular devices +FUSE_L = FUSE_H = -AVRDUDE = sudo avrdude -c usbasp -p $(DEVICE) -P /dev/tty.PL2303-00002126 +AVRDUDE = avrdude -c usbasp -p $(DEVICE) CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0 #-std=gnu99 @@ -10,85 +10,6 @@ OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o uart.o fifo COMPILE = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE) -############################################################################## -# Fuse values for particular devices -############################################################################## -# If your device is not listed here, go to -# http://palmavr.sourceforge.net/cgi-bin/fc.cgi -# and choose options for external crystal clock and no clock divider -# -################################## ATMega8 ################################## -# ATMega8 FUSE_L (Fuse low byte): -# 0x9f = 1 0 0 1 1 1 1 1 -# ^ ^ \ / \--+--/ -# | | | +------- CKSEL 3..0 (external >8M crystal) -# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) -# | +------------------ BODEN (BrownOut Detector enabled) -# +-------------------- BODLEVEL (2.7V) -# ATMega8 FUSE_H (Fuse high byte): -# 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000) -# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0 -# | | | | | +-------- BOOTSZ1 -# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase) -# | | | +-------------- CKOPT (full output swing) -# | | +---------------- SPIEN (allow serial programming) -# | +------------------ WDTON (WDT not always on) -# +-------------------- RSTDISBL (reset pin is enabled) -# -############################## ATMega48/88/168 ############################## -# ATMega*8 FUSE_L (Fuse low byte): -# 0xdf = 1 1 0 1 1 1 1 1 -# ^ ^ \ / \--+--/ -# | | | +------- CKSEL 3..0 (external >8M crystal) -# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) -# | +------------------ CKOUT (if 0: Clock output enabled) -# +-------------------- CKDIV8 (if 0: divide by 8) -# ATMega*8 FUSE_H (Fuse high byte): -# 0xde = 1 1 0 1 1 1 1 0 -# ^ ^ ^ ^ ^ \-+-/ -# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V) -# | | | | + --------- EESAVE (preserve EEPROM over chip erase) -# | | | +-------------- WDTON (if 0: watchdog always on) -# | | +---------------- SPIEN (allow serial programming) -# | +------------------ DWEN (debug wire enable) -# +-------------------- RSTDISBL (reset pin is enabled) -# -############################## ATTiny25/45/85 ############################### -# ATMega*5 FUSE_L (Fuse low byte): -# 0xef = 1 1 1 0 1 1 1 1 -# ^ ^ \+/ \--+--/ -# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) -# | | +--------------- SUT 1..0 (BOD enabled, fast rising power) -# | +------------------ CKOUT (clock output on CKOUT pin -> disabled) -# +-------------------- CKDIV8 (divide clock by 8 -> don't divide) -# ATMega*5 FUSE_H (Fuse high byte): -# 0xdd = 1 1 0 1 1 1 0 1 -# ^ ^ ^ ^ ^ \-+-/ -# | | | | | +------ BODLEVEL 2..0 (brownout trigger level -> 2.7V) -# | | | | +---------- EESAVE (preserve EEPROM on Chip Erase -> not preserved) -# | | | +-------------- WDTON (watchdog timer always on -> disable) -# | | +---------------- SPIEN (enable serial programming -> enabled) -# | +------------------ DWEN (debug wire enable) -# +-------------------- RSTDISBL (disable external reset -> enabled) -# -################################ ATTiny2313 ################################# -# ATTiny2313 FUSE_L (Fuse low byte): -# 0xef = 1 1 1 0 1 1 1 1 -# ^ ^ \+/ \--+--/ -# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) -# | | +--------------- SUT 1..0 (BOD enabled, fast rising power) -# | +------------------ CKOUT (clock output on CKOUT pin -> disabled) -# +-------------------- CKDIV8 (divide clock by 8 -> don't divide) -# ATTiny2313 FUSE_H (Fuse high byte): -# 0xdb = 1 1 0 1 1 0 1 1 -# ^ ^ ^ ^ \-+-/ ^ -# | | | | | +---- RSTDISBL (disable external reset -> enabled) -# | | | | +-------- BODLEVEL 2..0 (brownout trigger level -> 2.7V) -# | | | +-------------- WDTON (watchdog timer always on -> disable) -# | | +---------------- SPIEN (enable serial programming -> enabled) -# | +------------------ EESAVE (preserve EEPROM on Chip Erase -> not preserved) -# +-------------------- DWEN (debug wire enable) - # symbolic targets: help: diff --git a/avr/usbload/commandline/snesuploader b/avr/usbload/commandline/snesuploader index 37c1d58..d43d4cf 100755 Binary files a/avr/usbload/commandline/snesuploader and b/avr/usbload/commandline/snesuploader differ diff --git a/avr/usbload/main.c b/avr/usbload/main.c index 4601aa6..809f4de 100644 --- a/avr/usbload/main.c +++ b/avr/usbload/main.c @@ -179,7 +179,7 @@ uint8_t usbFunctionRead(uint8_t * data, uint8_t len) int main(void) { uint8_t i; - //wdt_enable(WDTO_1S); + wdt_enable(WDTO_1S); uart_init(); stdout = &uart_stdout; sram_init(); @@ -190,11 +190,12 @@ int main(void) printf("USB Init\n"); usbDeviceDisconnect(); /* enforce re-enumeration, do this while * interrupts are disabled! */ + cli(); printf("USB disconnect\n"); i = 10; while (--i) { /* fake USB disconnect for > 250 ms */ wdt_reset(); - _delay_ms(1); + _delay_ms(10); } usbDeviceConnect(); printf("USB connect\n"); diff --git a/avr/usbload/usbconfig.h b/avr/usbload/usbconfig.h index 9235795..0284c4a 100644 --- a/avr/usbload/usbconfig.h +++ b/avr/usbload/usbconfig.h @@ -56,13 +56,13 @@ section at the end of this file). /* ----------------------- Optional Hardware Config ------------------------ */ -#define USB_CFG_PULLUP_IOPORTNAME D +//#define USB_CFG_PULLUP_IOPORTNAME D /* If you connect the 1.5k pullup resistor from D- to a port pin instead of * V+, you can connect and disconnect the device from firmware by calling * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h). * This constant defines the port on which the pullup resistor is connected. */ -#define USB_CFG_PULLUP_BIT 6 +//#define USB_CFG_PULLUP_BIT 6 /* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined * above) where the 1.5k pullup resistor is connected. See description * above for details. @@ -206,7 +206,7 @@ section at the end of this file). * own Vendor ID, define it here. Otherwise you use one of obdev's free shared * VID/PID pairs. Be sure to read USBID-License.txt for rules! */ -#define USB_CFG_DEVICE_ID 0xdc, 0x05 +#define USB_CFG_DEVICE_ID 0xdd, 0x05 /* This is the ID of the product, low byte first. It is interpreted in the * scope of the vendor ID. If you have registered your own VID with usb.org * or if you have licensed a PID from somebody else, define it here. Otherwise diff --git a/snesram.tmproj b/snesram.tmproj index e9fbf78..10fc8f5 100644 --- a/snesram.tmproj +++ b/snesram.tmproj @@ -3,7 +3,7 @@ currentDocument - tools/bsnes/cart/cart.hpp + avr/usbload/commandline/snesuploader.c documents @@ -21,6 +21,216 @@ 271 metaData + avr/usbload/Makefile + + caret + + column + 29 + line + 4 + + firstVisibleColumn + 0 + firstVisibleLine + 0 + + avr/usbload/commandline/opendevice.c + + caret + + column + 3 + line + 27 + + firstVisibleColumn + 0 + firstVisibleLine + 234 + + avr/usbload/commandline/opendevice.h + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 26 + + avr/usbload/commandline/snesuploader.c + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 198 + + avr/usbload/crc.c + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 0 + + avr/usbload/debug.c + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 0 + + avr/usbload/debug.h + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 0 + + avr/usbload/fifo.c + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 0 + + avr/usbload/fifo.h + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 0 + + avr/usbload/main.c + + caret + + column + 17 + line + 59 + + firstVisibleColumn + 0 + firstVisibleLine + 161 + + avr/usbload/sram.c + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 121 + + avr/usbload/sram.h + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 0 + + avr/usbload/uart.c + + caret + + column + 25 + line + 59 + + firstVisibleColumn + 0 + firstVisibleLine + 26 + + avr/usbload/uart.h + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 0 + + avr/usbload/usbconfig.h + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 207 + poc/avr_sdcard/fat.h caret @@ -49,6 +259,48 @@ firstVisibleLine 0 + scripts/b.py + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 0 + + scripts/rom.py + + caret + + column + 0 + line + 228 + + firstVisibleColumn + 0 + firstVisibleLine + 189 + + scripts/rom_analyse.sql + + caret + + column + 0 + line + 0 + + firstVisibleColumn + 0 + firstVisibleLine + 2 + snes/banktest/LoadGraphics.asm caret @@ -322,6 +574,24 @@ tools/bsnes/memory/smemory/mapper/chip.cpp tools/bsnes/cart/cart.cpp tools/bsnes/cart/cart.hpp + scripts/rom_analyse.sql + scripts/b.py + scripts/rom.py + avr/usbload/crc.c + avr/usbload/sram.c + avr/usbload/sram.h + avr/usbload/fifo.h + avr/usbload/fifo.c + avr/usbload/Makefile + avr/usbload/debug.h + avr/usbload/debug.c + avr/usbload/uart.c + avr/usbload/main.c + avr/usbload/usbconfig.h + avr/usbload/commandline/opendevice.c + avr/usbload/commandline/opendevice.h + avr/usbload/commandline/snesuploader.c + avr/usbload/uart.h showFileHierarchyDrawer @@ -334,10 +604,55 @@ isExpanded subItems - + + avr + + isExpanded + + subItems + + usbload + + isExpanded + + subItems + + commandline + + isExpanded + + subItems + + + + + + + poc + + isExpanded + + subItems + + + scripts + + isExpanded + + subItems + + + snes + + isExpanded + + subItems + + + windowFrame - {{96, 60}, {936, 818}} + {{0, 60}, {936, 818}}