⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 avrdude-5.4.diff

📁 This is a software implementation of the USB low-speed protocol for the Atmel ATtiny microcontrolle
💻 DIFF
📖 第 1 页 / 共 2 页
字号:
diff -pu avrdude-5.4/Makefile.am.orig avrdude-5.4/Makefile.am--- avrdude-5.4/Makefile.am.orig	2007-01-25 21:51:11.000000000 +0100+++ avrdude-5.4/Makefile.am	2008-01-15 14:08:59.000000000 +0100@@ -86,6 +86,8 @@ libavrdude_a_SOURCES = \ 	bitbang.h \ 	butterfly.c \ 	butterfly.h \+	usbtiny.c \+	usbtiny.h \ 	config.c \ 	config.h \ 	confwin.c \diff -pu avrdude-5.4/Makefile.in.orig avrdude-5.4/Makefile.in--- avrdude-5.4/Makefile.in.orig	2007-05-16 23:47:13.000000000 +0200+++ avrdude-5.4/Makefile.in	2008-01-15 14:08:59.000000000 +0100@@ -105,6 +105,7 @@ am_libavrdude_a_OBJECTS = libavrdude_a-c 	libavrdude_a-stk500v2.$(OBJEXT) \ 	libavrdude_a-stk500generic.$(OBJEXT) \ 	libavrdude_a-term.$(OBJEXT) libavrdude_a-usbasp.$(OBJEXT) \+ 	libavrdude_a-usbtiny.$(OBJEXT) \ 	libavrdude_a-usb_libusb.$(OBJEXT) \ 	libavrdude_a-update.$(OBJEXT) libavrdude_a_OBJECTS = $(am_libavrdude_a_OBJECTS)@@ -344,6 +345,8 @@ libavrdude_a_SOURCES = \ 	usbasp.c \ 	usbasp.h \ 	usbdevs.h \+	usbtiny.c \+	usbtiny.h \ 	usb_libusb.c \ 	update.h \ 	update.c@@ -489,6 +492,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libavrdude_a-update.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libavrdude_a-usb_libusb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libavrdude_a-usbasp.Po@am__quote@+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libavrdude_a-usbtiny.Po@am__quote@  .c.o: @am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \@@ -910,6 +914,20 @@ libavrdude_a-usbasp.obj: usbasp.c @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -c -o libavrdude_a-usbasp.obj `if test -f 'usbasp.c'; then $(CYGPATH_W) 'usbasp.c'; else $(CYGPATH_W) '$(srcdir)/usbasp.c'; fi` +libavrdude_a-usbtiny.o: usbtiny.c+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -MT libavrdude_a-usbtiny.o -MD -MP -MF "$(DEPDIR)/libavrdude_a-usbtiny.Tpo" -c -o libavrdude_a-usbtiny.o `test -f 'usbtiny.c' || echo '$(srcdir)/'`usbtiny.c; \+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libavrdude_a-usbtiny.Tpo" "$(DEPDIR)/libavrdude_a-usbtiny.Po"; else rm -f "$(DEPDIR)/libavrdude_a-usbtiny.Tpo"; exit 1; fi+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='usbtiny.c' object='libavrdude_a-usbtiny.o' libtool=no @AMDEPBACKSLASH@+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -c -o libavrdude_a-usbtiny.o `test -f 'usbtiny.c' || echo '$(srcdir)/'`usbtiny.c++libavrdude_a-usbtiny.obj: usbtiny.c+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -MT libavrdude_a-usbtiny.obj -MD -MP -MF "$(DEPDIR)/libavrdude_a-usbtiny.Tpo" -c -o libavrdude_a-usbtiny.obj `if test -f 'usbtiny.c'; then $(CYGPATH_W) 'usbtiny.c'; else $(CYGPATH_W) '$(srcdir)/usbtiny.c'; fi`; \+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libavrdude_a-usbtiny.Tpo" "$(DEPDIR)/libavrdude_a-usbtiny.Po"; else rm -f "$(DEPDIR)/libavrdude_a-usbtiny.Tpo"; exit 1; fi+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='usbtiny.c' object='libavrdude_a-usbtiny.obj' libtool=no @AMDEPBACKSLASH@+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -c -o libavrdude_a-usbtiny.obj `if test -f 'usbtiny.c'; then $(CYGPATH_W) 'usbtiny.c'; else $(CYGPATH_W) '$(srcdir)/usbtiny.c'; fi`+ libavrdude_a-usb_libusb.o: usb_libusb.c @am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -MT libavrdude_a-usb_libusb.o -MD -MP -MF "$(DEPDIR)/libavrdude_a-usb_libusb.Tpo" -c -o libavrdude_a-usb_libusb.o `test -f 'usb_libusb.c' || echo '$(srcdir)/'`usb_libusb.c; \ @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libavrdude_a-usb_libusb.Tpo" "$(DEPDIR)/libavrdude_a-usb_libusb.Po"; else rm -f "$(DEPDIR)/libavrdude_a-usb_libusb.Tpo"; exit 1; fidiff -pu avrdude-5.4/avrdude.conf.in.orig avrdude-5.4/avrdude.conf.in--- avrdude-5.4/avrdude.conf.in.orig	2007-05-16 23:29:36.000000000 +0200+++ avrdude-5.4/avrdude.conf.in	2008-01-15 14:08:59.000000000 +0100@@ -779,6 +779,12 @@ programmer   miso  = 8; ; +programmer+  id	= "usbtiny";+  desc	= "USB programmer built with ATtiny2313";+  type	= usbtiny;+;+ # # PART DEFINITIONS #diff -pu avrdude-5.4/config_gram.y.orig avrdude-5.4/config_gram.y--- avrdude-5.4/config_gram.y.orig	2007-02-02 22:48:19.000000000 +0100+++ avrdude-5.4/config_gram.y	2008-01-15 14:08:59.000000000 +0100@@ -45,6 +45,7 @@ #include "avr.h" #include "jtagmkI.h" #include "jtagmkII.h"+#include "usbtiny.h"  #if defined(WIN32NATIVE) #define strtok_r( _s, _sep, _lasts ) \@@ -72,6 +73,7 @@ static int parse_cmdbits(OPCODE * op); %token K_WRITEPAGE %token K_CHIP_ERASE %token K_PGM_ENABLE+%token K_USBTINY  %token K_MEMORY @@ -481,6 +483,12 @@ prog_parm :     }   } | +  K_TYPE TKN_EQUAL K_USBTINY {+    {+      usbtiny_initpgm(current_prog);+    }+  } |+   K_DESC TKN_EQUAL TKN_STRING {     strncpy(current_prog->desc, $3->value.string, PGM_DESCLEN);     current_prog->desc[PGM_DESCLEN-1] = 0;diff -pu avrdude-5.4/lexer.l.orig avrdude-5.4/lexer.l--- avrdude-5.4/lexer.l.orig	2007-01-24 23:43:46.000000000 +0100+++ avrdude-5.4/lexer.l	2008-01-15 14:08:59.000000000 +0100@@ -183,6 +183,7 @@ stk500v2         { yylval=NULL; return K stk500generic    { yylval=NULL; return K_STK500GENERIC; } stk500_devcode   { yylval=NULL; return K_STK500_DEVCODE; } type             { yylval=NULL; return K_TYPE; }+usbtiny          { yylval=NULL; return K_USBTINY; } vcc              { yylval=NULL; return K_VCC; } vfyled           { yylval=NULL; return K_VFYLED; } diff -pu /dev/null avrdude-5.4/usbtiny.c--- /dev/null	2007-11-20 19:44:18.000000000 +0100+++ avrdude-5.4/usbtiny.c	2008-01-15 14:15:56.000000000 +0100@@ -0,0 +1,363 @@+// ----------------------------------------------------------------------+// Driver for the "usbtiny" programmer.+//+// Copyright 2006-2008 Dick Streefland+//+// This is free software, licensed under the terms of the GNU General+// Public License as published by the Free Software Foundation.+// ----------------------------------------------------------------------++#include <string.h>+#include <usb.h>+#include "pgm.h"+#include "avr.h"++// VID/PID assigned to USBtiny (http://www.ladyada.net/make/usbtinyisp/)+#define	USBTINY_VENDOR	0x1781+#define	USBTINY_PRODUCT	0x0C9F++enum+{+	// Generic requests+	USBTINY_ECHO,		// echo test+	USBTINY_READ,		// read byte (wIndex:address)+	USBTINY_WRITE,		// write byte (wIndex:address, wValue:value)+	USBTINY_CLR,		// clear bit (wIndex:address, wValue:bitno)+	USBTINY_SET,		// set bit (wIndex:address, wValue:bitno)+	// Programming requests+	USBTINY_POWERUP,	// apply power (wValue:SCK-period, wIndex:RESET)+	USBTINY_POWERDOWN,	// remove power from chip+	USBTINY_SPI,		// issue SPI command (wValue:c1c0, wIndex:c3c2)+	USBTINY_POLL_BYTES,	// set poll bytes for write (wValue:p1p2)+	USBTINY_FLASH_READ,	// read flash (wIndex:address)+	USBTINY_FLASH_WRITE,	// write flash (wIndex:address, wValue:timeout)+	USBTINY_EEPROM_READ,	// read eeprom (wIndex:address)+	USBTINY_EEPROM_WRITE,	// write eeprom (wIndex:address, wValue:timeout)+};++enum+{+	RESET_LOW	= 0,+	RESET_HIGH	= 1,+	SCK_MIN		= 1,	// usec (target clock >= 4 MHz)+	SCK_MAX		= 250,	// usec (target clock >= 16 KHz)+	SCK_DEFAULT	= 10,	// usec (target clock >= 0.4 MHz)+	CHUNK_SIZE	= 128,	// must be power of 2 less than 256+	USB_TIMEOUT	= 500,	// msec+};++typedef	unsigned char	byte_t;+typedef	unsigned int	uint_t;+typedef	unsigned long	ulong_t;++extern	int		avr_write_byte_default ( PROGRAMMER* pgm, AVRPART* p,+			                         AVRMEM* mem, ulong_t addr,+						 byte_t data );+extern	int		verbose;+extern	char*		progname;++static	usb_dev_handle*	usb_handle;+static	int		sck_period;+static	int		chunk_size;++// ----------------------------------------------------------------------++static	void	usb_control ( int req, int val, int index )+{+	usb_control_msg( usb_handle,+			 USB_ENDPOINT_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,+			 req, val, index, NULL, 0, USB_TIMEOUT );+}++static	int	usb_in ( int req, int val, int index, byte_t* buf, int buflen, int umax )+{+	int	n;+	int	timeout;++	timeout = USB_TIMEOUT + (buflen * umax) / 1000;+	n = usb_control_msg( usb_handle,+			USB_ENDPOINT_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,+			req, val, index, (char*) buf, buflen, timeout );+	if	( n != buflen )+	{+		fprintf( stderr, "USB read error: expected %d, got %d\n", buflen, n );+		return -1;+	}+	return 0;+}++static	int	usb_out ( int req, int val, int index, byte_t* buf, int buflen, int umax )+{+	int	n;+	int	timeout;++	timeout = USB_TIMEOUT + (buflen * umax) / 1000;+	n = usb_control_msg( usb_handle,+			USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,+			req, val, index, (char*) buf, buflen, timeout );+	if	( n != buflen )+	{+		fprintf( stderr, "USB write error: expected %d, got %d\n", buflen, n );+		return -1;+	}+	return 0;+}++static	int	usbtiny_avr_op ( PROGRAMMER* pgm, AVRPART* p, int op, byte_t res[4] )+{+	byte_t	cmd[4];++	if	( ! p->op[op] )+	{+		fprintf( stderr, "Operation %d not defined\n", op );+		return -1;+	}+	memset( cmd, 0, sizeof(cmd) );+	avr_set_bits( p->op[op], cmd );+	return pgm->cmd( pgm, cmd, res );+}++// ----------------------------------------------------------------------++static	int	usbtiny_open ( PROGRAMMER* pgm, char* name )+{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -