diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/USBtiny.cat b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/USBtiny.cat deleted file mode 100644 index adfc8cc..0000000 --- a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/USBtiny.cat +++ /dev/null @@ -1,3 +0,0 @@ -This file will contain the digital signature of the files to be installed -on the system. -This file will be provided by Microsoft upon certification of your drivers. \ No newline at end of file diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/amd64/libusb0.dll b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/amd64/libusb0.dll deleted file mode 100644 index 910716f..0000000 Binary files a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/amd64/libusb0.dll and /dev/null differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/amd64/libusb0.sys b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/amd64/libusb0.sys deleted file mode 100644 index 681056a..0000000 Binary files a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/amd64/libusb0.sys and /dev/null differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/ia64/libusb0.dll b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/ia64/libusb0.dll deleted file mode 100644 index 1f4bba2..0000000 Binary files a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/ia64/libusb0.dll and /dev/null differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/ia64/libusb0.sys b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/ia64/libusb0.sys deleted file mode 100644 index 4c69fbb..0000000 Binary files a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/ia64/libusb0.sys and /dev/null differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/installer_x64.exe b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/installer_x64.exe deleted file mode 100644 index 1e521cb..0000000 Binary files a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/installer_x64.exe and /dev/null differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/installer_x86.exe b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/installer_x86.exe deleted file mode 100644 index 2cbfed9..0000000 Binary files a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/installer_x86.exe and /dev/null differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/x86/libusb0.sys b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/x86/libusb0.sys deleted file mode 100644 index 3d56b9f..0000000 Binary files a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/x86/libusb0.sys and /dev/null differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/x86/libusb0_x86.dll b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/x86/libusb0_x86.dll deleted file mode 100644 index 4e7c34f..0000000 Binary files a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/x86/libusb0_x86.dll and /dev/null differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/USBtiny.inf b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/USBtiny.inf similarity index 94% rename from Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/USBtiny.inf rename to Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/USBtiny.inf index 7e7dbe0..9d035da 100644 Binary files a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/USBtiny.inf and b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/USBtiny.inf differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/amd64/libusb0.dll b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/amd64/libusb0.dll new file mode 100644 index 0000000..f916b08 Binary files /dev/null and b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/amd64/libusb0.dll differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/amd64/libusb0.sys b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/amd64/libusb0.sys new file mode 100644 index 0000000..0718dfb Binary files /dev/null and b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/amd64/libusb0.sys differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/ia64/libusb0.dll b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/ia64/libusb0.dll new file mode 100644 index 0000000..292df27 Binary files /dev/null and b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/ia64/libusb0.dll differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/ia64/libusb0.sys b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/ia64/libusb0.sys new file mode 100644 index 0000000..f17914b Binary files /dev/null and b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/ia64/libusb0.sys differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/installer_x64.exe b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/installer_x64.exe new file mode 100644 index 0000000..c38919e Binary files /dev/null and b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/installer_x64.exe differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/installer_x86.exe b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/installer_x86.exe new file mode 100644 index 0000000..030ec30 Binary files /dev/null and b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/installer_x86.exe differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/libusb-win32-bin-README.txt b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/libusb-win32-bin-README.txt similarity index 90% rename from Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/libusb-win32-bin-README.txt rename to Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/libusb-win32-bin-README.txt index 0dae5c7..455eb6b 100644 --- a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/libusb-win32-bin-README.txt +++ b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/libusb-win32-bin-README.txt @@ -1,4 +1,4 @@ -libusb-win32-bin v1.2.1.0 (07/28/2010) - [Package Information] +libusb-win32-bin v1.2.6.0 (01/17/2012) - [Package Information] ALL ARCHITECTURES: x86\libusb0_x86.dll: x86 32-bit library. Must be renamed to libusb0.dll @@ -6,7 +6,7 @@ ALL ARCHITECTURES: On 32 bit, Installs to Windows\system32\libusb0.dll. x86\inf-wizard.exe: inf-wizard application with embedded libusb-win32 - v1.2.1.0 binaries. + v1.2.6.0 binaries. X86 ONLY ARCHITECTURES: x86\libusb0.sys: x86 32-bit driver. diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/license/libusb-win32/installer_license.txt b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/license/libusb0/installer_license.txt similarity index 100% rename from Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.1.0/license/libusb-win32/installer_license.txt rename to Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/license/libusb0/installer_license.txt diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/x86/libusb0.sys b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/x86/libusb0.sys new file mode 100644 index 0000000..5322e5b Binary files /dev/null and b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/x86/libusb0.sys differ diff --git a/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/x86/libusb0_x86.dll b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/x86/libusb0_x86.dll new file mode 100644 index 0000000..6e475b9 Binary files /dev/null and b/Drivers/USBTinyDrivers/usbtinyisp_libusb-win32_1.2.6.0/x86/libusb0_x86.dll differ diff --git a/Drivers/Zadig/zadig_v2.0.1.160/zadig.exe b/Drivers/Zadig/zadig_v2.0.1.160/zadig.exe deleted file mode 100644 index eee1e9b..0000000 Binary files a/Drivers/Zadig/zadig_v2.0.1.160/zadig.exe and /dev/null differ diff --git a/Drivers/Zadig/zadig_v2.1.0.658/zadig.exe b/Drivers/Zadig/zadig_v2.1.0.658/zadig.exe new file mode 100644 index 0000000..024bdd3 Binary files /dev/null and b/Drivers/Zadig/zadig_v2.1.0.658/zadig.exe differ diff --git a/Firmware/pocket-prog/CHANGELOG b/Firmware/pocket-prog/CHANGELOG index af3431a..cfdb30c 100644 --- a/Firmware/pocket-prog/CHANGELOG +++ b/Firmware/pocket-prog/CHANGELOG @@ -57,3 +57,92 @@ o Fixed some build problems of the libusb python wrapper, and added o Made the flash and SRAM sizes configurable in the Makefile. + +2008-01-16 version 1.4 + +o Moved the assignment of a new USB device address to the interrupt + handler in order to avoid a race condition that sometimes occurred + when the PC was rebooted. + +o Updated the schematics with zener diodes on the data lines, because + some PCs seem to have problems with 5V data signals. + +o Changed the USB ids for the "spi" application to the VID/PID pair + of the USBtinyISP project (http://www.ladyada.net/make/usbtinyisp/), + because these ids are supported by avrdude since version 5.5. + +o Avrdude-5.1 patch replaced by new patch for avrdude-5.4. + +o New patch for lirc-0.8.2. + +o New configuration macro USBTINY_FAST_CRC to switch between two + versions of the CRC algorithm: slow & small or fast & large. + +o New make target "fuses" to program the low and high fuses. + + +2010-05-29 version 1.5 + +o Optimized the USB interrupt handler to make the code both faster + and smaller (22 bytes). The interrupt handler now also checks for + a pending transmission after an ignored packet and decodes it + directly without first returning from the interrupt handler. + +o Improved the execution speed of both versions of the CRC function. + The "slow" version got 25% faster and 4 bytes smaller, while the + "fast" version got 50% faster but 8 bytes larger (suggested by + Reimar Döffinger). + +o Added two new configuration macros: + USBTINY_DMINUS_PULLUP - control D- pullup resistor with an I/O pin. + USBTINY_USB_OK_LED - turn on a LED when the enumeration succeeded. + +o Added new compiler and linker options to reduce the code size. + +o Updated the timer input capture interrupt handler of the "ir" + application. The inline assembly code didn't work anymore with + newer gcc versions, because of changes in the register allocation. + The code now works for gcc-4.1.0 and gcc-4.3.4, but it is still + fragile. + +o Other changes of the "ir" application: + - The maximum number of IR data bytes is now 36 instead of 35. + - The LED briefly flashes after USB enumeration. + - Added power filtering for the TSOP1738 device in the schematic. + +o Added a new USBtiny application "usbtinyisp". This is a modified + version of the "spi" application, adapted for use in the USBtinyISP + AVR programmer (http://www.ladyada.net/make/usbtinyisp/). The code + works for both v1.0 and v2.0 devices. + +o Added a new template USBtiny application in the "template" subdirectory. + + +2010-11-17 version 1.6 + +o Fix for avr-gcc version 4.3.5. Because of a new optimization that + suppresses part of the startup code when there are no initialized + variables in the C code, two variables in usbtiny/int.S were not + initialized anymore. + +o Fixed incorrect initialization of "inpos" in ir/main.c. This bug + didn't affect the LIRC driver igorplugusb because it always uses + an offset of zero. + + +2014-05-02 version 1.7 + +o Changes for new avr-gcc and avr-libc versions: + - Use "const" for "PROGMEM" objects. + - Use new names for interrupt vectors. + - Use "inline" on "__attribute__((always_inline))" functions. + +o Added a new configuration macro USBTINY_NO_DATA to control the use of + initialized data by USBtiny. When the data section is empty, the code + to initialize the data section will be omitted from the startup code. + (suggested by William Chops Westfield) + +o Added support for transfers larger than 255 bytes through usb_in() by + defining USBTINY_CALLBACK_IN as 2 instead of 1. (suggested by Bernhard + Roth). + diff --git a/Firmware/pocket-prog/Makefile b/Firmware/pocket-prog/Makefile index 6c3a530..5c7408e 100644 --- a/Firmware/pocket-prog/Makefile +++ b/Firmware/pocket-prog/Makefile @@ -1,13 +1,13 @@ # ====================================================================== # USBtiny global Makefile # -# Copyright (C) 2006 Dick Streefland +# Copyright 2006-2010 Dick Streefland # # This is free software, licensed under the terms of the GNU General # Public License as published by the Free Software Foundation. # ====================================================================== -DIR = spi ir util +DIR = spi ir usbtinyisp template util all clean clobber: @for i in $(DIR); do $(MAKE) $(MFLAGS) -C $$i $@; done diff --git a/Firmware/pocket-prog/README b/Firmware/pocket-prog/README index 245018c..b7dc06e 100644 --- a/Firmware/pocket-prog/README +++ b/Firmware/pocket-prog/README @@ -6,7 +6,7 @@ the Atmel ATtiny microcontrollers. Of course, it will also work on the ATmega series. The software is written for an AVR clocked at 12 MHz. At this frequency, each bit on the USB bus takes 8 clock cycles, and with a lot of trickery, it is possible to decode and encode the USB -waveforms by software. The USB driver needs between 1300 and 1400 +waveforms by software. The USB driver needs approximately 1250 to 1350 bytes of flash space (excluding the optional identification strings), depending on the configuration and compiler version, and 46 bytes RAM (excluding stack space). The C interface consists of 3 to 5 functions, @@ -50,23 +50,25 @@ configured at the top of the Makefile. Other USB projects ================== -This software was inspired by two similar USB projects for the AVR: +This software was inspired by two similar USB projects for the AVR, +especially the second one: http://www.cesko.host.sk/IgorPlugUSB/IgorPlug-USB%20(AVR)_eng.htm http://www.obdev.at/products/avrusb/index.html -My version has the advantage that you have more freedom over which I/O -pins to use for the D+ and D- USB signals. You don't need to use bit 0 -for the D+ signal. The only restriction is that both signals should be -on the same I/O port. When you select a pin for D+ that can also -generate an interrupt, only two I/O pins are required. The pin-change -interrupt is deliberately not used, so that it remains available for -other uses. - -Another improvement is that the CRC calculation is faster, because it -uses a lookup table. A bit-wise calculation turned out to be too slow -for the USB controller in my laptop. For instance, the obdev code -worked fine on my desktop computer, but not on my laptop. +The IgorPlugUSB code and earlier versions of the obdev code had the +restriction that the D+ signal must be connected to bit 0 of an I/O +port, in addition to an interrupt input. That means that for devices +like the ATtiny2313, three I/O pins are required to control the USB bus. +One of the reasons I wrote USBtiny was to have more freedom over which +I/O pins to use for the D+ and D- USB signals. The only restriction +is that both signals should be on the same I/O port. When you select a +pin for D+ that can also generate an interrupt, only two I/O pins are +required. Later versions of the obdev code have also removed this +restriction. The pin-change interrupt is deliberately not used, so +that it remains available for other uses. Another improvement is an +optional faster CRC calculation that uses a lookup table to calculate +4 bits at a time. Apart from these advantages, I think that my code is more readable and easier to configure, but that impression may be caused by a mild form @@ -74,13 +76,18 @@ of the NIH syndrome that I'm suffering from. In any case, I learned a lot about the USB protocol, and writing the interrupt handler was a nice puzzle. +The USBtinyISP project is an AVR in-circuit programmer based on USBtiny, +and is available as a kit: + + http://www.ladyada.net/make/usbtinyisp/ + Hardware ======== The AVR must be clocked with an external 12 MHz crystal. For an ATtiny2313, this means that the low fuse byte must be reprogrammed, -for instance to 0xff. I also recommend to enable the BOD circuit, +for instance to 0xef. I also recommend to enable the BOD circuit, when available. For the ATtiny2313, this means programming the high fuse byte to 0xdb (BOD level is 2.7V). @@ -91,8 +98,8 @@ which may be more convenient when you need to interface to 5V peripherals. According to the USB specification, a device should not be damaged by 5V signals. I've been running the AVR and USB bus at 5V, and haven't encounter any problems so far, but I have some reports -of Viao laptops that do not work with 5V signals. In that case, you -can reduce the voltage of the USB data signals by adding 3V6 zener +of PCs and laptops that do not work with 5V signals. In that case, +you can reduce the voltage of the USB data signals by adding 3V6 zener diodes from the data signals to ground. @@ -106,14 +113,31 @@ port programmer. Because the most important parallel port signals are connected to the DB-25 connecter, the same hardware (with different firmware) could be used to control other parallel port devices. That is also the reason why I connected the ACK signal to the INT1 pin. -I didn't bother to put capacitors on the crystal, but they are -recommended for reliable operation. The software, the schematic and -a Python test script can be found in the "spi" subdirectory. - -The circuit may be powered via the diode at pin 14 of the DB-25 -connector to enable reprograming the ATtiny2313 in-system. This -requires an adaptor cable between another SPI programmer and a DB-25 -male connector with the following connections: +The software, the schematic and a Python test script can be found +in the "spi" subdirectory. + +My AVR parallel port programmer follows the "bsd" design from Brian +Dean (http://www.bsdhome.com/avrdude/). For safety, I've used series +resistors in the output signals. The Atmel device is powered by the +data lines D1-D3, via 220 Ohm resistors. D0 is used to control a LED. +Here is an ASCII-art version of the schematic: + +DB25 male ATtiny2313 +--------- ---------- +18 GND ----------------------+---- 10 GND + 2 D0 ---- 330 ---- LED ----+ + 3 D1 ---- 220 ---+ + 4 D2 ---- 220 ---+-------------- 20 VCC + 5 D3 ---- 220 ---+ + 7 D5 ---- 1K ------------------- 1 /RESET + 8 D6 ---- 680 ------------------ 19 SCK + 9 D7 ---- 1K ------------------- 17 MOSI +10 ACK --------------------------- 18 MISO + +The USBtiny circuit may be powered via the diode at pin 14 of the +DB-25 connector to enable reprograming the ATtiny2313 in-system. +This requires an adaptor cable between another SPI programmer and +a DB-25 male connector with the following connections: SPI DB25 --- ---- @@ -130,10 +154,11 @@ AVR. This means that you can send a 32-bit SPI command in a single USB packet. In addition, you can read or write up to 255 bytes from/to flash or EEPROM in a single control transfer. -The subdirectory "patches" contains a patch for avrdude-5.1 that adds +The subdirectory "patches" contains a patch for avrdude-5.4 that adds support for controlling this SPI converter. The programmer name is "usbtiny". You can use the -B option or the "sck" command to specify the minimum SCK period in microseconds (range: 1..250, default: 10). +Native support for USBtiny was added in avrdude version 5.5. USBtiny LIRC compatible IR receiver and LCD controller @@ -153,13 +178,29 @@ setting the LCD_PRESENT macro in main.c to 0. I adopted the "IgorPlug-USB" protocol, so that the existing LIRC device driver "igorplugusb" could be used without modifications. -Nevertheless, a patch for lirc-0.8.0 is included in the "patches" -subdirectory, with the following modifications: +Nevertheless, patches for lirc-0.8.0 and lirc-0.8.2 are included +in the "patches" subdirectory, with the following modifications: 1) An increase of the sample rate from 10 to 100 times per second. This is not required, but improves the responsiveness and repeat behavior for some remote controls. 2) A fix from Reinhard Max to get correct gap timings. -3) A compilation fix for the latest 2.6 Linux kernels. +3) A compilation fix for the latest 2.6 Linux kernels (lirc-0.8.0). + + +USB AVR programmer and SPI interface +==================================== + +The subdirectory "usbtinyisp" contains a modified version of the "spi" +application, that was adapted for use in the USBtinyISP AVR programmer +(http://www.ladyada.net/make/usbtinyisp/). The code works for both v1.0 +and v2.0 devices. + + +Template USBtiny application +============================ + +The directory "template" contains a minimal template application that +can be used as a starting point for new USBtiny applications. Tools @@ -179,14 +220,15 @@ programmer. I initially used gcc-3.4.3 with the -Os option, which generates reasonable compact code. Unfortunately, newer versions like gcc-4.1.0 -generate about 10% more code, and as a result, the application code +generated about 10% more code, and as a result, the application code did not fit in 2K anymore. To make it fit, I had to remove the optional vendor and device strings, by undefining the USBTINY_VENDOR_NAME and -USBTINY_DEVICE_NAME macros. +USBTINY_DEVICE_NAME macros. Fortunately, code generation has improved +in later versions such as gcc-4.3.4. -The schematics were created with gschem, which is part of the gEDA -package. The conversion to Postscript is done with a script that -invokes gschem non-interactively. +The schematics were created with gschem, from the geda-gschem package. +The conversion to Postscript is done with a script that invokes gschem +non-interactively. The "util" and application code subdirectories each contain their own Makefile. In addition, there is a global Makefile that recursively @@ -201,18 +243,17 @@ defines a class USBtiny that can be used to communicate with the USBtiny firmware. This class is used by the test scripts. The usbtiny.py module uses a Python wrapper around libusb that is -generated by "swig". Type "make" to build the wrapper. Of course, you -need to have swig, libusb and libusb-dev installed on your system. +generated by "swig". Type "make" to build the wrapper. You need to +have swig, libusb, libusb-dev and python-dev installed on your system. Libusb needs appropriate permissions to open a USB device. This means that you either have to run the scripts as "root", or you should configure the hotplug or udev system to relax the permissions of the device file created under /proc/bus/usb/ when the device is plugged -in. With udev, you can change the permissions by adding a rule like - - SUBSYSTEM=="usb_device", MODE="0666" +in. For instance, you can create a file 99-usbtiny.rules with the +following content in /etc/udev/rules.d/: -to the udev rules in /etc/udev/rules.d/ + SUBSYSTEM=="usb",ATTR{idVendor}=="1781",ATTR{idProduct}=="0c9f",GROUP="plugdev" License diff --git a/Firmware/pocket-prog/ir/Makefile b/Firmware/pocket-prog/ir/Makefile index 6455161..371a1d7 100644 --- a/Firmware/pocket-prog/ir/Makefile +++ b/Firmware/pocket-prog/ir/Makefile @@ -1,7 +1,7 @@ # ====================================================================== # Makefile for USB IR receiver # -# Copyright (C) 2006 Dick Streefland +# Copyright 2006-2010 Dick Streefland # # This is free software, licensed under the terms of the GNU General # Public License as published by the Free Software Foundation. @@ -11,7 +11,8 @@ USBTINY = ../usbtiny TARGET_ARCH = -mmcu=attiny2313 OBJECTS = main.o FLASH_CMD = avrdude -pt2313 -U flash:w:main.hex -STACK = 39 +FUSES_CMD = avrdude -pt2313 -U hfuse:w:0xdb:m -U lfuse:w:0xef:m +STACK = 38 FLASH = 2048 SRAM = 128 SCHEM = ir.ps diff --git a/Firmware/pocket-prog/ir/crc.o b/Firmware/pocket-prog/ir/crc.o deleted file mode 100644 index 71c74f9..0000000 Binary files a/Firmware/pocket-prog/ir/crc.o and /dev/null differ diff --git a/Firmware/pocket-prog/ir/int.o b/Firmware/pocket-prog/ir/int.o deleted file mode 100644 index 8d8b52d..0000000 Binary files a/Firmware/pocket-prog/ir/int.o and /dev/null differ diff --git a/Firmware/pocket-prog/ir/ir.ps b/Firmware/pocket-prog/ir/ir.ps index 1428041..049e016 100644 Binary files a/Firmware/pocket-prog/ir/ir.ps and b/Firmware/pocket-prog/ir/ir.ps differ diff --git a/Firmware/pocket-prog/ir/ir.py b/Firmware/pocket-prog/ir/ir.py index 82fb848..6369b15 100644 --- a/Firmware/pocket-prog/ir/ir.py +++ b/Firmware/pocket-prog/ir/ir.py @@ -1,6 +1,8 @@ #!/usr/bin/python # ====================================================================== # ir.py - USBtiny/ir test program +# +# Copyright 2006-2008 Dick Streefland # ====================================================================== import sys, os.path diff --git a/Firmware/pocket-prog/ir/ir.sch b/Firmware/pocket-prog/ir/ir.sch index ce12b10..d7e2a73 100644 --- a/Firmware/pocket-prog/ir/ir.sch +++ b/Firmware/pocket-prog/ir/ir.sch @@ -1,4 +1,4 @@ -v 20060906 1 +v 20081231 1 T 63600 57350 5 10 0 0 0 0 1 device=AT90S2313 T 63600 57550 5 10 0 0 0 0 1 @@ -21,19 +21,19 @@ T 63500 55500 8 10 0 1 0 0 1 class=IO T 67500 57850 5 10 0 0 0 0 1 device=DB25 -C 56900 56100 1 0 0 resistor-2.sym +C 57200 56100 1 0 0 resistor-2.sym { -T 57075 56350 5 10 1 1 0 0 1 +T 57575 56350 5 10 1 1 0 0 1 refdes=68 } -C 56900 55300 1 0 0 resistor-2.sym +C 57200 55300 1 0 0 resistor-2.sym { -T 57075 55550 5 10 1 1 0 0 1 +T 57575 55550 5 10 1 1 0 0 1 refdes=68 } -C 57800 55900 1 180 0 resistor-2.sym +C 58100 55900 1 180 0 resistor-2.sym { -T 57050 55950 5 10 1 1 0 0 1 +T 57550 55950 5 10 1 1 0 0 1 refdes=1K5 } T 65500 55650 5 10 0 0 0 0 1 @@ -44,289 +44,285 @@ T 65500 56050 5 10 0 0 0 0 1 net=GND:10 T 65500 56250 5 10 0 0 0 0 1 net=Vcc:20 -P 60000 53500 60000 53700 1 0 0 +P 60100 53500 60100 53700 1 0 0 { -T 60050 53600 5 8 1 1 0 0 1 +T 60150 53600 5 8 1 1 0 0 1 pinnumber=1 -T 60050 53600 5 8 0 1 0 2 1 +T 60150 53600 5 8 0 1 0 2 1 pinseq=1 -T 60000 53850 9 8 1 1 0 3 1 +T 60100 53850 9 8 1 1 0 3 1 pinlabel=Reset -T 60000 54000 5 8 0 1 0 3 1 +T 60100 54000 5 8 0 1 0 3 1 pintype=in } -L 59808 53974 60192 53974 3 0 0 0 -1 -1 -V 60000 53750 50 6 0 0 0 -1 -1 0 -1 -1 -1 -1 -1 -P 59300 53500 59300 53800 1 0 0 +L 59908 53974 60292 53974 3 0 0 0 -1 -1 +V 60100 53750 50 6 0 0 0 -1 -1 0 -1 -1 -1 -1 -1 +P 59400 53500 59400 53800 1 0 0 { -T 59350 53600 5 8 1 1 0 0 1 +T 59450 53600 5 8 1 1 0 0 1 pinnumber=4 -T 59350 53600 5 8 0 1 0 2 1 +T 59450 53600 5 8 0 1 0 2 1 pinseq=2 -T 59300 53850 9 8 1 1 0 3 1 +T 59400 53850 9 8 1 1 0 3 1 pinlabel=XTAL2 -T 59300 54000 5 8 0 1 0 3 1 +T 59400 54000 5 8 0 1 0 3 1 pintype=out } -P 58600 53500 58600 53800 1 0 0 +P 58700 53500 58700 53800 1 0 0 { -T 58650 53600 5 8 1 1 0 0 1 +T 58750 53600 5 8 1 1 0 0 1 pinnumber=5 -T 58650 53600 5 8 0 1 0 2 1 +T 58750 53600 5 8 0 1 0 2 1 pinseq=3 -T 58600 53850 9 8 1 1 0 3 1 +T 58700 53850 9 8 1 1 0 3 1 pinlabel=XTAL1 -T 58600 54000 5 8 0 1 0 3 1 +T 58700 54000 5 8 0 1 0 3 1 pintype=in } -P 58000 54600 58300 54600 1 0 0 +P 58100 54600 58400 54600 1 0 0 { -T 58200 54650 5 8 1 1 0 6 1 +T 58300 54650 5 8 1 1 0 6 1 pinnumber=11 -T 58200 54550 5 8 0 1 0 8 1 +T 58300 54550 5 8 0 1 0 8 1 pinseq=4 -T 58350 54600 9 8 1 1 0 0 1 +T 58450 54600 9 8 1 1 0 0 1 pinlabel=PD6 (ICP) -T 58350 54600 5 8 0 1 0 2 1 +T 58450 54600 5 8 0 1 0 2 1 pintype=io } -P 58000 55000 58300 55000 1 0 0 +P 58100 55000 58400 55000 1 0 0 { -T 58200 55050 5 8 1 1 0 6 1 +T 58300 55050 5 8 1 1 0 6 1 pinnumber=9 -T 58200 54950 5 8 0 1 0 8 1 +T 58300 54950 5 8 0 1 0 8 1 pinseq=5 -T 58350 55000 9 8 1 1 0 0 1 +T 58450 55000 9 8 1 1 0 0 1 pinlabel=PD5 (T1) -T 58350 55000 5 8 0 1 0 2 1 +T 58450 55000 5 8 0 1 0 2 1 pintype=io } -P 58000 55400 58300 55400 1 0 0 +P 58100 55400 58400 55400 1 0 0 { -T 58200 55450 5 8 1 1 0 6 1 +T 58300 55450 5 8 1 1 0 6 1 pinnumber=8 -T 58200 55350 5 8 0 1 0 8 1 +T 58300 55350 5 8 0 1 0 8 1 pinseq=6 -T 58350 55400 9 8 1 1 0 0 1 +T 58450 55400 9 8 1 1 0 0 1 pinlabel=PD4 (T0) -T 58350 55400 5 8 0 1 0 2 1 +T 58450 55400 5 8 0 1 0 2 1 pintype=io } -P 58000 55800 58300 55800 1 0 0 +P 58100 55800 58400 55800 1 0 0 { -T 58200 55850 5 8 1 1 0 6 1 +T 58300 55850 5 8 1 1 0 6 1 pinnumber=7 -T 58200 55750 5 8 0 1 0 8 1 +T 58300 55750 5 8 0 1 0 8 1 pinseq=7 -T 58350 55800 9 8 1 1 0 0 1 +T 58450 55800 9 8 1 1 0 0 1 pinlabel=PD3 (INT1) -T 58350 55800 5 8 0 1 0 2 1 +T 58450 55800 5 8 0 1 0 2 1 pintype=io } -P 58000 56200 58300 56200 1 0 0 +P 58100 56200 58400 56200 1 0 0 { -T 58200 56250 5 8 1 1 0 6 1 +T 58300 56250 5 8 1 1 0 6 1 pinnumber=6 -T 58200 56150 5 8 0 1 0 8 1 +T 58300 56150 5 8 0 1 0 8 1 pinseq=8 -T 58350 56200 9 8 1 1 0 0 1 +T 58450 56200 9 8 1 1 0 0 1 pinlabel=PD2 (INT0) -T 58350 56200 5 8 0 1 0 2 1 +T 58450 56200 5 8 0 1 0 2 1 pintype=io } -P 58000 56600 58300 56600 1 0 0 +P 58100 56600 58400 56600 1 0 0 { -T 58200 56650 5 8 1 1 0 6 1 +T 58300 56650 5 8 1 1 0 6 1 pinnumber=3 -T 58200 56550 5 8 0 1 0 8 1 +T 58300 56550 5 8 0 1 0 8 1 pinseq=9 -T 58350 56600 9 8 1 1 0 0 1 +T 58450 56600 9 8 1 1 0 0 1 pinlabel=PD1 (TXD) -T 58350 56600 5 8 0 1 0 2 1 +T 58450 56600 5 8 0 1 0 2 1 pintype=io } -P 58000 57000 58300 57000 1 0 0 +P 58100 57000 58400 57000 1 0 0 { -T 58200 57050 5 8 1 1 0 6 1 +T 58300 57050 5 8 1 1 0 6 1 pinnumber=2 -T 58200 56950 5 8 0 1 0 8 1 +T 58300 56950 5 8 0 1 0 8 1 pinseq=10 -T 58350 57000 9 8 1 1 0 0 1 +T 58450 57000 9 8 1 1 0 0 1 pinlabel=PD0 (RXD) -T 58350 57000 5 8 0 1 0 2 1 +T 58450 57000 5 8 0 1 0 2 1 pintype=io } -P 60600 54200 60300 54200 1 0 0 +P 60700 54200 60400 54200 1 0 0 { -T 60400 54250 5 8 1 1 0 0 1 +T 60500 54250 5 8 1 1 0 0 1 pinnumber=19 -T 60400 54150 5 8 0 1 0 2 1 +T 60500 54150 5 8 0 1 0 2 1 pinseq=11 -T 60250 54200 9 8 1 1 0 6 1 +T 60350 54200 9 8 1 1 0 6 1 pinlabel=(SCK) PB7 -T 60250 54200 5 8 0 1 0 8 1 +T 60350 54200 5 8 0 1 0 8 1 pintype=io } -P 60600 54600 60300 54600 1 0 0 +P 60700 54600 60400 54600 1 0 0 { -T 60400 54650 5 8 1 1 0 0 1 +T 60500 54650 5 8 1 1 0 0 1 pinnumber=18 -T 60400 54550 5 8 0 1 0 2 1 +T 60500 54550 5 8 0 1 0 2 1 pinseq=12 -T 60250 54600 9 8 1 1 0 6 1 +T 60350 54600 9 8 1 1 0 6 1 pinlabel=(MISO) PB6 -T 60250 54600 5 8 0 1 0 8 1 +T 60350 54600 5 8 0 1 0 8 1 pintype=io } -P 60600 55000 60300 55000 1 0 0 +P 60700 55000 60400 55000 1 0 0 { -T 60400 55050 5 8 1 1 0 0 1 +T 60500 55050 5 8 1 1 0 0 1 pinnumber=17 -T 60400 54950 5 8 0 1 0 2 1 +T 60500 54950 5 8 0 1 0 2 1 pinseq=13 -T 60250 55000 9 8 1 1 0 6 1 +T 60350 55000 9 8 1 1 0 6 1 pinlabel=(MOSI) PB5 -T 60250 55000 5 8 0 1 0 8 1 +T 60350 55000 5 8 0 1 0 8 1 pintype=io } -P 60600 55400 60300 55400 1 0 0 +P 60700 55400 60400 55400 1 0 0 { -T 60400 55450 5 8 1 1 0 0 1 +T 60500 55450 5 8 1 1 0 0 1 pinnumber=16 -T 60400 55350 5 8 0 1 0 2 1 +T 60500 55350 5 8 0 1 0 2 1 pinseq=14 -T 60250 55400 9 8 1 1 0 6 1 +T 60350 55400 9 8 1 1 0 6 1 pinlabel=PB4 -T 60250 55400 5 8 0 1 0 8 1 +T 60350 55400 5 8 0 1 0 8 1 pintype=io } -P 60600 55800 60300 55800 1 0 0 +P 60700 55800 60400 55800 1 0 0 { -T 60400 55850 5 8 1 1 0 0 1 +T 60500 55850 5 8 1 1 0 0 1 pinnumber=15 -T 60400 55750 5 8 0 1 0 2 1 +T 60500 55750 5 8 0 1 0 2 1 pinseq=15 -T 60250 55800 9 8 1 1 0 6 1 +T 60350 55800 9 8 1 1 0 6 1 pinlabel=(OC1) PB3 -T 60250 55800 5 8 0 1 0 8 1 +T 60350 55800 5 8 0 1 0 8 1 pintype=io } -P 60600 56200 60300 56200 1 0 0 +P 60700 56200 60400 56200 1 0 0 { -T 60400 56250 5 8 1 1 0 0 1 +T 60500 56250 5 8 1 1 0 0 1 pinnumber=14 -T 60400 56150 5 8 0 1 0 2 1 +T 60500 56150 5 8 0 1 0 2 1 pinseq=16 -T 60250 56200 9 8 1 1 0 6 1 +T 60350 56200 9 8 1 1 0 6 1 pinlabel=PB2 -T 60250 56200 5 8 0 1 0 8 1 +T 60350 56200 5 8 0 1 0 8 1 pintype=io } -P 60600 56600 60300 56600 1 0 0 +P 60700 56600 60400 56600 1 0 0 { -T 60400 56650 5 8 1 1 0 0 1 +T 60500 56650 5 8 1 1 0 0 1 pinnumber=13 -T 60400 56550 5 8 0 1 0 2 1 +T 60500 56550 5 8 0 1 0 2 1 pinseq=17 -T 60250 56600 9 8 1 1 0 6 1 +T 60350 56600 9 8 1 1 0 6 1 pinlabel=(AIN1) PB1 -T 60250 56600 5 8 0 1 0 8 1 +T 60350 56600 5 8 0 1 0 8 1 pintype=io } -P 60600 57000 60300 57000 1 0 0 +P 60700 57000 60400 57000 1 0 0 { -T 60400 57050 5 8 1 1 0 0 1 +T 60500 57050 5 8 1 1 0 0 1 pinnumber=12 -T 60400 56950 5 8 0 1 0 2 1 +T 60500 56950 5 8 0 1 0 2 1 pinseq=18 -T 60250 57000 9 8 1 1 0 6 1 +T 60350 57000 9 8 1 1 0 6 1 pinlabel=(AIN0) PB0 -T 60250 57000 5 8 0 1 0 8 1 +T 60350 57000 5 8 0 1 0 8 1 pintype=io } -B 58300 53800 2000 3600 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1 +B 58400 53800 2000 3600 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1 T 65500 56450 5 10 0 0 0 0 1 description=8-bit RISC micro controller (Atmel) T 65500 56650 5 10 0 0 0 0 1 numslots=0 T 65500 56850 5 10 0 0 0 0 1 author=Werner Hoch -T 58300 57450 9 10 1 0 0 0 1 +T 58400 57450 9 10 1 0 0 0 1 ATtiny2313 -C 54500 54600 1 0 0 connector4-1.sym +C 54900 54600 1 0 0 connector4-1.sym { -T 54500 56000 5 10 1 1 0 0 1 +T 54900 56000 5 10 1 1 0 0 1 refdes=USB } -N 56200 55100 56600 55100 4 -N 56600 55100 56600 56200 4 -N 56600 56200 56900 56200 4 -N 58600 53500 58600 53400 4 -N 59300 53500 59300 53400 4 -N 57800 56200 58000 56200 4 -N 57800 55400 58000 55400 4 -N 56200 54800 56200 52500 4 -T 60700 52200 9 10 1 0 0 0 1 +N 57100 55100 57100 56200 4 +N 58700 53500 58700 53400 4 +N 59400 53500 59400 53400 4 +T 64300 52200 9 10 1 0 0 6 1 IR receiver and LCD controller with USB interface -T 55100 55800 9 10 1 0 0 0 1 -Vcc -T 55100 55500 9 10 1 0 0 0 1 +T 55500 55500 9 10 1 0 0 0 2 +VCC + +T 55500 55500 9 10 1 0 0 0 1 D- -T 55100 55200 9 10 1 0 0 0 1 +T 55500 55200 9 10 1 0 0 0 1 D+ -T 55100 54900 9 10 1 0 0 0 1 +T 55500 54900 9 10 1 0 0 0 1 GND -C 58600 53300 1 0 0 crystal-1.sym +C 58700 53300 1 0 0 crystal-1.sym { -T 58650 53100 5 10 1 1 0 0 1 +T 58750 53100 5 10 1 1 0 0 1 refdes=12MHz -T 58800 54000 5 10 0 0 0 0 1 +T 58900 54000 5 10 0 0 0 0 1 symversion=0.1 } -C 60200 53400 1 90 1 capacitor-4.sym +C 60300 53400 1 90 1 capacitor-4.sym { -T 60300 52700 5 10 1 1 0 6 1 +T 60400 52700 5 10 1 1 0 6 1 refdes=1uF -T 59500 53200 5 10 0 0 270 2 1 +T 59600 53200 5 10 0 0 270 2 1 symversion=0.1 } -C 56100 52200 1 0 0 EMBEDDEDgnd-1.sym +C 56500 52200 1 0 0 EMBEDDEDgnd-1.sym [ -P 56200 52300 56200 52500 1 0 1 +P 56600 52300 56600 52500 1 0 1 { -T 56258 52361 5 4 0 1 0 0 1 +T 56658 52361 5 4 0 1 0 0 1 pinnumber=1 -T 56258 52361 5 4 0 0 0 0 1 +T 56658 52361 5 4 0 0 0 0 1 pinseq=1 -T 56258 52361 5 4 0 1 0 0 1 +T 56658 52361 5 4 0 1 0 0 1 pinlabel=1 -T 56258 52361 5 4 0 1 0 0 1 +T 56658 52361 5 4 0 1 0 0 1 pintype=pwr } -L 56100 52300 56300 52300 3 0 0 0 -1 -1 -L 56155 52250 56245 52250 3 0 0 0 -1 -1 -L 56180 52210 56220 52210 3 0 0 0 -1 -1 -T 56400 52250 8 10 0 0 0 0 1 +L 56500 52300 56700 52300 3 0 0 0 -1 -1 +L 56555 52250 56645 52250 3 0 0 0 -1 -1 +L 56580 52210 56620 52210 3 0 0 0 -1 -1 +T 56800 52250 8 10 0 0 0 0 1 net=GND:1 ] -C 59500 52500 1 90 0 capacitor-1.sym +C 59600 52500 1 90 0 capacitor-1.sym { -T 59800 52800 5 10 1 1 180 0 1 +T 59900 52800 5 10 1 1 180 0 1 refdes=27pF -T 58600 52700 5 10 0 0 90 0 1 +T 58700 52700 5 10 0 0 90 0 1 symversion=0.1 } -C 58800 52500 1 90 0 capacitor-1.sym +C 58900 52500 1 90 0 capacitor-1.sym { -T 59100 52800 5 10 1 1 180 0 1 +T 59200 52800 5 10 1 1 180 0 1 refdes=27pF -T 57900 52700 5 10 0 0 90 0 1 +T 58000 52700 5 10 0 0 90 0 1 symversion=0.1 } -C 56500 53400 1 270 0 led-2.sym -C 56500 54300 1 270 0 resistor-2.sym +C 57900 53400 1 270 0 led-2.sym +C 57900 54250 1 270 0 resistor-2.sym { -T 56600 54300 5 10 1 1 180 0 1 +T 58000 54250 5 10 1 1 180 0 1 refdes=330 } T 62150 54650 5 10 0 0 0 0 1 @@ -341,275 +337,301 @@ T 62150 54850 5 10 0 0 0 0 1 symversion=0.1 T 62150 55650 5 10 0 0 0 0 1 comment=NC-PINS:1,5,8 -C 60300 53400 1 0 0 vcc-2.sym -L 56800 54200 57800 54200 3 0 0 0 -1 -1 -L 57800 54200 57800 54800 3 0 0 0 -1 -1 -L 56800 54800 56800 54200 3 0 0 0 -1 -1 -P 57700 54200 57700 53900 1 0 1 -{ -T 57750 54050 5 8 1 1 0 0 1 -pinnumber=3 -T 57650 54050 5 8 0 1 270 2 1 -pinseq=6 -T 57700 54100 9 8 0 1 270 6 1 -pinlabel=OUT -T 57700 54100 5 8 0 1 270 8 1 -pintype=out -} -P 57200 54200 57200 53900 1 0 1 -{ -T 57250 54050 5 8 1 1 0 0 1 -pinnumber=2 -T 57150 54200 5 8 0 1 180 2 1 -pinseq=7 -T 57200 54200 9 8 0 1 180 5 1 -pinlabel=V+ -T 57200 54250 5 8 0 1 180 5 1 -pintype=pwr -} -P 56900 54200 56900 53900 1 0 1 -{ -T 56950 54050 5 8 1 1 0 0 1 -pinnumber=1 -T 56950 54000 5 8 0 1 0 2 1 -pinseq=4 -T 56900 54100 9 8 0 1 0 3 1 -pinlabel=V- -T 56900 54200 5 8 0 1 0 3 1 -pintype=pwr -} -T 56925 54450 9 8 1 0 0 0 1 -TSOP1738 -L 56800 54800 57800 54800 3 0 0 0 -1 -1 -C 57300 53400 1 0 0 vcc-2.sym -N 56900 53900 56900 52500 4 -N 58000 54600 58000 53900 4 -N 58000 53900 57700 53900 4 -N 60600 57000 61400 57000 4 -N 61400 57000 61400 54400 4 -N 61400 54400 62400 54400 4 -N 60600 56600 61200 56600 4 -N 61200 56600 61200 54100 4 -N 61200 54100 62400 54100 4 -N 60600 56200 61000 56200 4 -N 61000 56200 61000 53800 4 -N 61000 53800 62400 53800 4 -N 60600 55800 60800 55800 4 -N 60800 53500 62400 53500 4 -N 62400 56500 61600 56500 4 -N 61600 56500 61600 55400 4 -N 61600 55400 60600 55400 4 -N 62400 56200 61800 56200 4 -N 61800 56200 61800 55000 4 -N 61800 55000 60600 55000 4 -N 60600 54600 62000 54600 4 -N 62000 54600 62000 55900 4 -N 62000 55900 62400 55900 4 -C 62300 57500 1 180 0 resistor-variable-2.sym -{ -T 61650 57600 5 10 1 1 0 0 1 -refdes=10K -} -C 62200 57100 1 0 0 EMBEDDEDgnd-1.sym -[ -P 62300 57200 62300 57400 1 0 1 -{ -T 62358 57261 5 4 0 1 0 0 1 -pinnumber=1 -T 62358 57261 5 4 0 0 0 0 1 -pinseq=1 -T 62358 57261 5 4 0 1 0 0 1 -pinlabel=1 -T 62358 57261 5 4 0 1 0 0 1 -pintype=pwr -} -L 62200 57200 62400 57200 3 0 0 0 -1 -1 -L 62255 57150 62345 57150 3 0 0 0 -1 -1 -L 62280 57110 62320 57110 3 0 0 0 -1 -1 -T 62500 57150 8 10 0 0 0 0 1 -net=GND:1 -] -N 62400 56800 61800 56800 4 -N 61800 56800 61800 56900 4 -N 62300 57400 62400 57400 4 -C 61200 57400 1 0 0 vcc-2.sym -N 62400 57100 61400 57100 4 -N 61400 57100 61400 57400 4 -N 56200 55400 56900 55400 4 -N 60000 53500 60000 53400 4 -B 62700 52600 2200 5100 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1 -{ -T 63400 58175 8 10 0 0 0 0 1 +C 60400 53400 1 0 0 vcc-2.sym +N 60700 57000 61400 57000 4 +N 61400 57000 61400 54300 4 +N 61400 54300 62200 54300 4 +N 60700 56600 61200 56600 4 +N 61200 56600 61200 54000 4 +N 61200 54000 62200 54000 4 +N 60700 56200 61000 56200 4 +N 61000 56200 61000 53700 4 +N 61000 53700 62200 53700 4 +N 60700 55800 60800 55800 4 +N 60800 53400 62200 53400 4 +N 62200 56400 61600 56400 4 +N 61600 56400 61600 55400 4 +N 61600 55400 60700 55400 4 +N 62200 56100 61800 56100 4 +N 61800 56100 61800 55000 4 +N 61800 55000 60700 55000 4 +N 60700 54600 62000 54600 4 +N 62000 54600 62000 55800 4 +N 62000 55800 62200 55800 4 +N 56600 55400 57200 55400 4 +N 60100 53500 60100 53400 4 +B 62500 52500 1800 5100 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1 +{ +T 63200 58075 8 10 0 0 0 0 1 device=LCD } -T 62775 57400 3 8 1 0 0 0 1 +T 62575 57300 3 8 1 0 0 0 1 VSS (GND) -P 62700 57400 62400 57400 1 0 1 +P 62500 57300 62200 57300 1 0 1 { -T 62536 57450 5 8 1 1 0 0 1 +T 62336 57350 5 8 1 1 0 0 1 pinnumber=1 -T 62536 57450 5 8 0 0 0 0 1 +T 62336 57350 5 8 0 0 0 0 1 pinseq=1 } -T 62775 57100 3 8 1 0 0 0 1 +T 62575 57000 3 8 1 0 0 0 1 VDD (VCC) -P 62700 57100 62400 57100 1 0 1 +P 62500 57000 62200 57000 1 0 1 { -T 62496 57150 5 8 1 1 0 0 1 +T 62296 57050 5 8 1 1 0 0 1 pinnumber=2 -T 62496 57150 5 8 0 0 0 0 1 +T 62296 57050 5 8 0 0 0 0 1 pinseq=2 } -T 62775 56800 3 8 1 0 0 0 1 +T 62575 56700 3 8 1 0 0 0 1 V0 -P 62700 56800 62400 56800 1 0 1 +P 62500 56700 62200 56700 1 0 1 { -T 62520 56850 5 8 1 1 0 0 1 +T 62320 56750 5 8 1 1 0 0 1 pinnumber=3 -T 62520 56850 5 8 0 0 0 0 1 +T 62320 56750 5 8 0 0 0 0 1 pinseq=3 } -T 62775 56500 3 8 1 0 0 0 1 +T 62575 56400 3 8 1 0 0 0 1 RS -P 62700 56500 62400 56500 1 0 1 +P 62500 56400 62200 56400 1 0 1 { -T 62496 56550 5 8 1 1 0 0 1 +T 62296 56450 5 8 1 1 0 0 1 pinnumber=4 -T 62496 56550 5 8 0 0 0 0 1 +T 62296 56450 5 8 0 0 0 0 1 pinseq=4 } -T 62775 56200 3 8 1 0 0 0 1 +T 62575 56100 3 8 1 0 0 0 1 R/W -P 62700 56200 62400 56200 1 0 1 +P 62500 56100 62200 56100 1 0 1 { -T 62520 56250 5 8 1 1 0 0 1 +T 62320 56150 5 8 1 1 0 0 1 pinnumber=5 -T 62520 56250 5 8 0 0 0 0 1 +T 62320 56150 5 8 0 0 0 0 1 pinseq=5 } -T 62775 55900 3 8 1 0 0 0 1 +T 62575 55800 3 8 1 0 0 0 1 E -P 62700 55900 62400 55900 1 0 1 +P 62500 55800 62200 55800 1 0 1 { -T 62504 55950 5 8 1 1 0 0 1 +T 62304 55850 5 8 1 1 0 0 1 pinnumber=6 -T 62504 55950 5 8 0 0 0 0 1 +T 62304 55850 5 8 0 0 0 0 1 pinseq=6 } -T 62750 55600 3 8 1 0 0 0 1 +T 62550 55500 3 8 1 0 0 0 1 DB0 -P 62700 55600 62400 55600 1 0 1 +P 62500 55500 62200 55500 1 0 1 { -T 62520 55650 5 8 1 1 0 0 1 +T 62320 55550 5 8 1 1 0 0 1 pinnumber=7 -T 62520 55650 5 8 0 0 0 0 1 +T 62320 55550 5 8 0 0 0 0 1 pinseq=7 } -T 62750 55300 3 8 1 0 0 0 1 +T 62550 55200 3 8 1 0 0 0 1 DB1 -P 62700 55300 62400 55300 1 0 1 +P 62500 55200 62200 55200 1 0 1 { -T 62512 55350 5 8 1 1 0 0 1 +T 62312 55250 5 8 1 1 0 0 1 pinnumber=8 -T 62512 55350 5 8 0 0 0 0 1 +T 62312 55250 5 8 0 0 0 0 1 pinseq=8 } -T 62750 55000 3 8 1 0 0 0 1 +T 62550 54900 3 8 1 0 0 0 1 DB2 -P 62700 55000 62400 55000 1 0 1 +P 62500 54900 62200 54900 1 0 1 { -T 62496 55050 5 8 1 1 0 0 1 +T 62296 54950 5 8 1 1 0 0 1 pinnumber=9 -T 62496 55050 5 8 0 0 0 0 1 +T 62296 54950 5 8 0 0 0 0 1 pinseq=9 } -T 62750 54700 3 8 1 0 0 0 1 +T 62550 54600 3 8 1 0 0 0 1 DB3 -P 62400 54700 62700 54700 1 0 0 +P 62200 54600 62500 54600 1 0 0 { -T 62500 54750 5 8 1 1 0 0 1 +T 62300 54650 5 8 1 1 0 0 1 pinnumber=10 -T 62500 54750 5 8 0 0 0 0 1 +T 62300 54650 5 8 0 0 0 0 1 pinseq=10 } -T 62750 54400 3 8 1 0 0 0 1 +T 62550 54300 3 8 1 0 0 0 1 DB4 -P 62400 54400 62700 54400 1 0 0 +P 62200 54300 62500 54300 1 0 0 { -T 62500 54450 5 8 1 1 0 0 1 +T 62300 54350 5 8 1 1 0 0 1 pinnumber=11 -T 62500 54450 5 8 0 0 0 0 1 +T 62300 54350 5 8 0 0 0 0 1 pinseq=11 } -T 62750 54100 3 8 1 0 0 0 1 +T 62550 54000 3 8 1 0 0 0 1 DB5 -P 62400 54100 62700 54100 1 0 0 +P 62200 54000 62500 54000 1 0 0 { -T 62500 54150 5 8 1 1 0 0 1 +T 62300 54050 5 8 1 1 0 0 1 pinnumber=12 -T 62500 54150 5 8 0 0 0 0 1 +T 62300 54050 5 8 0 0 0 0 1 pinseq=12 } -T 62750 53800 3 8 1 0 0 0 1 +T 62550 53700 3 8 1 0 0 0 1 DB6 -P 62400 53800 62700 53800 1 0 0 +P 62200 53700 62500 53700 1 0 0 { -T 62500 53850 5 8 1 1 0 0 1 +T 62300 53750 5 8 1 1 0 0 1 pinnumber=13 -T 62500 53850 5 8 0 0 0 0 1 +T 62300 53750 5 8 0 0 0 0 1 pinseq=13 } -T 62750 53500 3 8 1 0 0 0 1 +T 62550 53400 3 8 1 0 0 0 1 DB7 -P 62400 53500 62700 53500 1 0 0 +P 62200 53400 62500 53400 1 0 0 { -T 62500 53550 5 8 1 1 0 0 1 +T 62300 53450 5 8 1 1 0 0 1 pinnumber=14 -T 62500 53550 5 8 0 0 0 0 1 +T 62300 53450 5 8 0 0 0 0 1 pinseq=14 } -T 62750 53200 3 8 1 0 0 0 1 +T 62550 53100 3 8 1 0 0 0 1 A -P 62400 53200 62700 53200 1 0 0 +P 62200 53100 62500 53100 1 0 0 { -T 62500 53250 5 8 1 1 0 0 1 +T 62300 53150 5 8 1 1 0 0 1 pinnumber=15 -T 62500 53250 5 8 0 0 0 0 1 +T 62300 53150 5 8 0 0 0 0 1 pinseq=15 } -T 62750 52900 3 8 1 0 0 0 1 +T 62550 52800 3 8 1 0 0 0 1 K -P 62400 52900 62700 52900 1 0 0 +P 62200 52800 62500 52800 1 0 0 { -T 62500 52950 5 8 1 1 0 0 1 +T 62300 52850 5 8 1 1 0 0 1 pinnumber=16 -T 62500 52950 5 8 0 0 0 0 1 +T 62300 52850 5 8 0 0 0 0 1 pinseq=16 } -B 63700 52800 1000 4700 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1 -L 62900 56350 63100 56350 3 0 0 0 -1 -1 -T 63900 55200 9 15 1 0 0 0 1 +B 63400 52700 700 4700 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1 +L 62700 56250 62800 56250 3 0 0 0 -1 -1 +T 63500 55100 9 15 1 0 0 0 1 LCD -C 57400 53400 1 90 1 capacitor-4.sym -{ -T 57500 52700 5 10 1 1 0 6 1 -refdes=1uF -T 56700 53200 5 10 0 0 270 2 1 -symversion=0.1 -} -N 56600 54300 56600 55000 4 -N 56600 55000 58000 55000 4 -N 57800 55800 58000 55800 4 -C 56000 55700 1 0 0 vcc-2.sym -N 56900 55800 56800 55800 4 -N 56800 55800 56800 55400 4 -N 57200 53900 57200 53400 4 +N 57200 55800 56900 55800 4 +N 56900 55800 56900 55400 4 C 60900 53400 1 90 1 resistor-2.sym { -T 60300 53000 5 10 1 1 180 6 1 +T 60900 53000 5 10 1 1 180 6 1 refdes=22K } -N 57200 53400 57500 53400 4 -N 60000 53400 60500 53400 4 -N 56200 52500 60800 52500 4 +N 60100 53400 60600 53400 4 N 60800 53400 60800 55800 4 +N 58000 54250 58000 55000 4 +C 57600 52500 1 90 0 zener-1.sym +{ +T 57000 52900 5 10 0 0 90 0 1 +device=ZENER_DIODE +T 57800 53400 5 10 1 1 180 0 1 +refdes=3V6 +} +C 57100 52500 1 90 0 zener-1.sym +{ +T 57300 53400 5 10 1 1 180 0 1 +refdes=3V6 +T 56500 52900 5 10 0 0 90 0 1 +device=ZENER_DIODE +} +N 56900 53400 56900 55400 4 +N 57400 53400 57400 55100 4 +N 56600 55100 57400 55100 4 +N 55800 54600 58100 54600 4 +N 57100 56200 57200 56200 4 +C 56400 55700 1 0 0 vcc-2.sym +N 56600 54800 56600 52500 4 +L 55500 52400 55500 53400 3 0 0 0 -1 -1 +L 55500 53400 54900 53400 3 0 0 0 -1 -1 +L 54900 52400 55500 52400 3 0 0 0 -1 -1 +P 55500 53300 55800 53300 1 0 1 +{ +T 55595 53345 5 8 1 1 0 0 1 +pinnumber=3 +T 55650 53250 5 8 0 1 0 2 1 +pinseq=6 +T 55445 53295 9 8 0 1 0 6 1 +pinlabel=OUT +T 55600 53300 5 8 0 1 0 8 1 +pintype=out +} +P 55500 52800 55800 52800 1 0 1 +{ +T 55595 52845 5 8 1 1 0 0 1 +pinnumber=2 +T 55500 52750 5 8 0 1 270 2 1 +pinseq=7 +T 55445 52795 9 8 0 1 0 6 1 +pinlabel=V+ +T 55450 52800 5 8 0 1 270 5 1 +pintype=pwr +} +P 55500 52500 55800 52500 1 0 1 +{ +T 55595 52545 5 8 1 1 0 0 1 +pinnumber=1 +T 55700 52550 5 8 0 1 90 2 1 +pinseq=4 +T 55445 52495 9 8 0 1 0 6 1 +pinlabel=V- +T 55500 52500 5 8 0 1 90 3 1 +pintype=pwr +} +L 54900 52400 54900 53400 3 0 0 0 -1 -1 +T 55225 52900 9 8 1 0 180 4 2 +TSOP + 1738 +C 56500 53400 1 90 1 capacitor-4.sym +{ +T 55800 52800 5 10 1 1 180 6 1 +refdes=4.7uF +T 55800 53200 5 10 0 1 270 2 1 +symversion=0.1 +} +C 56200 54300 1 270 0 resistor-2.sym +{ +T 56300 54300 5 10 1 1 180 0 1 +refdes=100 +} +N 56300 55700 56300 54300 4 +N 55800 52500 60800 52500 4 +N 55800 52800 56000 52800 4 +N 56000 52800 56000 53400 4 +N 56000 53400 56300 53400 4 +N 55800 53300 55800 54600 4 +C 61200 57400 1 180 1 resistor-variable-2.sym +{ +T 61850 57450 5 10 1 1 0 6 1 +refdes=10K +} +N 62100 57300 62200 57300 4 +N 61700 56800 61700 56700 4 +N 61700 56700 62200 56700 4 +C 62000 57000 1 0 0 EMBEDDEDgnd-1.sym +[ +P 62100 57100 62100 57300 1 0 1 +{ +T 62158 57161 5 4 0 1 0 0 1 +pinnumber=1 +T 62158 57161 5 4 0 0 0 0 1 +pinseq=1 +T 62158 57161 5 4 0 1 0 0 1 +pinlabel=1 +T 62158 57161 5 4 0 1 0 0 1 +pintype=pwr +} +L 62000 57100 62200 57100 3 0 0 0 -1 -1 +L 62055 57050 62145 57050 3 0 0 0 -1 -1 +L 62080 57010 62120 57010 3 0 0 0 -1 -1 +T 62300 57050 8 10 0 0 0 0 1 +net=GND:1 +] +C 61000 57300 1 0 0 vcc-2.sym +N 62200 57000 61500 57000 4 +N 61500 57000 61500 57100 4 +N 61500 57100 61200 57100 4 +N 61200 57100 61200 57300 4 +N 58000 55000 58100 55000 4 diff --git a/Firmware/pocket-prog/ir/main.c b/Firmware/pocket-prog/ir/main.c index 2c6fd59..b03958e 100644 --- a/Firmware/pocket-prog/ir/main.c +++ b/Firmware/pocket-prog/ir/main.c @@ -3,7 +3,7 @@ // // Read IR mark/space patterns from a TSOP1738 on the ICP input pin. // Mark and space periods are measured in units of 12Mhz/1024, which is -// 85.33 us. Up to 35 periods are stored in a buffer, where they can +// 85.33 us. Up to 36 periods are stored in a buffer, where they can // be read via a USB request. The buffer layout and USB requests are // compatible with the "IgorPlug-USB" device, which is supported by LIRC // through the "igorplugusb" driver. This implementation should also @@ -12,17 +12,17 @@ // could also get rid of the additional endpoint (USBTINY_ENDPOINT). // // There are some IR protocols with very long packets length, such as -// the "NEC" protocol (http://www.xs4all.nl/~sbp/knowledge/ir/nec.htm). +// the "NEC" protocol (http://www.sbprojects.com/knowledge/ir/nec.htm). // This protocol uses 67 mark/space periods, which is too much for the // limited amount of RAM in the ATtiny2313. Simply truncating the // packet to the amount of available buffer space is not an option, // because the significant bits are at the end of the packet. Instead, -// a buffer of 35 bytes (IR_MAX) is used, of which the last 16 bytes +// a buffer of 36 bytes (IR_MAX) is used, of which the last 16 bytes // (IR_WRAP) are used as a circular buffer. Because both the address // (16 periods) and the command code (16 periods) are sent twice (normal // and inverted), the wrapping will result in a buffer with both the // device address and the inverted command code. Other IR protocols are -// typically shorter than 35 periods. +// typically shorter than 36 periods. // // 16-bit Timer1 is initialized in normal mode with a clock of 12MHz/8. // Both the positive and negative edges of the IR input signal on the @@ -40,12 +40,12 @@ // handled in time. To avoid nested IR interrupts, the input capture and // output compare interrupts are disabled before the global interrupt // flag is set. In the input capture interrupt handler, the interrupts -// are disabled for a maximum of 26, 27 and 21 cycles, and in the output -// compare interrupt handler for 21, 23 and 21 cycles. Unfortunately, +// are disabled for a maximum of 27, 27 and 27 cycles, and in the output +// compare interrupt handler for 21, 23 and 22 cycles. Unfortunately, // it was not possible to meet the 28 cycle maximum for the input -// capture interrupt handler without replacing the compiler generated -// prolog and epilog code by inline assembly, which makes the code a -// little fragile. +// capture interrupt handler without using some inline assembly. +// Because the limits are so tight, the code is fragile, and may break +// for a new gcc version. // // The IR receiver is disabled during an IR buffer read, so that a // packet that is being tranmitted to the host, is not overwritten by @@ -58,42 +58,38 @@ // instructions, and one to write data to the display. OUT transfers // are used to transfer up to 255 bytes for a single request. // -// Stack space calculations for gcc-3.4.3 and gcc-4.1.0: +// Stack space calculations for gcc-4.1.0 and gcc-4.3.4: // -// 3.4.3 4.1.0 -// ----- ----- -// 0 0 main -// 0 0 lcd_init (inlined) -// 2 2 usb_init -// 0 0 ir_init (inlined) -// 6 5 usb_poll -// 0 0 usb_receive (inlined) -// 2 2 usb_setup -// 5 5 usb_out -// 4 4 lcd_write -// 2 2 lcd_read4 -// 2 2 lcd_write4 -// 0 0 usb_transmit (inlined) -// 2 4 usb_int -// 2 2 crc +// 0 main (stack reset) +// 0 lcd_init (inlined) +// 0 ir_init (inlined) +// 2 usb_init +// 5 usb_poll +// 0 usb_receive (inlined) +// 2 usb_setup +// 5 usb_out +// 3 lcd_write +// 0 lcd_read4 (inlined) +// 2 lcd_write4 +// 0 usb_transmit (inlined) +// 4 usb_int +// 2 crc // -// Maximum stack space is 6+5+4+2=17 for gcc-3.4.3 and 5+5+4+2=16 for -// gcc-4.1.0. Total stack usage: +// Maximum stack space is 5+5+3+2=15. +// Total stack usage: // - USB interrupt: 11 bytes -// - IR input capture interrupt: 11 bytes +// - IR input capture interrupt: 12 bytes // - IR output compare interrupt: 7 bytes -// - main(): 17 bytes +// - main(): 15 bytes // The two IR interrupt handler cannot be active simultaneously, so the -// maximum stack space is 17+11+11=39 bytes. +// maximum stack space is 15+12+11=38 bytes. // // NOTE: The above cycle and stack size figures were obtained by -// inspecting the code generated by gcc-3.4.3 and gcc-4.1.0. +// inspecting the code generated by gcc-4.1.0 and gcc-4.3.4. // Other compiler versions may generate different code, leading -// to different figures. Likewise, the replacement prolog and -// epilog code may have to be adapted when a different compiler -// version allocates different registers. +// to different figures. // -// Copyright (C) 2006 Dick Streefland +// Copyright 2006-2010 Dick Streefland // // This is free software, licensed under the terms of the GNU General // Public License as published by the Free Software Foundation. @@ -101,6 +97,7 @@ #include #include +#include "def.h" #include "usb.h" // ---------------------------------------------------------------------- @@ -108,11 +105,10 @@ // ---------------------------------------------------------------------- #define TIMEOUT 10500 // IR transmission timeout in us -#define IR_MAX 35 // maximum number of IR data bytes +#define IR_MAX 36 // maximum number of IR data bytes #define IR_WRAP 16 // wrap area at end (for 67 byte NEC protocol) #define SCALING 10 // 9: 42.67 us period, 10: 85.33 us period -#define LED 5 // PORTD bit number for LED -#define PULLUP 3 // PORTD bit number for D- pullup +#define LED (D,5) // I/O port for LED enum { @@ -126,7 +122,7 @@ enum LCD_DATA, // write data to LCD (via OUT) }; -static byte_t inpos = 0xff; // read position for usb_in(), or 0xff +static byte_t inpos; // read position for usb_in(), or 0xff static byte_t edges; // incremented for each edge static struct // IgorPlug-USB compatible data layout { @@ -156,38 +152,40 @@ static struct // IgorPlug-USB compatible data layout #define MASK_RW (1 << RW) #define MASK_E (1 << E) +#ifndef ICIE1 +#define ICIE1 TICIE1 +#endif + // ---------------------------------------------------------------------- // Handler for timer1 input capture interrupt: edge on IR input // ---------------------------------------------------------------------- -__attribute__((signal,naked)) // interrupts are DISABLED -extern void SIG_TIMER1_CAPT ( void ) +ISR(TIMER1_CAPT_vect) { static uint_t prev; uint_t stamp; byte_t delta; byte_t e; - asm volatile( - "push r23\n" - "in r23,__SREG__\n" - "push r18\n" - "push r19\n" - "push r24\n" - "push r25\n" - :: ); - stamp = ICR1; // get time stamp TIMSK = 0; // disable both IR interrupts - TCCR1B ^= _BV(ICES1); // toggle edge detector sei(); // allow USB interrupt - PORTD |= _BV(LED); // switch LED on + TCCR1B ^= _BV(ICES1); // toggle edge detector + stamp = ICR1; // get time stamp + asm volatile( + "push %A0\n" // save stamp + "push %B0\n" + : + : "w"(stamp), "w"(prev) // "w"(prev) reduces register usage + ); + stamp -= prev; // calculate delta in-place + stamp += 1 << (SCALING - 3 - 1); // round + stamp >>= (SCALING - 3); // scale asm volatile( - "push r20\n" - "push r21\n" - "push r30\n" - "push r31\n" - :: ); - delta = (stamp - prev + (1 << (SCALING-3-1))) >> (SCALING-3); - asm volatile("" : : "r"(delta) ); // calculate delta (gcc-4.1.0) + "mov %0,%A1\n" // delta = stamp & 0xff + "pop %B1\n" + "pop %A1\n" // restore stamp + : "=r"(delta) + : "w"(stamp) + ); prev = stamp; OCR1A = stamp + 12L * TIMEOUT / 8; // update timeout value cli(); // enter critical region @@ -209,35 +207,21 @@ extern void SIG_TIMER1_CAPT ( void ) edges = e + 1; } sei(); // allow USB interrupt - asm volatile("nop"); // reduce latency to 1 cycle - asm volatile( - "pop r31\n" - "pop r30\n" - "pop r21\n" - "pop r20\n" - :: ); + SET(LED); // switch LED on + e = _BV(OCIE1A) | _BV(ICIE1); + asm volatile("" :: "r"(e)); // force evaluation of "e" cli(); - TIMSK = _BV(OCIE1A) | _BV(ICIE1); // reenable IR interrupts - asm volatile( - "pop r25\n" - "pop r24\n" - "pop r19\n" - "pop r18\n" - "out __SREG__,r23\n" - "pop r23\n" - "reti\n" - :: ); + TIMSK = e; // reenable IR interrupts } // ---------------------------------------------------------------------- // Handler for timer1 output compare A interrupt: IR transmission timeout // ---------------------------------------------------------------------- -__attribute__((signal)) // interrupts are DISABLED -extern void SIG_TIMER1_COMPA ( void ) +ISR(TIMER1_COMPA_vect) { TIMSK = 0; // disable both IR interrupts sei(); // allow USB interrupt - PORTD &= ~_BV(LED); // switch LED off + CLR(LED); // switch LED off cli(); // enter critical region if ( edges >= 4 // at least two pulses (NEC) && edges != 0xff // packet should not be ignored @@ -259,7 +243,7 @@ extern void SIG_TIMER1_COMPA ( void ) // ---------------------------------------------------------------------- static void ir_init ( void ) { - DDRD |= _BV(LED); + OUTPUT(LED); TCCR1B = _BV(ICNC1) // noise canceler, trigger on negative edge | _BV(CS11); // clock source clk/8 TIMSK = _BV(OCIE1A) // output compare 1A match interrupt enable @@ -270,6 +254,7 @@ static void ir_init ( void ) // ---------------------------------------------------------------------- // Delay times 100 microseconds. // ---------------------------------------------------------------------- +__attribute__((noinline)) static void lcd_delay100u ( byte_t count ) { asm volatile( @@ -285,6 +270,7 @@ static void lcd_delay100u ( byte_t count ) // ---------------------------------------------------------------------- // Write 4 bits to the LCD. // ---------------------------------------------------------------------- +__attribute__((noinline)) static void lcd_write4 ( byte_t data ) { PORT = (PORT & ~ MASK_D4) | (data << D4); @@ -297,7 +283,8 @@ static void lcd_write4 ( byte_t data ) // ---------------------------------------------------------------------- // Read 4 bits from the LCD. // ---------------------------------------------------------------------- -static byte_t lcd_read4 ( void ) +__attribute__((always_inline)) +static inline byte_t lcd_read4 ( void ) { byte_t save; byte_t data; @@ -375,7 +362,7 @@ extern byte_t usb_setup ( byte_t data[8] ) cli(); if ( ir.length > 0 ) { - inpos = data[4]; + inpos = data[2]; r = 0xff; // call usb_in() to get the data } else @@ -444,19 +431,17 @@ extern void usb_out ( byte_t* data, byte_t len ) // ---------------------------------------------------------------------- // Main // ---------------------------------------------------------------------- -__attribute__((naked)) // suppress redundant SP initialization extern int main ( void ) { - PORTD |= _BV(PULLUP); - DDRD |= _BV(PULLUP); // enable pullup on D- + SPL = (RAMEND & 0xff); // drop return address of main + inpos = 0xff; #if LCD_PRESENT lcd_init(); #endif /* LCD_PRESENT */ - usb_init(); ir_init(); + usb_init(); for ( ;; ) { usb_poll(); } - return 0; } diff --git a/Firmware/pocket-prog/ir/main.elf b/Firmware/pocket-prog/ir/main.elf deleted file mode 100644 index 93baf40..0000000 Binary files a/Firmware/pocket-prog/ir/main.elf and /dev/null differ diff --git a/Firmware/pocket-prog/ir/main.hex b/Firmware/pocket-prog/ir/main.hex index 0f821fe..13a3901 100644 --- a/Firmware/pocket-prog/ir/main.hex +++ b/Firmware/pocket-prog/ir/main.hex @@ -1,127 +1,129 @@ -:1000000039C073C050C0B0C204C34DC04CC04BC057 -:100010004AC049C048C047C046C045C044C043C0AC -:1000200042C041C040C000CDD914F13C28E5A16CCC -:1000300078B5509D89440E03490052002F004C00B2 -:10004000430044000403090409021900010100806F -:10005000280904000001FF000000070581000800D6 -:100060000012010101FF000008EB03020003010080 -:100070000200010011241FBECFEDCDBF10E0A0E6AD -:10008000B0E0E0EDF7E003C0C89531960D92A436DC -:10009000B107D1F710E0A4E6B0E001C01D92A93B82 -:1000A000B107E1F776C3ACCFDC019FEF8FEF660FAE -:1000B000B9F046E2F0E0229560FF2D91E82FE227AB -:1000C000EF70929582958F70392F307F832B9F70C0 -:1000D000E40F359193273170932783276A9559F759 -:1000E000809590958D939D9308950F931F932F93D3 -:1000F000DF93CF930FB70F938299FECF82990BC0F6 -:10010000829909C0829907C0829905C0829903C06B -:1001100000E40ABFA8C0C091A100DD27CE55DF4F83 -:100120000BE014E124E0829BE9CF3F934F936F9360 -:1001300060B330E803C060B3432B49934427647134 -:100140002627215020B32471A9F137953C3FA0F513 -:100150006227615060B3647137953C3F98F526275C -:100160002150379520B324713C3F90F562276150B0 -:1001700037953C3F60B36471A0F526272150379531 -:100180003C3FC8F520B324716227615037953C3F4E -:10019000B0F50A9560B37AF064712627215037953F -:1001A0003C3F88F520B324716227615037953C3F6E -:1001B00010F22DC031C048C0612720B324713F77B1 -:1001C0004160C6CF3F77426060B364712127C7CFDB -:1001D0003F774460612720B32471622761503795CF -:1001E000C8CF3F7748602127316060B3647126270C -:1001F00021503795C6CF3F7740616127C1CF3F7708 -:1002000040622127C4CF3F7740646127C9CF3F7741 -:100210004068212700C08FCF30E43ABF0B500195D2 -:10022000033090F0C01B2881233C91F12B3481F1E5 -:1002300019811F774091B800141731F42936D9F08D -:100240002D3249F0213E39F04427409364006F91EC -:100250004F913F9108C0209364006F914F913F915F -:100260000AB706FD49CF0F910FBFCF91DF912F91B4 -:100270001F910F911895009193000023F1F0409188 -:10028000A0004423D1F440939300C4E9D0E018C007 -:10029000209164002223C1F24091A000442369F41C -:1002A0000093A00020939F000091A1004BE0401B11 -:1002B0004093A100C0E6D0E002C0C1E6D0E001E07A -:1002C00022B32B7E206111B3146122BB11BB14E158 -:1002D00030E830FF212722BB379547954C3FC0F5CA -:1002E00030FF2127379522BB47954C3FA8F530FFBB -:1002F00021273795000022BB47954C3F78F530FF0A -:1003000021273795000022BB47954C3F48F530FF29 -:100310002127699122BB379547954C3F18F530FF4F -:100320002127379522BB47954C3F00F530FF212709 -:100330003795479522BB4C3FD8F430FF212737959E -:10034000362F479522BB4C3FA8F40A9512F614C0ED -:100350002127442722BBC2CF2127C5CF2127CBCFBE -:100360002127D1CF2127442722BBD7CF2127DACF7E -:100370002127DFCF2127E5CF2B7E22BB6F914F9125 -:100380003F9100E40ABFDF91CF9111B3022F2061AA -:1003900022BB1B7EDFBFDF912F91000011BB02BB90 -:1003A0001F910F91189585B7836085BF8BB78064C7 -:1003B0008BBF789408950F931F93CF93DF93609131 -:1003C000A000662309F46FC08091A1009927CC2773 -:1003D000DD27C81BD90BC255DF4F635091E09093C6 -:1003E000650010E080919F008D3209F04EC00E81B3 -:1003F0008F8181110FEF88818076B1F58981882303 -:1004000019F412E0888339C0853021F48A81809301 -:10041000690036C08630F9F482E0809365008B81F4 -:10042000813021F4C1E6D0E012E127C0823021F40E -:10043000C8E4D0E019E121C0833011F58A81882316 -:1004400021F4C4E4D0E014E018C08230C9F4C6E35B -:10045000D0E01EE012C0883011F4988303C08A30C7 -:1004600079F41883192F09C08C2F9D2F2DD1182FA7 -:100470008F3F19F483E080936500011708F4102F73 -:10048000D0936800C093670005C0662319F08C2FD5 -:100490009D2F6BD11093660083EC80939400109293 -:1004A00093001092A00030919300332309F04CC0C8 -:1004B00020916500222309F443C08091940098E8BC -:1004C000892780939400C0916600C93008F0C8E085 -:1004D000A5E9B0E0CC2339F1233031F46C2F8A2F19 -:1004E0009B2F1CD1C82F1AC0E0916700F0916800C3 -:1004F000213039F4932F9C1768F481918D939F5F7D -:10050000FACF932F9C1730F4C895802D31968D9398 -:100510009F5FF8CFF0936800E093670080916600DA -:100520008C1B809366006C2F85E990E0BDDDCD5F6C -:10053000C0939300C350C83038F41092650004C0D3 -:10054000809169008093B8008AE0849908C0815046 -:1005500011F0849BFCCF882311F480936900DF9114 -:10056000CF911F910F9108957F937FB72F933F9362 -:100570008F939F9324B535B519BE8EB590E4892726 -:100580008EBD7894959A4F935F93EF93FF938091EC -:100590006A0090916B00532F422F481B590B952FE7 -:1005A000842F805C9F4F880F892F881F990B91950E -:1005B000982F30936B0020936A002A57324C3BBD32 -:1005C0002ABDF89420916C002F3F99F0243208F056 -:1005D0002051809162008F3F49F410926D002223D8 -:1005E00029F0E22FFF27E359FF4F92832F5F2093DB -:1005F0006C0078940000FF91EF915F914F91F89417 -:1006000088E489BF9F918F913F912F917FBF7F9108 -:1006100018951F920F920FB60F9211248F939F93EC -:1006200019BE78949598F89490916C00943070F07D -:100630009F3F61F0809162008F3F41F480916E0096 -:100640008F5F80936E00915090936D0010926C00BC -:1006500078948EB58F7B8EBDF89488E489BF9F9186 -:100660008F910F900FBE0F901F90189590EF00C0C4 -:100670009A95E9F78A95D1F7089598B3907F982BCA -:1006800098BBC69A8FE787BBC69880E787BB08955B -:1006900098B380E288BBC69A00C086B38F7098BBBF -:1006A000992708951F93CF93C82FF2DF182FF0DFFB -:1006B00013FDFBCF8C2F82958F70DFDF8C2F8F7017 -:1006C000DCDFCF911F910895F92FE82F90E0818111 -:1006D000882311F498E01FC0813031F490936D00AD -:1006E0008FEF8093620017C0823071F4F89480918C -:1006F0006D00882329F08481809362009FEF02C0FF -:10070000808391E0789407C0843111F4C49803C0C9 -:10071000853109F4C49A892F9927089520916D0095 -:100720002D5F30E03617F0F44FEFB92FA82F8091EE -:100730006200821758F0F89480916C00882311F0C1 -:1007400040936C004093620078940CC0E82FFF2720 -:10075000E359FF4F8F5F8093620080818D933F5FED -:10076000361728F3832F992708950F931F93CF935C -:10077000082F192FC62F662341F0F12FE02F81910A -:100780000E2F1F2F8FDFC150C1F7CF911F910F91F7 -:100790000895939A8B9A80E787BB18BA83E06DDF40 -:1007A00089E264DF83E069DF81E060DF82E37ADF92 -:1007B00088E278DF81E076DF86E074DF8CE072DF4C -:1007C000F2DD8D9A82E88EBD88E489BFF4DDFECF2C -:0407D000D25AFF00FA +:1000000051C084C05DC0F4C246C35AC059C058C074 +:1000100057C056C055C054C053C052C051C050C044 +:100020004FC04EC04DC000CDD914F13C28E5A16CA5 +:1000300078B5509D89440902190001010080280902 +:1000400004000001FF000000070581000800001205 +:10005000010101FF000008EB03020007010102009B +:1000600001040309041E0355005300420074006993 +:10007000006E0079002000490052002F004C004320 +:1000800000440020034400690063006B002000531B +:1000900000740072006500650066006C0061006E0F +:1000A0000064000011241FBECFEDCDBF10E0A0E61C +:1000B000B0E001C01D92A93BB107E1F77ED39DC31B +:1000C0009FCFDC019FEF8FEF46E2F0E018C02D914B +:1000D0008227E82FEF70E40F3591E82FE295892F02 +:1000E000932F3170E327EF709295392F9F70307EF8 +:1000F0008327E40F359193273170932783276A95DF +:1001000032F7809590958D939D9308950F931F934B +:100110002F93DF93CF930FB70F938299FECF8299DE +:100120000BC0829909C0829907C0829905C0829943 +:1001300003C000E40ABFACC0C091A100DD27CE55CA +:10014000DF4F0BE014E124E0829BE9CF3F934F9314 +:100150006F9360B330E803C060B3432B49934427E7 +:1001600064712627215020B32471A9F137953C3FB3 +:10017000A0F56227615060B3647137953C3F98F5F4 +:1001800026272150379520B324713C3F90F56227F4 +:10019000615037953C3F60B36471A0F5262721502C +:1001A00037953C3FC8F520B32471622761503795DD +:1001B0003C3FB0F50A9560B37AF064712627215070 +:1001C00037953C3F88F520B32471622761503795FD +:1001D0003C3F10F22DC031C052C0612720B32471C2 +:1001E0003F774160C6CF3F77426060B3647121279B +:1001F000C7CF3F774460612720B3247162276150E5 +:100200003795C8CF3F7748602127316060B364716C +:10021000262721503795C6CF3F7740616127C1CF50 +:100220003F7740622127C4CF3F7740646127C9CF21 +:100230003F774068212700C08FCF30E43ABF0B5092 +:100240000195C01BD040288121FD2DC019811F7749 +:100250004091B800141799F4293691F40091910057 +:100260000023F1F04091A0004423D1F44093910089 +:1002700040919D004093B800C2E9D0E02BC02227F6 +:10028000209360006F914F913F910AB706FD45CFD3 +:100290000F910FBFCF91DF912F911F910F91189563 +:1002A000CEE9D0E016C0217059F3209160002223DE +:1002B00039F34091A000442399F70093A0002093C4 +:1002C0009F000091A1004BE0401B4093A100C0E9BA +:1002D000D0E001E022B32B7E206111B3146122BB78 +:1002E00011BB14E130E830FF212722BB3795479539 +:1002F0004C3FC0F530FF2127379522BB47954C3F37 +:10030000A8F530FF21273795000022BB47954C3FC9 +:1003100078F530FF21273795000022BB47954C3FE9 +:1003200048F530FF2127699122BB379547954C3F0F +:1003300018F530FF2127379522BB47954C3F00F534 +:1003400030FF21273795479522BB4C3FD8F430FF2B +:1003500021273795362F479522BB4C3FA8F40A95A5 +:1003600012F614C02127442722BBC2CF2127C5CFB4 +:100370002127CBCF2127D1CF2127442722BBD7CF7D +:100380002127DACF2127DFCF2127E5CF2B7E22BB04 +:100390006F914F913F9100E40ABFDF91CF9111B36C +:1003A000022F206122BB1B7EDFBFDF912F91000057 +:1003B00011BB02BB1F910F91189585B7836085BF54 +:1003C0008BB780648BBF8D9A939A8B9A82ED8093C2 +:1003D00090008AE580939E00789408951F93CF93B0 +:1003E000DF936091A000662309F475C08091A1009D +:1003F000CCE0D0E0C81BD109CE55DF4F81E080931F +:10040000640080919F008D3209F057C01E818F815A +:1004100081111FEF8881807679F58981811104C06F +:100420001882198282E041C0853029F48A81809344 +:100430009D00959A39C08630A9F482E080936400CB +:100440008B81813009F1823019F1833069F58A811D +:10045000882311F1813021F1823031F58EE1C5E63A +:10046000D0E023C0883019F481E088831EC08A3030 +:10047000D9F4188281E019C0CE013AD18F3FA9F496 +:1004800083E08093640013C082E1CFE4D0E00DC02C +:1004900089E1C6E3D0E009C084E0C1E6D0E005C050 +:1004A00080E2C3E8D0E001C080E0811708F0812F2E +:1004B000D0936200C093610005C0635011F0CE017B +:1004C00064D180E08093630083EC8093920010926B +:1004D00091001092A00080919100811150C08091F4 +:1004E0006400882309F44BC09091920028E8922779 +:1004F0009093920010916300193018F4112399F130 +:1005000001C018E0833031F4612F83E990E017D106 +:10051000182F24C0E0916100F0916200813081F4D5 +:10052000DF0143E950E0EA019D012F5F3F4FF901F0 +:100530008C9189938C2F841B811760F4D901F4CF9F +:1005400023E930E0D90184918D9331968A2F821B63 +:100550008117C8F3F0936200E0936100809163001B +:10056000811B80936300612F83E990E0AADD83E023 +:10057000810F80939100183010F4109264008AE08B +:10058000849907C08150E1F710929D001092B80045 +:100590009598DF91CF911F91089598B3907F982BF4 +:1005A00098BBC69A8FE787BBC69880E787BB08953C +:1005B000CF93C82F80E228B388BBC69A00C096B3F9 +:1005C00028BB28B388BBC69A00C036B328BB93FDAE +:1005D000F2CF8C2F82958F70E0DF8C2F8F70CF91B0 +:1005E000DCCF90EF00C09A95E9F78A95D1F708958E +:1005F0001F920F920FB60F9211242F938F939F93F8 +:10060000EF93FF9319BE78948EB590E489278EBD41 +:1006100084B595B5E0916500F09166008F939F9346 +:10062000805C9F4F8E1B9F0B880F892F881F990B13 +:100630009195282F9F918F919093660080936500EC +:100640008A57924C9BBD8ABDF89480918E008F3F53 +:1006500099F0853208F0805190918F009F3F49F4C6 +:1006600010926700882329F0E82FF0E0E959FF4F46 +:1006700022838F5F80938E007894959A88E4F89413 +:1006800089BFFF91EF919F918F912F910F900FBE96 +:100690000F901F9018951F920F920FB60F92112472 +:1006A0008F939F9319BE78949598F89490918E00AB +:1006B0008CEF890F8B3F60F480918F008F3F41F466 +:1006C000809168008F5F80936800915090936700DD +:1006D00010928E0078948EB58F7B8EBDF89488E44E +:1006E00089BF9F918F910F900FBE0F901F9018950B +:1006F000FC018181882309F1813031F41092670077 +:100700008FEF80938F0017C0823071F4F89480913E +:100710006700882329F0828180938F008FEF02C0C9 +:10072000108281E078940895843111F4C49803C054 +:10073000853109F4C49A80E0089588E008952091F5 +:1007400067002D5F30918F00DC0180E0E82FE30F20 +:100750008617C1F0E21778F0E0938F00F89490913B +:100760008E00992319F09FEF90938E009FEF909346 +:100770008F00789408958F5FF0E0E959FF4F9081E2 +:100780009D93E4CFE0938F0008950F931F93CF9331 +:10079000DF931F92CDB7DD278C01662341F0F8016E +:1007A00081918F01698304DF69816150F6CF0F90D9 +:1007B000DF91CF911F910F9108958FED8DBF8FEF36 +:1007C00080938F0080E787BB18BA83E0E6DE09DFFD +:1007D00083E0E3DE06DF82E3EBDE88E2E9DE81E050 +:1007E000E7DE86E0E5DE8CE0E3DE8D9A82E88EBD12 +:0E07F00088E489BFE2DDF2DDFECFF894FFCF92 :00000001FF diff --git a/Firmware/pocket-prog/ir/main.o b/Firmware/pocket-prog/ir/main.o deleted file mode 100644 index d71f3ab..0000000 Binary files a/Firmware/pocket-prog/ir/main.o and /dev/null differ diff --git a/Firmware/pocket-prog/ir/usb.o b/Firmware/pocket-prog/ir/usb.o deleted file mode 100644 index 42a945a..0000000 Binary files a/Firmware/pocket-prog/ir/usb.o and /dev/null differ diff --git a/Firmware/pocket-prog/ir/usbtiny.h b/Firmware/pocket-prog/ir/usbtiny.h index 8f961b7..654da2d 100644 --- a/Firmware/pocket-prog/ir/usbtiny.h +++ b/Firmware/pocket-prog/ir/usbtiny.h @@ -1,7 +1,7 @@ // ====================================================================== // USBtiny Configuration // -// Copyright (C) 2006 Dick Streefland +// Copyright 2006-2010 Dick Streefland // // This is free software, licensed under the terms of the GNU General // Public License as published by the Free Software Foundation. @@ -21,6 +21,14 @@ // number: #define USBTINY_INT 0 +// Optional definition of the I/O pin to control the 1K5 pullup of the +// D- signal. This will force a reconnect after RESET. (+4 bytes) +#define USBTINY_DMINUS_PULLUP (D,3) + +// Optional definition of the I/O pin to drive the "USB OK" LED, that +// will turn on when the host has assigned a device address. (+6 bytes) +#define USBTINY_USB_OK_LED (D,5) + // The power requirement of the USB device in mA, or 0 when the device // is not bus powered: #define USBTINY_MAX_POWER 80 @@ -30,19 +38,21 @@ // Implementers Forum (www.usb.org) if you have a spare $1500 to kill. // Alternatively, you can buy a small range of device IDs from // www.voti.nl or www.mecanique.co.uk, or be naughty and use something -// else, like for instance product ID 0x6666, which is registered as +// else, like for instance vendor ID 0x6666, which is registered as // "Prototype product Vendor ID". +// This application is compatible with the IgorPlug-USB LIRC device +// (http://www.cesko.host.sk/IgorPlugUSB/IgorPlug-USB%20(AVR)_eng.htm), +// so we use the VID/PID pair of that device: #define USBTINY_VENDOR_ID 0x03eb // IgorPlug-USB #define USBTINY_DEVICE_ID 0x0002 // IgorPlug-USB // The version of the device as a 16-bit number: 256*major + minor. -#define USBTINY_DEVICE_VERSION 0x103 +#define USBTINY_DEVICE_VERSION 0x107 // The following optional macros may be used as an identification of // your device. Undefine them when you run out of flash space. -//#define USBTINY_VENDOR_NAME "Dick Streefland" -//#define USBTINY_DEVICE_NAME "USBtiny IR/LCD" -#define USBTINY_DEVICE_NAME "IR/LCD" +#define USBTINY_VENDOR_NAME "Dick Streefland" +#define USBTINY_DEVICE_NAME "USBtiny IR/LCD" #undef USBTINY_SERIAL // Define the device class, subclass and protocol. Device class 0xff @@ -62,6 +72,7 @@ // as 1, you have the option of returning 0xff instead. In that case, the // USB driver will call a function usb_in() to obtain the data to send // back to the host. This can be used to generate the data on-the-fly. +// When you set this macro to 2, the transfer count is not limited to 255. #define USBTINY_CALLBACK_IN 1 // When this macro is defined as 0, OUT packets are simply ignored. @@ -70,9 +81,20 @@ // a control transfer. #define USBTINY_CALLBACK_OUT 1 +// When this macro is defined as 1, an optimized CRC function is used +// that calculates the CRC about twice as fast as the standard version, +// but at the expense of 42 bytes of additional flash memory. +#define USBTINY_FAST_CRC 1 + // Set the macro USBTINY_ENDPOINT to 1 to add an additional endpoint, // according to the values of the three other macros. #define USBTINY_ENDPOINT 1 #define USBTINY_ENDPOINT_ADDRESS 0x81 // IN endpoint #1 #define USBTINY_ENDPOINT_TYPE 0x00 // control transfer type #define USBTINY_ENDPOINT_INTERVAL 0 // ignored + +// Set the macro USBTINY_NO_DATA to 1 to avoid using initialized data +// by USBtiny. This will slightly increase the code size, but when the +// data section is empty, the code to initialize the data section will +// be omitted from the startup code. +#define USBTINY_NO_DATA 1 diff --git a/Firmware/pocket-prog/patches/avrdude-5.1.diff b/Firmware/pocket-prog/patches/avrdude-5.4.diff similarity index 58% rename from Firmware/pocket-prog/patches/avrdude-5.1.diff rename to Firmware/pocket-prog/patches/avrdude-5.4.diff index 83c5c89..85b641b 100644 --- a/Firmware/pocket-prog/patches/avrdude-5.1.diff +++ b/Firmware/pocket-prog/patches/avrdude-5.4.diff @@ -1,7 +1,7 @@ -diff -pu avrdude-5.1/Makefile.am.orig avrdude-5.1/Makefile.am ---- avrdude-5.1/Makefile.am.orig 2006-01-13 00:13:50.000000000 +0100 -+++ avrdude-5.1/Makefile.am 2006-02-11 22:09:53.000000000 +0100 -@@ -62,6 +62,8 @@ avrdude_SOURCES = \ +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 \ @@ -10,81 +10,60 @@ diff -pu avrdude-5.1/Makefile.am.orig avrdude-5.1/Makefile.am config.c \ config.h \ confwin.c \ -diff -pu avrdude-5.1/Makefile.in.orig avrdude-5.1/Makefile.in ---- avrdude-5.1/Makefile.in.orig 2006-01-23 22:45:25.000000000 +0100 -+++ avrdude-5.1/Makefile.in 2006-03-25 23:05:12.000000000 +0100 -@@ -88,17 +88,17 @@ am_avrdude_OBJECTS = avrdude-config_gram - avrdude-lexer.$(OBJEXT) avrdude-avr.$(OBJEXT) \ - avrdude-avr910.$(OBJEXT) avrdude-avrpart.$(OBJEXT) \ - avrdude-bitbang.$(OBJEXT) avrdude-butterfly.$(OBJEXT) \ -- avrdude-config.$(OBJEXT) avrdude-confwin.$(OBJEXT) \ -- avrdude-crc16.$(OBJEXT) avrdude-fileio.$(OBJEXT) \ -- avrdude-jtagmkI.$(OBJEXT) avrdude-jtagmkII.$(OBJEXT) \ -- avrdude-lists.$(OBJEXT) avrdude-main.$(OBJEXT) \ -- avrdude-par.$(OBJEXT) avrdude-pgm.$(OBJEXT) \ -- avrdude-ppi.$(OBJEXT) avrdude-ppiwin.$(OBJEXT) \ -- avrdude-safemode.$(OBJEXT) avrdude-serbb_posix.$(OBJEXT) \ -- avrdude-serbb_win32.$(OBJEXT) avrdude-ser_posix.$(OBJEXT) \ -- avrdude-ser_win32.$(OBJEXT) avrdude-stk500.$(OBJEXT) \ -- avrdude-stk500v2.$(OBJEXT) avrdude-term.$(OBJEXT) \ -- avrdude-usb_libusb.$(OBJEXT) -+ avrdude-usbtiny.$(OBJEXT) avrdude-config.$(OBJEXT) \ -+ avrdude-confwin.$(OBJEXT) avrdude-crc16.$(OBJEXT) \ -+ avrdude-fileio.$(OBJEXT) avrdude-jtagmkI.$(OBJEXT) \ -+ avrdude-jtagmkII.$(OBJEXT) avrdude-lists.$(OBJEXT) \ -+ avrdude-main.$(OBJEXT) avrdude-par.$(OBJEXT) \ -+ avrdude-pgm.$(OBJEXT) avrdude-ppi.$(OBJEXT) \ -+ avrdude-ppiwin.$(OBJEXT) avrdude-safemode.$(OBJEXT) \ -+ avrdude-serbb_posix.$(OBJEXT) avrdude-serbb_win32.$(OBJEXT) \ -+ avrdude-ser_posix.$(OBJEXT) avrdude-ser_win32.$(OBJEXT) \ -+ avrdude-stk500.$(OBJEXT) avrdude-stk500v2.$(OBJEXT) \ -+ avrdude-term.$(OBJEXT) avrdude-usb_libusb.$(OBJEXT) - avrdude_OBJECTS = $(am_avrdude_OBJECTS) - avrdude_LDADD = $(LDADD) - DEFAULT_INCLUDES = -I. -I$(srcdir) -I. -@@ -271,6 +271,8 @@ avrdude_SOURCES = \ - bitbang.h \ - butterfly.c \ - butterfly.h \ +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 \ - config.c \ - config.h \ - confwin.c \ -@@ -445,6 +447,7 @@ distclean-compile: - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avrdude-stk500v2.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avrdude-term.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avrdude-usb_libusb.Po@am__quote@ -+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avrdude-usbtiny.Po@am__quote@ + 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 $@ $<; \ -@@ -558,6 +561,20 @@ avrdude-butterfly.obj: butterfly.c +@@ -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) $(avrdude_CPPFLAGS) $(CPPFLAGS) $(avrdude_CFLAGS) $(CFLAGS) -c -o avrdude-butterfly.obj `if test -f 'butterfly.c'; then $(CYGPATH_W) 'butterfly.c'; else $(CYGPATH_W) '$(srcdir)/butterfly.c'; fi` + @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` -+avrdude-usbtiny.o: usbtiny.c -+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(avrdude_CPPFLAGS) $(CPPFLAGS) $(avrdude_CFLAGS) $(CFLAGS) -MT avrdude-usbtiny.o -MD -MP -MF "$(DEPDIR)/avrdude-usbtiny.Tpo" -c -o avrdude-usbtiny.o `test -f 'usbtiny.c' || echo '$(srcdir)/'`usbtiny.c; \ -+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/avrdude-usbtiny.Tpo" "$(DEPDIR)/avrdude-usbtiny.Po"; else rm -f "$(DEPDIR)/avrdude-usbtiny.Tpo"; exit 1; fi -+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usbtiny.c' object='avrdude-usbtiny.o' libtool=no @AMDEPBACKSLASH@ ++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) $(avrdude_CPPFLAGS) $(CPPFLAGS) $(avrdude_CFLAGS) $(CFLAGS) -c -o avrdude-usbtiny.o `test -f 'usbtiny.c' || echo '$(srcdir)/'`usbtiny.c ++@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 + -+avrdude-usbtiny.obj: usbtiny.c -+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(avrdude_CPPFLAGS) $(CPPFLAGS) $(avrdude_CFLAGS) $(CFLAGS) -MT avrdude-usbtiny.obj -MD -MP -MF "$(DEPDIR)/avrdude-usbtiny.Tpo" -c -o avrdude-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)/avrdude-usbtiny.Tpo" "$(DEPDIR)/avrdude-usbtiny.Po"; else rm -f "$(DEPDIR)/avrdude-usbtiny.Tpo"; exit 1; fi -+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usbtiny.c' object='avrdude-usbtiny.obj' libtool=no @AMDEPBACKSLASH@ ++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) $(avrdude_CPPFLAGS) $(CPPFLAGS) $(avrdude_CFLAGS) $(CFLAGS) -c -o avrdude-usbtiny.obj `if test -f 'usbtiny.c'; then $(CYGPATH_W) 'usbtiny.c'; else $(CYGPATH_W) '$(srcdir)/usbtiny.c'; fi` -+ - avrdude-config.o: config.c - @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(avrdude_CPPFLAGS) $(CPPFLAGS) $(avrdude_CFLAGS) $(CFLAGS) -MT avrdude-config.o -MD -MP -MF "$(DEPDIR)/avrdude-config.Tpo" -c -o avrdude-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c; \ - @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/avrdude-config.Tpo" "$(DEPDIR)/avrdude-config.Po"; else rm -f "$(DEPDIR)/avrdude-config.Tpo"; exit 1; fi -diff -pu avrdude-5.1/avrdude.conf.in.orig avrdude-5.1/avrdude.conf.in ---- avrdude-5.1/avrdude.conf.in.orig 2006-01-17 22:01:25.000000000 +0100 -+++ avrdude-5.1/avrdude.conf.in 2006-02-11 22:09:53.000000000 +0100 -@@ -537,6 +537,12 @@ programmer - miso = 7; ++@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; fi +diff -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 @@ -96,10 +75,10 @@ diff -pu avrdude-5.1/avrdude.conf.in.orig avrdude-5.1/avrdude.conf.in # # PART DEFINITIONS # -diff -pu avrdude-5.1/config_gram.y.orig avrdude-5.1/config_gram.y ---- avrdude-5.1/config_gram.y.orig 2005-11-25 07:14:06.000000000 +0100 -+++ avrdude-5.1/config_gram.y 2006-02-11 22:09:53.000000000 +0100 -@@ -40,6 +40,7 @@ +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" @@ -107,15 +86,15 @@ diff -pu avrdude-5.1/config_gram.y.orig avrdude-5.1/config_gram.y #if defined(WIN32NATIVE) #define strtok_r( _s, _sep, _lasts ) \ -@@ -125,6 +126,7 @@ static int parse_cmdbits(OPCODE * op); - %token K_VCC - %token K_VFYLED +@@ -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_NO - %token K_YES -@@ -372,6 +374,12 @@ prog_parm : + %token K_MEMORY + +@@ -481,6 +483,12 @@ prog_parm : } } | @@ -128,25 +107,25 @@ diff -pu avrdude-5.1/config_gram.y.orig avrdude-5.1/config_gram.y 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.1/lexer.l.orig avrdude-5.1/lexer.l ---- avrdude-5.1/lexer.l.orig 2005-11-25 07:14:06.000000000 +0100 -+++ avrdude-5.1/lexer.l 2006-02-11 22:09:53.000000000 +0100 -@@ -172,6 +172,7 @@ stk500 { yylval=NULL; return K - stk500v2 { yylval=NULL; return K_STK500V2; } +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.1/usbtiny.c ---- /dev/null 2006-01-16 00:01:55.000000000 +0100 -+++ avrdude-5.1/usbtiny.c 2006-02-25 20:51:32.000000000 +0100 -@@ -0,0 +1,414 @@ +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 (C) 2006 Dick Streefland ++// 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. @@ -157,8 +136,9 @@ diff -pu /dev/null avrdude-5.1/usbtiny.c +#include "pgm.h" +#include "avr.h" + -+#define USBDEV_VENDOR 0x1964 -+#define USBDEV_PRODUCT 0x0001 ++// VID/PID assigned to USBtiny (http://www.ladyada.net/make/usbtinyisp/) ++#define USBTINY_VENDOR 0x1781 ++#define USBTINY_PRODUCT 0x0C9F + +enum +{ @@ -203,10 +183,6 @@ diff -pu /dev/null avrdude-5.1/usbtiny.c +static usb_dev_handle* usb_handle; +static int sck_period; +static int chunk_size; -+static AVRMEM* cache_mem; -+static ulong_t cache_base; -+static byte_t cache_buf[CHUNK_SIZE]; -+static int cache_disable; + +// ---------------------------------------------------------------------- + @@ -279,8 +255,8 @@ diff -pu /dev/null avrdude-5.1/usbtiny.c + { + for ( dev = bus->devices; dev; dev = dev->next ) + { -+ if ( dev->descriptor.idVendor == USBDEV_VENDOR -+ && dev->descriptor.idProduct == USBDEV_PRODUCT ++ if ( dev->descriptor.idVendor == USBTINY_VENDOR ++ && dev->descriptor.idProduct == USBTINY_PRODUCT + ) + { + usb_handle = usb_open( dev ); @@ -296,7 +272,7 @@ diff -pu /dev/null avrdude-5.1/usbtiny.c + } + } + fprintf( stderr, "Could not find USB device 0x%x/0x%x\n", -+ USBDEV_VENDOR, USBDEV_PRODUCT ); ++ USBTINY_VENDOR, USBTINY_PRODUCT ); + return -1; +} + @@ -362,7 +338,7 @@ diff -pu /dev/null avrdude-5.1/usbtiny.c + { // no response, RESET and try again + usb_control( USBTINY_POWERUP, sck_period, RESET_HIGH ); + usb_control( USBTINY_POWERUP, sck_period, RESET_LOW ); -+ usleep( 20000 ); ++ usleep( 50000 ); + if ( ! usbtiny_avr_op( pgm, p, AVR_OP_PGM_ENABLE, res ) ) + { // give up + return -1; @@ -384,10 +360,9 @@ diff -pu /dev/null avrdude-5.1/usbtiny.c +{ + int r; + -+ cache_mem = NULL; + memset( res, '\0', sizeof(res) ); + r = usb_in( USBTINY_SPI, (cmd[1] << 8) | cmd[0], (cmd[3] << 8) | cmd[2], -+ (char*) res, sizeof(res), 8 * sck_period ); ++ res, sizeof(res), 8 * sck_period ); + if ( verbose > 1 ) + { + printf( "CMD: [%02x %02x %02x %02x] [%02x %02x %02x %02x]\n", @@ -409,7 +384,7 @@ diff -pu /dev/null avrdude-5.1/usbtiny.c + return r; +} + -+static void usbtiny_display ( PROGRAMMER* pgm, char* p ) ++static void usbtiny_display ( PROGRAMMER* pgm, const char* p ) +{ +} + @@ -489,53 +464,6 @@ diff -pu /dev/null avrdude-5.1/usbtiny.c + return n_bytes; +} + -+static int usbtiny_read_byte ( PROGRAMMER* pgm, AVRPART* p, AVRMEM* m, -+ ulong_t addr, byte_t* value ) -+{ -+ ulong_t base; -+ int req; -+ int size; -+ -+ if ( cache_disable > 0 ) -+ { -+ return -1; // fall back to avr_read_byte_default() -+ } -+ if ( strcmp( m->desc, "flash" ) != 0 -+ && strcmp( m->desc, "eeprom" ) != 0 -+ ) -+ { -+ return -1; // fall back to avr_read_byte_default() -+ } -+ base = addr & ~ (chunk_size - 1); -+ if ( cache_mem != m || cache_base != base ) -+ { -+ req = ( strcmp( m->desc, "flash" ) == 0 -+ ? USBTINY_FLASH_READ -+ : USBTINY_EEPROM_READ -+ ); -+ size = (m->size < chunk_size ? m->size : chunk_size); -+ if ( usb_in( req, 0, (int) base, cache_buf, size, 32 * sck_period ) != 0 ) -+ { -+ cache_mem = NULL; -+ return -1; -+ } -+ cache_mem = m; -+ cache_base = base; -+ } -+ *value = cache_buf[addr - base]; -+ return 0; -+} -+ -+static int usbtiny_write_byte ( PROGRAMMER* pgm, AVRPART* p, AVRMEM* m, -+ ulong_t addr, byte_t value ) -+{ -+ int r; -+ -+ cache_disable++; -+ r = avr_write_byte_default( pgm, p, m, addr, value ); -+ cache_disable--; -+ return r; -+} + +extern void usbtiny_initpgm ( PROGRAMMER* pgm ) +{ @@ -553,12 +481,12 @@ diff -pu /dev/null avrdude-5.1/usbtiny.c + pgm->close = usbtiny_close; + pgm->paged_load = usbtiny_paged_load; + pgm->paged_write = usbtiny_paged_write; -+ pgm->read_byte = usbtiny_read_byte; -+ pgm->write_byte = usbtiny_write_byte; ++ pgm->read_byte = avr_read_byte_default; ++ pgm->write_byte = avr_write_byte_default; + pgm->set_sck_period = usbtiny_set_sck_period; +} -diff -pu /dev/null avrdude-5.1/usbtiny.h ---- /dev/null 2006-01-16 00:01:55.000000000 +0100 -+++ avrdude-5.1/usbtiny.h 2006-02-11 22:09:53.000000000 +0100 +diff -pu /dev/null avrdude-5.4/usbtiny.h +--- /dev/null 2007-11-20 19:44:18.000000000 +0100 ++++ avrdude-5.4/usbtiny.h 2008-01-15 14:08:59.000000000 +0100 @@ -0,0 +1 @@ +extern void usbtiny_initpgm ( PROGRAMMER* pgm ); diff --git a/Firmware/pocket-prog/patches/lirc-0.8.2.diff b/Firmware/pocket-prog/patches/lirc-0.8.2.diff new file mode 100644 index 0000000..2f4fb06 --- /dev/null +++ b/Firmware/pocket-prog/patches/lirc-0.8.2.diff @@ -0,0 +1,20 @@ +diff -pu lirc-0.8.2/drivers/lirc_igorplugusb/lirc_igorplugusb.c.orig lirc-0.8.2/drivers/lirc_igorplugusb/lirc_igorplugusb.c +--- lirc-0.8.2/drivers/lirc_igorplugusb/lirc_igorplugusb.c.orig 2007-02-13 08:28:38.000000000 +0100 ++++ lirc-0.8.2/drivers/lirc_igorplugusb/lirc_igorplugusb.c 2008-01-15 14:47:04.000000000 +0100 +@@ -110,7 +110,7 @@ + #define ADDITIONAL_LIRC_BYTES 2 + + /* times to poll per second */ +-#define SAMPLE_RATE 10 ++#define SAMPLE_RATE 100 + + + /**** Igor's USB Request Codes */ +@@ -373,6 +373,7 @@ static int usb_remote_poll(void* data, s + /* 1 Igor-tick = 85.333333 us */ + code = (unsigned int)ir->buf_in[i] * 85 + + (unsigned int)ir->buf_in[i]/3; ++ ir->last_time.tv_usec += code; + if(ir->in_space) + code |= PULSE_BIT; + lirc_buffer_write_n(buf, (unsigned char*)&code, 1); diff --git a/Firmware/pocket-prog/spi/Makefile b/Firmware/pocket-prog/spi/Makefile index e0d2277..30dd8cd 100644 --- a/Firmware/pocket-prog/spi/Makefile +++ b/Firmware/pocket-prog/spi/Makefile @@ -1,7 +1,7 @@ # ====================================================================== # Makefile for USB SPI interface # -# Copyright (C) 2006 Dick Streefland +# 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. @@ -10,9 +10,8 @@ USBTINY = ../usbtiny TARGET_ARCH = -mmcu=attiny2313 OBJECTS = main.o -FLASH_CMD = avrdude -c usbtiny -B 1 -pt2313 -U flash:w:main.hex -#FUSE_CMD = avrdude -c usbtiny -B 10 -pt2313 -U hfuse:w:0xd9:m -U lfuse:w:0xef:m -FUSE_CMD = avrdude -c usbtiny -pt2313 -U hfuse:w:0xdf:m -U lfuse:w:0xef:m +FLASH_CMD = avrdude -pt2313 -U flash:w:main.hex +FUSES_CMD = avrdude -pt2313 -U hfuse:w:0xdb:m -U lfuse:w:0xef:m STACK = 32 FLASH = 2048 SRAM = 128 diff --git a/Firmware/pocket-prog/spi/main.c b/Firmware/pocket-prog/spi/main.c index fb1dbdf..72fec6f 100644 --- a/Firmware/pocket-prog/spi/main.c +++ b/Firmware/pocket-prog/spi/main.c @@ -1,11 +1,10 @@ // ====================================================================== // Control a parallel port AVR programmer (avrdude type "bsd") via USB. // -// Copyright (C) 2006 Dick Streefland +// Copyright 2006-2010 Dick Streefland // // This is free software, licensed under the terms of the GNU General // Public License as published by the Free Software Foundation. -// // ====================================================================== #include @@ -15,10 +14,10 @@ enum { // Generic requests USBTINY_ECHO, // echo test - USBTINY_READ, // read byte - USBTINY_WRITE, // write byte - USBTINY_CLR, // clear bit - USBTINY_SET, // set bit + 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 @@ -28,40 +27,31 @@ enum 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) - USBTINY_DDRWRITE, // set port direction - USBTINY_SPI1 // a single SPI command }; // ---------------------------------------------------------------------- // Programmer output pins: // LED PB0 (D0) -#define LED PB0 // VCC PB1 (D1) // VCC PB2 (D2) // VCC PB3 (D3) -// RESET PB5 (D4) -#define RESET PB4 -// MOSI PB5 (D5) -#define MOSI PB5 -// SCK PB7 (D7) -#define SCK PB7 - +// RESET PB5 (D5) +// SCK PB6 (D6) +// MOSI PB7 (D7) // ---------------------------------------------------------------------- #define PORT PORTB #define DDR DDRB -#define POWER_MASK _BV(LED) -#define RESET_MASK _BV(RESET) -#define SCK_MASK _BV(SCK) -#define MOSI_MASK _BV(MOSI) -#define LED_MASK _BV(LED) +#define POWER_MASK 0x0f +#define RESET_MASK (1 << 5) +#define SCK_MASK (1 << 6) +#define MOSI_MASK (1 << 7) // ---------------------------------------------------------------------- // Programmer input pins: -// MISO PB6 -#define MISO 6 +// MISO PD3 (ACK) // ---------------------------------------------------------------------- -#define PIN PINB -#define MISO_MASK _BV(MISO) +#define PIN PIND +#define MISO_MASK (1 << 3) // ---------------------------------------------------------------------- // Local data @@ -79,7 +69,7 @@ static byte_t res[4]; // SPI result buffer // Delay exactly times 0.5 microseconds (6 cycles). // ---------------------------------------------------------------------- __attribute__((always_inline)) -static void delay ( void ) +static inline void delay ( void ) { asm volatile( " mov __tmp_reg__,%0 \n" @@ -93,15 +83,15 @@ static void delay ( void ) // ---------------------------------------------------------------------- // Issue one SPI command. // ---------------------------------------------------------------------- -static void spi ( byte_t* cmd, byte_t* res, int i ) +static void spi ( byte_t* cmd, byte_t* res ) { + byte_t i; byte_t c; byte_t r; byte_t mask; - while (i != 0) + for ( i = 0; i < 4; i++ ) { - i--; c = *cmd++; r = 0; for ( mask = 0x80; mask; mask >>= 1 ) @@ -144,7 +134,7 @@ static void spi_rw ( void ) } cmd[1] = a >> 9; cmd[2] = a >> 1; - spi( cmd, res, 4 ); + spi( cmd, res ); } // ---------------------------------------------------------------------- @@ -164,27 +154,29 @@ extern byte_t usb_setup ( byte_t data[8] ) return 8; } addr = (byte_t*) (int) data[4]; - bit = data[2] & 7; - mask = 1 << bit; - if (req == USBTINY_SET) { - PORT |= mask; - return 0; - } - if (req == USBTINY_CLR) { - PORT &= ~ mask; - return 0; + if ( req == USBTINY_READ ) + { + data[0] = *addr; + return 1; } - if (req == USBTINY_WRITE) { - PORT = data[2]; - return 0; + if ( req == USBTINY_WRITE ) + { + *addr = data[2]; + return 0; } - if (req == USBTINY_READ) { - data[0] = PIN; - return 1; + bit = data[2] & 7; + mask = 1 << bit; + if ( req == USBTINY_CLR ) + { + *addr &= ~ mask; + return 0; } - if (req == USBTINY_DDRWRITE) { - DDR = data[2]; + if ( req == USBTINY_SET ) + { + *addr |= mask; + return 0; } + // Programming requests if ( req == USBTINY_POWERUP ) { @@ -194,17 +186,15 @@ extern byte_t usb_setup ( byte_t data[8] ) { mask |= RESET_MASK; } - PORTD &= ~_BV(4); - DDR = POWER_MASK | RESET_MASK | SCK_MASK | MOSI_MASK; + DDR = 0xff; PORT = mask; return 0; } if ( req == USBTINY_POWERDOWN ) { - //PORT |= RESET_MASK; - DDR = 0x00; + PORT |= RESET_MASK; PORT = 0x00; - PORTD |= _BV(4); + DDR = 0x00; return 0; } if ( ! PORT ) @@ -213,14 +203,9 @@ extern byte_t usb_setup ( byte_t data[8] ) } if ( req == USBTINY_SPI ) { - spi( data + 2, data + 0, 4 ); + spi( data + 2, data + 0 ); return 4; } - if ( req == USBTINY_SPI1 ) - { - spi( data + 2, data + 0, 1 ); - return 1; - } if ( req == USBTINY_POLL_BYTES ) { poll1 = data[2]; @@ -283,7 +268,7 @@ extern void usb_out ( byte_t* data, byte_t len ) cmd[0] ^= 0x60; // turn write into read for ( usec = 0; usec < timeout; usec += 32 * sck_period ) { // when timeout > 0, poll until byte is written - spi( cmd, res, 4 ); + spi( cmd, res ); r = res[3]; if ( r == cmd[3] && r != poll1 && r != poll2 ) { @@ -296,17 +281,11 @@ extern void usb_out ( byte_t* data, byte_t len ) // ---------------------------------------------------------------------- // Main // ---------------------------------------------------------------------- -__attribute__((naked)) // suppress redundant SP initialization extern int main ( void ) { - PORTD |= _BV(4); - DDRD = _BV(6) | _BV(5) | _BV(4); // setup USB pullup, LED pin and buffer select pins to output - usb_init(); - PORTD = _BV(6) | _BV(4); // pull pull-up and buffer disable high - - for ( ;; ) - { - usb_poll(); - } - return 0; + usb_init(); + for ( ;; ) + { + usb_poll(); + } } diff --git a/Firmware/pocket-prog/spi/main.hex b/Firmware/pocket-prog/spi/main.hex index 70ce802..a916c0a 100644 --- a/Firmware/pocket-prog/spi/main.hex +++ b/Firmware/pocket-prog/spi/main.hex @@ -1,127 +1,129 @@ -:100000002CC05BC038C037C036C035C034C033C028 -:1000100032C031C030C02FC02EC02DC02CC02BC06C -:100020002AC029C028C000CDD914F13C28E5A16C14 -:1000300078B5509D894412010101FF000008811725 -:100040009F0C040100000001090212000101008060 -:10005000320904000000FF00000011241FBECFED94 -:10006000CDBF10E0A2E6B0E001C01D92AE39B107ED -:10007000E1F7A1D3A8C3C4CFDC019FEF8FEF660FD8 -:10008000B9F046E2F0E0229560FF2D91E82FE227DB -:10009000EF70929582958F70392F307F832B9F70F0 -:1000A000E40F359193273170932783276A9559F789 -:1000B000809590958D939D9308950F931F932F9303 -:1000C000DF93CF930FB70F938299FECF82990BC026 -:1000D000829909C0829907C0829905C0829903C09C -:1000E00000E40ABFA8C0C0918600DD27C957DF4FD2 -:1000F0000BE01CE024E0829BE9CF3F934F936F938A -:1001000060B330E803C060B3432B499344276C705D -:100110002627215020B32C70A9F137953C3FA0F53C -:100120006227615060B36C7037953C3F98F5262785 -:100130002150379520B32C703C3F90F562276150D9 -:1001400037953C3F60B36C70A0F52627215037955A -:100150003C3FC8F520B32C706227615037953C3F77 -:10016000B0F50A9560B37AF06C7026272150379568 -:100170003C3F88F520B32C706227615037953C3F97 -:1001800010F22DC031C048C0612720B32C703F77DA -:100190004160C6CF3F77426060B36C702127C7CF04 -:1001A0003F774460612720B32C70622761503795F8 -:1001B000C8CF3F7748602127316060B36C70262735 -:1001C00021503795C6CF3F7740616127C1CF3F7738 -:1001D00040622127C4CF3F7740646127C9CF3F7772 -:1001E0004068212700C08FCF30E43ABF0B50019503 -:1001F000033090F0C01B2881233C91F12B3481F116 -:1002000019811F7740919D00141731F42936D9F0D8 -:100210002D3249F0213E39F04427409362006F911E -:100220004F913F9108C0209362006F914F913F9191 -:100230000AB706FD49CF0F910FBFCF91DF912F91E4 -:100240001F910F911895009178000023F1F04091D3 -:1002500085004423D1F440937800C9E7D0E018C06A -:10026000209162002223C1F240918500442369F469 -:100270000093850020938400009186004BE0401B92 -:1002800040938600C0E6D0E002C0C1E6D0E001E0C5 -:1002900022B3237F286011B31C6022BB11BB1CE07A -:1002A00030E830FF212722BB379547954C3FC0F5FA -:1002B00030FF2127379522BB47954C3FA8F530FFEB -:1002C00021273795000022BB47954C3F78F530FF3A -:1002D00021273795000022BB47954C3F48F530FF5A -:1002E0002127699122BB379547954C3F18F530FF80 -:1002F0002127379522BB47954C3F00F530FF21273A -:100300003795479522BB4C3FD8F430FF21273795CE -:10031000362F479522BB4C3FA8F40A9512F614C01D -:100320002127442722BBC2CF2127C5CF2127CBCFEE -:100330002127D1CF2127442722BBD7CF2127DACFAE -:100340002127DFCF2127E5CF237F22BB6F914F915C -:100350003F9100E40ABFDF91CF9111B3022F2860D3 -:1003600022BB137FDFBFDF912F91000011BB02BBC7 -:100370001F910F91189585B7836085BF8BB78064F7 -:100380008BBF789408951F93CF93DF93609185007E -:10039000662309F461C080918600CCE0D0E0C81BE0 -:1003A000D109C957DF4F81E08093630080918400B9 -:1003B0008D3209F043C01E818F8181111FEF88812A -:1003C000807661F58981882321F41882198292E070 -:1003D0002DC0853021F48A81809367009FC08630CC -:1003E00091F482E0809363008B81813021F492E16B -:1003F000C6E3D0E01BC0823009F090C0959A92E12C -:10040000C8E4D0E013C0883019F481E0888304C0C8 -:100410008A3009F083C0188291E008C0CE01DBD099 -:10042000982F8F3F19F483E080936300191708F029 -:10043000192FD0936600C093650005C0635011F07A -:10044000CE015FD110E01093640083EC80937900BB -:10045000109278001092850080917800882309F02E -:1004600053C020916300222309F44AC0809179008F -:1004700098E889278093790010916400193010F072 -:1004800018E002C0112379F1233031F48AE790E0BB -:10049000612F22D1182F22C0309165004091660053 -:1004A000213061F4832F942FFC01AAE7B0E0819101 -:1004B0008D938E2F831B8117D0F30CC0832F942F25 -:1004C000FC01AAE7B0E0849131968D938E2F831BB7 -:1004D0008117C8F3F0936600E09365008091640093 -:1004E000811B809364008AE790E0612FC5DD1D5F6A -:1004F000109378001350183038F41092630004C041 -:100500008091670080939D008AE002C0815019F0BD -:10051000839BFCCF05C01092670002C090E088CF9B -:10052000DF91CF911F9108951F93FC01DB01709122 -:10053000680023C0108190E060E820E030E0862F62 -:10054000812309F0C59A072E00C000000A94E1F744 -:10055000C79A072E00C000000A94E1F7990FB699D8 -:100560009F5FC598C79866952F5F3F4F283031052C -:1005700031F74150504031969D9341155105D1F6C8 -:100580001F91089520916B0030916C002F5F3F4FB9 -:1005900030936C0020936B002150304080916F00AD -:1005A00087FF02C0220F331F8093700020FF03C01B -:1005B000886080937000832F8695809371003695B4 -:1005C00027952093720080E790E064E770E044E0B4 -:1005D00050E0AADF0895FC013181332311F488E053 -:1005E0000895BC016E5F7F4F4281242F277081E008 -:1005F00090E0982F01C0990F2A95EAF7343019F44A -:1006000088B3982B20C0333021F488B39095982379 -:100610001AC0323011F448BB5BC0313019F486B3D4 -:1006200080832CC03D3011F447BB15C0353069F4D0 -:10063000409368008481882311F091E101C091E02A -:10064000949881EB87BB98BB43C0363021F417BA2E -:1006500018BA949A3DC088B38823E1F1373039F451 -:10066000CB01BF0144E050E05FDF84E008953E30FD -:1006700039F4CB01BF0141E050E056DF81E008953D -:10068000383031F440936900838180936A0020C040 -:100690008481958190936C0080936B00393011F4C4 -:1006A00080E203C03B3029F480EA80936F008FEF33 -:1006B00008958281938190936E0080936D003A300B -:1006C00011F480E403C03C3029F480EC80936F0087 -:1006D00080E0089580E008950F931F93CF93DF93F8 -:1006E000062FEC0110E005C04DDF80917700899363 -:1006F0001F5F1017C8F3802FDF91CF911F910F91CB -:1007000008957F928F929F92AF92BF92CF92DF9285 -:10071000EF92FF920F931F93CF93DF93862EA090BB -:100720006D00B0906E0090906900C0906A002091BA -:100730006800E22EFF2435E0EE0CFF1C3A95E1F74D -:100740008C01DD2420E6722E26C0F8018081809382 -:10075000730018DF80917000872580937000C0E0DF -:10076000D0E013C080E790E064E770E044E050E040 -:10077000DBDE9091770080917300981721F4991532 -:1007800011F09C1529F4CE0DDF1DCA15DB0550F3C1 -:10079000D3940F5F1F4FD814C0F2DF91CF911F91F8 -:1007A0000F91FF90EF90DF90CF90BF90AF909F9010 -:1007B0008F907F900895949A80E781BBDCDD80E57F -:0A07C00082BBE1DDFECFF894FFCF0D -:0207CA00D25A01 +:100000004AC07DC056C055C054C053C052C051C034 +:1000100050C04FC04EC04DC04CC04BC04AC049C07C +:1000200048C047C046C000CDD914F13C28E5A16CBA +:1000300078B5509D894409021200010100803209FF +:1000400004000000FF00000012010101FF00000891 +:1000500081179F0C07010102000104030904180322 +:10006000550053004200740069006E0079002000C2 +:1000700053005000490020034400690063006B00F6 +:1000800020005300740072006500650066006C007B +:1000900061006E00640011241FBECFEDCDBF10E0E3 +:1000A000A0E6B0E001C01D92AE39B107E1F79CD3E4 +:1000B0009EC3A6CFDC019FEF8FEF46E2F0E018C0B1 +:1000C0002D918227E82FEF70E40F3591E82FE2950C +:1000D000892F932F3170E327EF709295392F9F70FE +:1000E000307E8327E40F3591932731709327832740 +:1000F0006A9532F7809590958D939D9308950F930F +:100100001F932F93DF93CF930FB70F938299FECF57 +:1001100082990BC0829909C0829907C0829905C053 +:10012000829903C000E40ABFACC0C0918600DD27FD +:10013000C957DF4F0BE014E124E0829BE9CF3F93E6 +:100140004F936F9360B330E803C060B3432B499380 +:10015000442764712627215020B32471A9F13795D3 +:100160003C3FA0F56227615060B3647137953C3F16 +:1001700098F526272150379520B324713C3F90F500 +:100180006227615037953C3F60B36471A0F5262724 +:10019000215037953C3FC8F520B324716227615048 +:1001A00037953C3FB0F50A9560B37AF06471262725 +:1001B000215037953C3F88F520B324716227615068 +:1001C00037953C3F10F22DC031C052C0612720B39B +:1001D00024713F774160C6CF3F77426060B364715E +:1001E0002127C7CF3F774460612720B3247162275E +:1001F00061503795C8CF3F7748602127316060B3A1 +:100200006471262721503795C6CF3F77406161271B +:10021000C1CF3F7740622127C4CF3F774064612739 +:10022000C9CF3F774068212700C08FCF30E43ABF65 +:100230000B500195C01BD040288121FD2DC0198194 +:100240001F7740919D00141799F4293691F400917D +:1002500076000023F1F0409185004423D1F44093CF +:1002600076004091820040939D00C7E7D0E02BC00C +:100270002227209360006F914F913F910AB706FDAE +:1002800045CF0F910FBFCF91DF912F911F910F910C +:100290001895C3E8D0E016C0217059F32091600092 +:1002A000222339F340918500442399F70093850078 +:1002B00020938400009186004BE0401B4093860011 +:1002C000C5E7D0E001E022B32B7E206111B31461B9 +:1002D00022BB11BB14E130E830FF212722BB379548 +:1002E00047954C3FC0F530FF2127379522BB4795F6 +:1002F0004C3FA8F530FF21273795000022BB4795DA +:100300004C3F78F530FF21273795000022BB4795F9 +:100310004C3F48F530FF2127699122BB379547951F +:100320004C3F18F530FF2127379522BB47954C3FAE +:1003300000F530FF21273795479522BB4C3FD8F475 +:1003400030FF21273795362F479522BB4C3FA8F425 +:100350000A9512F614C02127442722BBC2CF2127B9 +:10036000C5CF2127CBCF2127D1CF2127442722BB9F +:10037000D7CF2127DACF2127DFCF2127E5CF2B7E4B +:1003800022BB6F914F913F9100E40ABFDF91CF9163 +:1003900011B3022F206122BB1B7EDFBFDF912F91A3 +:1003A000000011BB02BB1F910F91189585B78360A8 +:1003B00085BF8BB780648BBF82ED809375008AE523 +:1003C00080938300789408951F93CF93DF93609177 +:1003D0008500662309F474C080918600CCE0D0E0EB +:1003E000C81BD109C957DF4F81E080936400809119 +:1003F00084008D3209F056C01E818F8181111FEF5C +:100400008881807671F58981811104C018821982F2 +:1004100082E040C0853021F48A818093820039C017 +:100420008630A9F482E0809364008B81813009F1E9 +:10043000823019F1833069F58A81882311F1813086 +:1004400021F1823031F588E1CEE5D0E023C088305B +:1004500019F481E088831EC08A30D9F4188281E0C3 +:1004600019C0CE01E4D08F3FA9F483E080936400EB +:1004700013C082E1C8E4D0E00DC082E1C6E3D0E061 +:1004800009C084E0CAE5D0E005C080E2C6E7D0E05C +:1004900001C080E0811708F0812FD0936200C093E3 +:1004A000610005C0635011F0CE0154D180E080930B +:1004B000630083EC809377001092760010928500A1 +:1004C00080917600811150C080916400882309F4E6 +:1004D0004BC09091770028E8922790937700109175 +:1004E0006300193018F4112399F101C018E083302A +:1004F00031F4612F88E790E00CD1182F24C0E091EF +:100500006100F0916200813081F4DF0148E750E042 +:10051000EA019D012F5F3F4FF9018C9189938C2F48 +:10052000841B811760F4D901F4CF28E730E0D901AA +:1005300084918D9331968A2F821B8117C8F3F09393 +:100540006200E093610080916300811B80936300EF +:10055000612F88E790E0AEDD83E0810F8093760025 +:10056000183010F4109264008AE0849906C081501B +:10057000E1F71092820010929D00DF91CF911F91C0 +:100580000895CF93DF93FB01AC014C5F5F4FEC010B +:10059000A991CE0128E030E070E860E0B72FBA23DF +:1005A00009F0C79AB09174000B2E00C000000A94A5 +:1005B000E1F7C69AB09174000B2E00C000000A94B7 +:1005C000E1F7660F83996F5FC798C69876952150BB +:1005D00031092115310511F7619384179507B9F693 +:1005E000DF91CF91089580917000909171009C01EE +:1005F0002F5F3F4F309371002093700020916D006A +:1006000027FF02C0880F991F80FD28602093690092 +:100610009C01232F3327269520936A009695879572 +:1006200080936B0065E670E089E690E0AACFFC015C +:100630002181222309F46BC04481A42FB0E0213032 +:1006400021F48C91808381E008953281223011F46D +:100650003C935BC0532F577081E090E0052E01C0A2 +:10066000880F0A94EAF7233021F480959C9198230F +:1006700004C0243021F49C91982B9C9346C02530D3 +:1006800059F430937400411102C08FE001C08FE231 +:100690009FEF97BB88BB39C0263021F4C59A18BAA2 +:1006A00017BA33C088B3882381F1273031F4BF01F2 +:1006B000CF01029666DF84E00895283031F430934C +:1006C000730083818093720020C084819581909310 +:1006D000710080937000293011F480E203C02B3048 +:1006E00029F480EA80936D008FEF089582819381D1 +:1006F00090936F0080936E002A3011F480E403C061 +:100700002C3019F480EC80936D0080E0089588E02F +:100710000895EF92FF920F931F93CF93DF931F9251 +:10072000CDB7DD278C01862F78019E2D901B981761 +:1007300048F4898358DF90916800F70191937F0115 +:100740008981F3CF0F90DF91CF911F910F91FF908F +:10075000EF900895CF92DF92EF92FF920F931F9345 +:10076000CF93DF937C01D62EEC01E0E6CE2E8C2FCA +:100770008E198D1580F5899180936C0034DF8091FE +:1007800069008C258093690000E010E080916E0084 +:1007900090916F000817190750F765E670E089E639 +:1007A00090E0EFDE8091680090916C00891308C0A2 +:1007B00090917300891721F0909172008913D7CF1F +:1007C0002091740030E075E0220F331F7A95E1F735 +:1007D000020F131FDBCFDF91CF911F910F91FF907D +:1007E000EF90DF90CF900895E1DDEEDDFECFF8943D +:0207F000FFCF39 :00000001FF diff --git a/Firmware/pocket-prog/spi/spi.ps b/Firmware/pocket-prog/spi/spi.ps index e686cb7..d4ef001 100644 Binary files a/Firmware/pocket-prog/spi/spi.ps and b/Firmware/pocket-prog/spi/spi.ps differ diff --git a/Firmware/pocket-prog/spi/spi.py b/Firmware/pocket-prog/spi/spi.py index 0dadf02..7afc6ae 100644 --- a/Firmware/pocket-prog/spi/spi.py +++ b/Firmware/pocket-prog/spi/spi.py @@ -1,14 +1,16 @@ #!/usr/bin/python # ====================================================================== # spi.py - USBtiny/spi test program +# +# Copyright 2006-2010 Dick Streefland # ====================================================================== -import sys, os.path +import sys, os.path, time sys.path[0] = os.path.join(sys.path[0], '../util') import usbtiny -vendor = 0x1964 -product = 0x0001 +vendor = 0x1781 +product = 0x0C9F # Generic requests USBTINY_ECHO = 0 # echo test @@ -34,6 +36,7 @@ s - set bit at U - powerup; set RESET to D - powerdown + R - powerup; track MISO state with LED C - issue SPI command P - set poll bytes f - read from flash @@ -59,7 +62,7 @@ c3 = int(sys.argv[4], 16) if argc > 5: c4 = int(sys.argv[5], 16) -if not (argc == 2 and cmd in "tD")\ +if not (argc == 2 and cmd in "tDR")\ and not (argc == 3 and cmd in "rU")\ and not (argc == 4 and cmd in "wcsPfe")\ and not (argc == 5 and cmd in "FE")\ @@ -87,6 +90,28 @@ dev.control_in(USBTINY_POWERUP, 20, byte, 0) elif cmd == 'D': dev.control_in(USBTINY_POWERDOWN, 0, 0, 0) +elif cmd == 'R': + try: + dev.control_in(USBTINY_POWERUP, 20, 1, 0) + led = 1 + while True: + # read input PD3 (MISO from target) + pind = dev.control_in(USBTINY_READ, 0, 0x30, 1) + pd3 = (ord(pind) >> 3) & 1 + if pd3 != led: + # update PB0 output (programmer LED) + if pd3: + dev.control_in(USBTINY_SET, 0, 0x38, 0) + else: + dev.control_in(USBTINY_CLR, 0, 0x38, 0) + led = pd3 + time.sleep(0.02) + except: + pass + finally: + dev.control_in(USBTINY_POWERUP, 20, 0, 0) + time.sleep(0.2) + dev.control_in(USBTINY_POWERDOWN, 0, 0, 0) elif cmd == 'C': r = dev.control_in(USBTINY_SPI, addr + (byte << 8), c3 + (c4 << 8), 4) if len(r) == 4: diff --git a/Firmware/pocket-prog/spi/spi.sch b/Firmware/pocket-prog/spi/spi.sch new file mode 100644 index 0000000..e3fa1f9 --- /dev/null +++ b/Firmware/pocket-prog/spi/spi.sch @@ -0,0 +1,400 @@ +v 20070626 1 +T 63600 57350 5 10 0 0 0 0 1 +device=AT90S2313 +T 63600 57550 5 10 0 0 0 0 1 +footprint=DIP20 +T 63600 57750 5 10 0 0 0 0 1 +net=GND:10 +T 63600 57950 5 10 0 0 0 0 1 +net=Vcc:20 +T 63600 58150 5 10 0 0 0 0 1 +description=8-bit RISC micro controller (Atmel) +T 63600 58350 5 10 0 0 0 0 1 +numslots=0 +T 63600 58550 5 10 0 0 0 0 1 +author=Werner Hoch +T 63500 57500 5 10 0 1 0 0 1 +device=HEADER10 +T 63500 55500 8 10 0 1 0 0 1 +pins=10 +T 63500 55500 8 10 0 1 0 0 1 +class=IO +T 67500 57850 5 10 0 0 0 0 1 +device=DB25 +C 63500 52200 1 0 1 DB25-2.sym +{ +T 63300 57900 5 10 1 1 0 6 1 +refdes=DB25 female +} +C 56800 56100 1 0 0 resistor-2.sym +{ +T 57000 56400 5 10 1 1 0 0 1 +refdes=68 +} +C 56800 55300 1 0 0 resistor-2.sym +{ +T 57000 55600 5 10 1 1 0 0 1 +refdes=68 +} +C 55500 55300 1 0 0 resistor-2.sym +{ +T 55700 55600 5 10 1 1 0 0 1 +refdes=1K5 +} +C 57700 52500 1 0 1 resistor-2.sym +{ +T 57400 52800 5 10 1 1 0 6 1 +refdes=22K +} +C 56400 57600 1 0 1 diode-1.sym +{ +T 56300 58000 5 10 1 1 0 6 1 +refdes=1N4148 +} +N 63500 55600 63900 55600 4 +N 63500 55200 63900 55200 4 +N 63500 54800 63900 54800 4 +N 63500 54400 63900 54400 4 +N 63500 54000 63900 54000 4 +N 63500 53600 63900 53600 4 +N 63500 53200 63900 53200 4 +N 63500 52800 63900 52800 4 +C 55200 58200 1 0 0 vcc-2.sym +T 65500 55650 5 10 0 0 0 0 1 +device=AT90S2313 +T 65500 55850 5 10 0 0 0 0 1 +footprint=DIP20 +T 65500 56050 5 10 0 0 0 0 1 +net=GND:10 +T 65500 56250 5 10 0 0 0 0 1 +net=Vcc:20 +P 60000 53500 60000 53700 1 0 0 +{ +T 60050 53600 5 8 1 1 0 0 1 +pinnumber=1 +T 60050 53600 5 8 0 1 0 2 1 +pinseq=1 +T 60000 53850 9 8 1 1 0 3 1 +pinlabel=Reset +T 60000 54000 5 8 0 1 0 3 1 +pintype=in +} +L 59808 53974 60192 53974 3 0 0 0 -1 -1 +V 60000 53750 50 6 0 0 0 -1 -1 0 -1 -1 -1 -1 -1 +P 59300 53500 59300 53800 1 0 0 +{ +T 59350 53600 5 8 1 1 0 0 1 +pinnumber=4 +T 59350 53600 5 8 0 1 0 2 1 +pinseq=2 +T 59300 53850 9 8 1 1 0 3 1 +pinlabel=XTAL2 +T 59300 54000 5 8 0 1 0 3 1 +pintype=out +} +P 58600 53500 58600 53800 1 0 0 +{ +T 58650 53600 5 8 1 1 0 0 1 +pinnumber=5 +T 58650 53600 5 8 0 1 0 2 1 +pinseq=3 +T 58600 53850 9 8 1 1 0 3 1 +pinlabel=XTAL1 +T 58600 54000 5 8 0 1 0 3 1 +pintype=in +} +P 58000 54600 58300 54600 1 0 0 +{ +T 58200 54650 5 8 1 1 0 6 1 +pinnumber=11 +T 58200 54550 5 8 0 1 0 8 1 +pinseq=4 +T 58350 54600 9 8 1 1 0 0 1 +pinlabel=PD6 (ICP) +T 58350 54600 5 8 0 1 0 2 1 +pintype=io +} +P 58000 55000 58300 55000 1 0 0 +{ +T 58200 55050 5 8 1 1 0 6 1 +pinnumber=9 +T 58200 54950 5 8 0 1 0 8 1 +pinseq=5 +T 58350 55000 9 8 1 1 0 0 1 +pinlabel=PD5 (T1) +T 58350 55000 5 8 0 1 0 2 1 +pintype=io +} +P 58000 55400 58300 55400 1 0 0 +{ +T 58200 55450 5 8 1 1 0 6 1 +pinnumber=8 +T 58200 55350 5 8 0 1 0 8 1 +pinseq=6 +T 58350 55400 9 8 1 1 0 0 1 +pinlabel=PD4 (T0) +T 58350 55400 5 8 0 1 0 2 1 +pintype=io +} +P 58000 55800 58300 55800 1 0 0 +{ +T 58200 55850 5 8 1 1 0 6 1 +pinnumber=7 +T 58200 55750 5 8 0 1 0 8 1 +pinseq=7 +T 58350 55800 9 8 1 1 0 0 1 +pinlabel=PD3 (INT1) +T 58350 55800 5 8 0 1 0 2 1 +pintype=io +} +P 58000 56200 58300 56200 1 0 0 +{ +T 58200 56250 5 8 1 1 0 6 1 +pinnumber=6 +T 58200 56150 5 8 0 1 0 8 1 +pinseq=8 +T 58350 56200 9 8 1 1 0 0 1 +pinlabel=PD2 (INT0) +T 58350 56200 5 8 0 1 0 2 1 +pintype=io +} +P 58000 56600 58300 56600 1 0 0 +{ +T 58200 56650 5 8 1 1 0 6 1 +pinnumber=3 +T 58200 56550 5 8 0 1 0 8 1 +pinseq=9 +T 58350 56600 9 8 1 1 0 0 1 +pinlabel=PD1 (TXD) +T 58350 56600 5 8 0 1 0 2 1 +pintype=io +} +P 58000 57000 58300 57000 1 0 0 +{ +T 58200 57050 5 8 1 1 0 6 1 +pinnumber=2 +T 58200 56950 5 8 0 1 0 8 1 +pinseq=10 +T 58350 57000 9 8 1 1 0 0 1 +pinlabel=PD0 (RXD) +T 58350 57000 5 8 0 1 0 2 1 +pintype=io +} +P 60600 54200 60300 54200 1 0 0 +{ +T 60400 54250 5 8 1 1 0 0 1 +pinnumber=19 +T 60400 54150 5 8 0 1 0 2 1 +pinseq=11 +T 60250 54200 9 8 1 1 0 6 1 +pinlabel=(SCK) PB7 +T 60250 54200 5 8 0 1 0 8 1 +pintype=io +} +P 60600 54600 60300 54600 1 0 0 +{ +T 60400 54650 5 8 1 1 0 0 1 +pinnumber=18 +T 60400 54550 5 8 0 1 0 2 1 +pinseq=12 +T 60250 54600 9 8 1 1 0 6 1 +pinlabel=(MISO) PB6 +T 60250 54600 5 8 0 1 0 8 1 +pintype=io +} +P 60600 55000 60300 55000 1 0 0 +{ +T 60400 55050 5 8 1 1 0 0 1 +pinnumber=17 +T 60400 54950 5 8 0 1 0 2 1 +pinseq=13 +T 60250 55000 9 8 1 1 0 6 1 +pinlabel=(MOSI) PB5 +T 60250 55000 5 8 0 1 0 8 1 +pintype=io +} +P 60600 55400 60300 55400 1 0 0 +{ +T 60400 55450 5 8 1 1 0 0 1 +pinnumber=16 +T 60400 55350 5 8 0 1 0 2 1 +pinseq=14 +T 60250 55400 9 8 1 1 0 6 1 +pinlabel=PB4 +T 60250 55400 5 8 0 1 0 8 1 +pintype=io +} +P 60600 55800 60300 55800 1 0 0 +{ +T 60400 55850 5 8 1 1 0 0 1 +pinnumber=15 +T 60400 55750 5 8 0 1 0 2 1 +pinseq=15 +T 60250 55800 9 8 1 1 0 6 1 +pinlabel=(OC1) PB3 +T 60250 55800 5 8 0 1 0 8 1 +pintype=io +} +P 60600 56200 60300 56200 1 0 0 +{ +T 60400 56250 5 8 1 1 0 0 1 +pinnumber=14 +T 60400 56150 5 8 0 1 0 2 1 +pinseq=16 +T 60250 56200 9 8 1 1 0 6 1 +pinlabel=PB2 +T 60250 56200 5 8 0 1 0 8 1 +pintype=io +} +P 60600 56600 60300 56600 1 0 0 +{ +T 60400 56650 5 8 1 1 0 0 1 +pinnumber=13 +T 60400 56550 5 8 0 1 0 2 1 +pinseq=17 +T 60250 56600 9 8 1 1 0 6 1 +pinlabel=(AIN1) PB1 +T 60250 56600 5 8 0 1 0 8 1 +pintype=io +} +P 60600 57000 60300 57000 1 0 0 +{ +T 60400 57050 5 8 1 1 0 0 1 +pinnumber=12 +T 60400 56950 5 8 0 1 0 2 1 +pinseq=18 +T 60250 57000 9 8 1 1 0 6 1 +pinlabel=(AIN0) PB0 +T 60250 57000 5 8 0 1 0 8 1 +pintype=io +} +B 58300 53800 2000 3600 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1 +T 65500 56450 5 10 0 0 0 0 1 +description=8-bit RISC micro controller (Atmel) +T 65500 56650 5 10 0 0 0 0 1 +numslots=0 +T 65500 56850 5 10 0 0 0 0 1 +author=Werner Hoch +T 58300 57450 9 10 1 0 0 0 1 +ATtiny2313 +N 60600 57000 62000 57000 4 +N 60600 56600 62000 56600 4 +N 60600 56200 62000 56200 4 +N 60600 55800 62000 55800 4 +N 60600 55400 62000 55400 4 +N 60600 55000 62000 55000 4 +N 60600 54600 62000 54600 4 +N 60600 54200 62000 54200 4 +C 53400 54300 1 0 0 connector4-1.sym +{ +T 53400 55700 5 10 1 1 0 0 1 +refdes=USB +} +N 55100 54800 56700 54800 4 +N 56700 54800 56700 56200 4 +N 56700 56200 56800 56200 4 +N 56400 55400 56800 55400 4 +N 56500 54100 56500 55400 4 +N 56500 55100 55100 55100 4 +N 60000 53500 60000 52600 4 +N 58000 57000 57800 57000 4 +N 57800 57000 57800 58400 4 +N 57800 58400 63700 58400 4 +N 63700 58400 63700 56400 4 +N 63700 56400 63500 56400 4 +N 58000 56600 57600 56600 4 +N 57600 56600 57600 58600 4 +N 57600 58600 63900 58600 4 +N 63900 58600 63900 56000 4 +N 63900 56000 63500 56000 4 +N 57700 56200 58000 56200 4 +N 58000 55800 57800 55800 4 +N 57800 55800 57800 53000 4 +N 57800 53000 61500 53000 4 +N 61500 53000 61500 53800 4 +N 61500 53800 62000 53800 4 +N 57700 55400 58000 55400 4 +N 58000 55000 57600 55000 4 +N 57600 55000 57600 52800 4 +N 57600 52800 61700 52800 4 +N 61700 52800 61700 53400 4 +N 61700 53400 62000 53400 4 +N 58000 54600 58000 53200 4 +N 58000 53200 61300 53200 4 +N 61300 53200 61300 57400 4 +N 61300 57400 62000 57400 4 +N 56400 57800 63500 57800 4 +N 63500 57800 63500 57200 4 +N 63900 55600 63900 51700 4 +N 55100 55400 55500 55400 4 +N 55500 57800 55400 57800 4 +N 55400 55400 55400 58200 4 +N 55400 55400 55400 52600 4 +N 55100 54500 55100 51700 4 +N 55100 51700 63900 51700 4 +N 55400 52600 56800 52600 4 +N 57700 52600 62000 52600 4 +T 63900 51400 9 10 1 0 0 6 1 +USB interface to parallel port programmer +T 54000 55500 9 10 1 0 0 0 1 +Vcc +T 54000 55200 9 10 1 0 0 0 1 +D- +T 54000 54900 9 10 1 0 0 0 1 +D+ +T 54000 54600 9 10 1 0 0 0 1 +GND +C 55600 51700 1 180 0 vss-1.sym +C 58600 53300 1 0 0 crystal-1.sym +{ +T 58100 53300 5 10 1 1 0 0 1 +refdes=12MHz +T 58800 54000 5 10 0 0 0 0 1 +symversion=0.1 +} +C 55200 52600 1 270 0 capacitor-4.sym +{ +T 55700 52400 5 10 1 1 270 0 1 +refdes=1uF +T 55900 52400 5 10 0 0 270 0 1 +symversion=0.1 +} +C 56100 53200 1 90 0 zener-1.sym +{ +T 55500 53600 5 10 0 0 90 0 1 +device=ZENER_DIODE +T 55900 54000 5 10 1 1 180 0 1 +refdes=3V6 +} +C 56700 53200 1 90 0 zener-1.sym +{ +T 56100 53600 5 10 0 0 90 0 1 +device=ZENER_DIODE +T 56500 54000 5 10 1 1 180 0 1 +refdes=3V6 +} +N 55900 54100 55900 54800 4 +N 55900 53200 55900 51700 4 +N 56500 53200 56500 51700 4 +C 59500 51800 1 90 0 capacitor-1.sym +{ +T 58800 52000 5 10 0 0 90 0 1 +device=CAPACITOR +T 59300 52500 5 10 1 1 180 0 1 +refdes=27pF +T 58600 52000 5 10 0 0 90 0 1 +symversion=0.1 +} +C 58800 51800 1 90 0 capacitor-1.sym +{ +T 58600 52500 5 10 1 1 180 0 1 +refdes=27pF +T 58100 52000 5 10 0 0 90 0 1 +device=CAPACITOR +T 57900 52000 5 10 0 0 90 0 1 +symversion=0.1 +} +N 59300 52700 59300 53500 4 +N 58600 52700 58600 53500 4 +N 58600 51800 58600 51700 4 +N 59300 51800 59300 51700 4 diff --git a/Firmware/pocket-prog/spi/usbtiny.h b/Firmware/pocket-prog/spi/usbtiny.h index 9d6b834..ada0061 100644 --- a/Firmware/pocket-prog/spi/usbtiny.h +++ b/Firmware/pocket-prog/spi/usbtiny.h @@ -1,7 +1,7 @@ // ====================================================================== // USBtiny Configuration // -// Copyright (C) 2006 Dick Streefland +// Copyright 2006-2010 Dick Streefland // // This is free software, licensed under the terms of the GNU General // Public License as published by the Free Software Foundation. @@ -12,7 +12,7 @@ // bit numbers: #define USBTINY_PORT D #define USBTINY_DPLUS 2 -#define USBTINY_DMINUS 3 +#define USBTINY_DMINUS 4 // The D+ signal should be connected to an interrupt input to trigger an // interrupt at the start of a packet. When you use the same pin for the @@ -21,6 +21,14 @@ // number: #define USBTINY_INT 0 +// Optional definition of the I/O pin to control the 1K5 pullup of the +// D- signal. This will force a reconnect after RESET. (+4 bytes) +#undef USBTINY_DMINUS_PULLUP + +// Optional definition of the I/O pin to drive the "USB OK" LED, that +// will turn on when the host has assigned a device address. (+6 bytes) +#undef USBTINY_USB_OK_LED + // The power requirement of the USB device in mA, or 0 when the device // is not bus powered: #define USBTINY_MAX_POWER 100 @@ -30,20 +38,21 @@ // Implementers Forum (www.usb.org) if you have a spare $1500 to kill. // Alternatively, you can buy a small range of device IDs from // www.voti.nl or www.mecanique.co.uk, or be naughty and use something -// else, like for instance product ID 0x6666, which is registered as +// else, like for instance vendor ID 0x6666, which is registered as // "Prototype product Vendor ID". -//#define USBTINY_VENDOR_ID 0x1B4F // SparkFun VendorID -//#define USBTINY_DEVICE_ID 0x0003 // SparkFun Product ID #3 -#define USBTINY_VENDOR_ID 0x1781 // SparkFun Licensed VendorID -#define USBTINY_DEVICE_ID 0x0C9F // SparkFun Licensed ProductID +// The USBtinyISP project (http://www.ladyada.net/make/usbtinyisp/) has +// allocated an official VID/PID pair for USBtiny. Since these IDs are +// supported by avrdude since version 5.5, we use them here as well: +#define USBTINY_VENDOR_ID 0x1781 // USBtinyISP +#define USBTINY_DEVICE_ID 0x0C9F // USBtinyISP // The version of the device as a 16-bit number: 256*major + minor. -#define USBTINY_DEVICE_VERSION 0x104 +#define USBTINY_DEVICE_VERSION 0x107 // The following optional macros may be used as an identification of // your device. Undefine them when you run out of flash space. -//#define USBTINY_VENDOR_NAME "Dick Streefland" -//#define USBTINY_DEVICE_NAME "USBtiny" +#define USBTINY_VENDOR_NAME "Dick Streefland" +#define USBTINY_DEVICE_NAME "USBtiny SPI" #undef USBTINY_SERIAL // Define the device class, subclass and protocol. Device class 0xff @@ -63,6 +72,7 @@ // as 1, you have the option of returning 0xff instead. In that case, the // USB driver will call a function usb_in() to obtain the data to send // back to the host. This can be used to generate the data on-the-fly. +// When you set this macro to 2, the transfer count is not limited to 255. #define USBTINY_CALLBACK_IN 1 // When this macro is defined as 0, OUT packets are simply ignored. @@ -71,9 +81,20 @@ // a control transfer. #define USBTINY_CALLBACK_OUT 1 +// When this macro is defined as 1, an optimized CRC function is used +// that calculates the CRC about twice as fast as the standard version, +// but at the expense of 42 bytes of additional flash memory. +#define USBTINY_FAST_CRC 1 + // Set the macro USBTINY_ENDPOINT to 1 to add an additional endpoint, // according to the values of the three other macros. #define USBTINY_ENDPOINT 0 #define USBTINY_ENDPOINT_ADDRESS 0x81 // IN endpoint #1 #define USBTINY_ENDPOINT_TYPE 0x00 // control transfer type #define USBTINY_ENDPOINT_INTERVAL 0 // ignored + +// Set the macro USBTINY_NO_DATA to 1 to avoid using initialized data +// by USBtiny. This will slightly increase the code size, but when the +// data section is empty, the code to initialize the data section will +// be omitted from the startup code. +#define USBTINY_NO_DATA 1 diff --git a/Firmware/pocket-prog/template/Makefile b/Firmware/pocket-prog/template/Makefile new file mode 100644 index 0000000..38913af --- /dev/null +++ b/Firmware/pocket-prog/template/Makefile @@ -0,0 +1,19 @@ +# ====================================================================== +# Template Makefile +# +# Copyright 2006-2010 Dick Streefland +# +# This is free software, licensed under the terms of the GNU General +# Public License as published by the Free Software Foundation. +# ====================================================================== + +USBTINY = ../usbtiny +TARGET_ARCH = -mmcu=attiny2313 +OBJECTS = main.o +FLASH_CMD = avrdude -pt2313 -U flash:w:main.hex +FUSES_CMD = avrdude -pt2313 -U hfuse:w:0xdb:m -U lfuse:w:0xef:m +STACK = 32 +FLASH = 2048 +SRAM = 128 + +include $(USBTINY)/common.mk diff --git a/Firmware/pocket-prog/template/main.c b/Firmware/pocket-prog/template/main.c new file mode 100644 index 0000000..c09b87a --- /dev/null +++ b/Firmware/pocket-prog/template/main.c @@ -0,0 +1,45 @@ +// ====================================================================== +// USBtiny template application +// +// Copyright 2006-2010 Dick Streefland +// +// This is free software, licensed under the terms of the GNU General +// Public License as published by the Free Software Foundation. +// ====================================================================== + +#include "usb.h" + +// ---------------------------------------------------------------------- +// Handle a non-standard SETUP packet. +// ---------------------------------------------------------------------- +extern byte_t usb_setup ( byte_t data[8] ) +{ + return 8; // simply echo back the setup packet +} + +// ---------------------------------------------------------------------- +// Handle an IN packet. (USBTINY_CALLBACK_IN==1) +// ---------------------------------------------------------------------- +extern byte_t usb_in ( byte_t* data, byte_t len ) +{ + return 0; +} + +// ---------------------------------------------------------------------- +// Handle an OUT packet. (USBTINY_CALLBACK_OUT==1) +// ---------------------------------------------------------------------- +extern void usb_out ( byte_t* data, byte_t len ) +{ +} + +// ---------------------------------------------------------------------- +// Main +// ---------------------------------------------------------------------- +extern int main ( void ) +{ + usb_init(); + for ( ;; ) + { + usb_poll(); + } +} diff --git a/Firmware/pocket-prog/template/main.hex b/Firmware/pocket-prog/template/main.hex new file mode 100644 index 0000000..f360e07 --- /dev/null +++ b/Firmware/pocket-prog/template/main.hex @@ -0,0 +1,91 @@ +:1000000054C087C060C05FC05EC05DC05CC05BC0E4 +:100010005AC059C058C057C056C055C054C053C02C +:1000200052C051C050C000CDD914F13C28E5A16C9C +:1000300078B5509D89440902120001010080190918 +:1000400004000000FF00000012010101FF00000891 +:1000500066660100070101020301040309040A03A3 +:1000600030003000300031002203550053004200C0 +:10007000740069006E0079002000540065006D0076 +:1000800070006C006100740065002003440069008A +:1000900063006B002000530074007200650065006F +:1000A00066006C0061006E00640011241FBECFED7D +:1000B000CDBF10E0A0E6B0E001C01D92AE38B107A0 +:1000C000E1F764D266C29CCFDC019FEF8FEF46E27E +:1000D000F0E018C02D918227E82FEF70E40F3591E2 +:1000E000E82FE295892F932F3170E327EF709295D7 +:1000F000392F9F70307E8327E40F3591932731701D +:10010000932783276A9532F7809590958D939D93D9 +:1001100008950F931F932F93DF93CF930FB70F93F0 +:100120008299FECF82990BC0829909C0829907C03B +:10013000829905C0829903C000E40ABFACC0C09197 +:100140007600DD27C958DF4F0BE014E124E0829BE5 +:10015000E9CF3F934F936F9360B330E803C060B330 +:10016000432B4993442764712627215020B32471DF +:10017000A9F137953C3FA0F56227615060B36471E7 +:1001800037953C3F98F526272150379520B32471A9 +:100190003C3F90F56227615037953C3F60B36471F6 +:1001A000A0F52627215037953C3FC8F520B3247190 +:1001B0006227615037953C3FB0F50A9560B37AF0FD +:1001C00064712627215037953C3F88F520B3247170 +:1001D0006227615037953C3F10F22DC031C052C0AC +:1001E000612720B324713F774160C6CF3F774260DB +:1001F00060B364712127C7CF3F774460612720B384 +:100200002471622761503795C8CF3F774860212716 +:10021000316060B36471262721503795C6CF3F7790 +:1002200040616127C1CF3F7740622127C4CF3F772C +:1002300040646127C9CF3F774068212700C08FCF36 +:1002400030E43ABF0B500195C01BD040288121FDFE +:100250002DC019811F7740918D00141799F429360C +:1002600091F4009166000023F1F040917500442361 +:10027000D1F4409366004091720040938D00C7E630 +:10028000D0E02BC02227209360006F914F913F91C7 +:100290000AB706FD45CF0F910FBFCF91DF912F9188 +:1002A0001F910F911895C3E7D0E016C0217059F344 +:1002B00020916000222339F340917500442399F77F +:1002C0000093750020937400009176004BE0401B72 +:1002D00040937600C5E6D0E001E022B32B7E20619A +:1002E00011B3146122BB11BB14E130E830FF2127A8 +:1002F00022BB379547954C3FC0F530FF21273795F6 +:1003000022BB47954C3FA8F530FF212737950000C9 +:1003100022BB47954C3F78F530FF212737950000E9 +:1003200022BB47954C3F48F530FF2127699122BBFE +:10033000379547954C3F18F530FF2127379522BB5D +:1003400047954C3F00F530FF21273795479522BB55 +:100350004C3FD8F430FF21273795362F479522BBE5 +:100360004C3FA8F40A9512F614C02127442722BB5B +:10037000C2CF2127C5CF2127CBCF2127D1CF2127FE +:10038000442722BBD7CF2127DACF2127DFCF212750 +:10039000E5CF2B7E22BB6F914F913F9100E40ABFC6 +:1003A000DF91CF9111B3022F206122BB1B7EDFBFF3 +:1003B000DF912F91000011BB02BB1F910F91189587 +:1003C00085B7836085BF8BB780648BBF8D9A939A06 +:1003D0008B9A82ED809365008AE580937300789410 +:1003E00008951F93CF93DF9380917500882309F4BC +:1003F00072C08091760091E09093640090917400B7 +:100400009D3209F05EC0CCE0D0E0C81BD109C958CC +:10041000DF4F1E818F8181111FEF8881807689F5E2 +:100420008981811104C01882198282E042C085301E +:1004300029F48A8180937200959A3AC08630B9F483 +:1004400082E0809364008B818130F1F0823001F191 +:10045000833071F58A818823F9F0813009F1823087 +:1004600019F1833029F58AE0CEE5D0E022C088304A +:1004700019F481E088831DC08A30D1F4188281E0AC +:1004800018C0CE0181D015C082E1C8E4D0E011C00F +:1004900082E1C6E3D0E00DC084E0CAE5D0E009C047 +:1004A00080E2CAE8D0E005C082E2C8E6D0E001C040 +:1004B00080E0181708F4812FD0936200C093610088 +:1004C00001C080E08093630083EC8093670010920A +:1004D00066001092750080916600811147C090916E +:1004E0006400992309F442C08091670028E88227BC +:1004F0008093670010916300193020F4112351F1AB +:10050000412F01C048E0E0916100F091620091301C +:1005100079F4DF0128E630E0E901CD010196FC0124 +:100520005C9159935C2F521B541760F4DC01F5CF9A +:1005300088E690E0DC0124912D9331962A2F281B28 +:100540002417C8F3F0936200E0936100141B10932A +:100550006300142F612F88E690E0B6DD83E0810F01 +:1005600080936600183011F0109264008AE084993C +:1005700007C08150E1F71092720010928D0095989B +:10058000DF91CF911F91089588E0089519DF29DF49 +:06059000FECFF894FFCF3E +:00000001FF diff --git a/Firmware/pocket-prog/template/template.py b/Firmware/pocket-prog/template/template.py new file mode 100644 index 0000000..fe5e5fd --- /dev/null +++ b/Firmware/pocket-prog/template/template.py @@ -0,0 +1,16 @@ +#!/usr/bin/python +# ====================================================================== +# template.py - USBtiny/template test program +# +# Copyright 2006-2010 Dick Streefland +# ====================================================================== + +import sys, os.path +sys.path[0] = os.path.join(sys.path[0], '../util') +import usbtiny + +vendor = 0x6666 +product = 0x0001 + +dev = usbtiny.USBtiny(vendor, product) +dev.echo_test() diff --git a/Firmware/pocket-prog/template/usbtiny.h b/Firmware/pocket-prog/template/usbtiny.h new file mode 100644 index 0000000..58e29a9 --- /dev/null +++ b/Firmware/pocket-prog/template/usbtiny.h @@ -0,0 +1,97 @@ +// ====================================================================== +// USBtiny Configuration +// +// Copyright 2006-2010 Dick Streefland +// +// This is free software, licensed under the terms of the GNU General +// Public License as published by the Free Software Foundation. +// ====================================================================== + +// The D+ and D- USB signals should be connected to two pins of the same +// I/O port. The following macros define the port letter and the input +// bit numbers: +#define USBTINY_PORT D +#define USBTINY_DPLUS 2 +#define USBTINY_DMINUS 4 + +// The D+ signal should be connected to an interrupt input to trigger an +// interrupt at the start of a packet. When you use the same pin for the +// D+ USB signal and the interrupt input, only two I/O pins are needed +// for the USB interface. The following macro defines the interrupt +// number: +#define USBTINY_INT 0 + +// Optional definition of the I/O pin to control the 1K5 pullup of the +// D- signal. This will force a reconnect after RESET. (+4 bytes) +#define USBTINY_DMINUS_PULLUP (D,3) + +// Optional definition of the I/O pin to drive the "USB OK" LED, that +// will turn on when the host has assigned a device address. (+6 bytes) +#define USBTINY_USB_OK_LED (D,5) + +// The power requirement of the USB device in mA, or 0 when the device +// is not bus powered: +#define USBTINY_MAX_POWER 50 + +// The USB vendor and device IDs. These values should be unique for +// every distinct device. You can get your own vendor ID from the USB +// Implementers Forum (www.usb.org) if you have a spare $1500 to kill. +// Alternatively, you can buy a small range of device IDs from +// www.voti.nl or www.mecanique.co.uk, or be naughty and use something +// else, like for instance vendor ID 0x6666, which is registered as +// "Prototype product Vendor ID". +#define USBTINY_VENDOR_ID 0x6666 +#define USBTINY_DEVICE_ID 0x0001 + +// The version of the device as a 16-bit number: 256*major + minor. +#define USBTINY_DEVICE_VERSION 0x107 + +// The following optional macros may be used as an identification of +// your device. Undefine them when you run out of flash space. +#define USBTINY_VENDOR_NAME "Dick Streefland" +#define USBTINY_DEVICE_NAME "USBtiny Template" +#define USBTINY_SERIAL "0001" + +// Define the device class, subclass and protocol. Device class 0xff +// is "vendor specific". +#define USBTINY_DEVICE_CLASS 0xff +#define USBTINY_DEVICE_SUBCLASS 0 +#define USBTINY_DEVICE_PROTOCOL 0 + +// Define the interface class, subclass and protocol. Interface class +// 0xff is "vendor specific". +#define USBTINY_INTERFACE_CLASS 0xff +#define USBTINY_INTERFACE_SUBCLASS 0 +#define USBTINY_INTERFACE_PROTOCOL 0 + +// Normally, usb_setup() should write the reply of up to 8 bytes into the +// packet buffer, and return the reply length. When this macro is defined +// as 1, you have the option of returning 0xff instead. In that case, the +// USB driver will call a function usb_in() to obtain the data to send +// back to the host. This can be used to generate the data on-the-fly. +// When you set this macro to 2, the transfer count is not limited to 255. +#define USBTINY_CALLBACK_IN 0 + +// When this macro is defined as 0, OUT packets are simply ignored. +// When defined as 1, the function usb_out() is called for OUT packets. +// You need this option to send data from the host to the device in +// a control transfer. +#define USBTINY_CALLBACK_OUT 0 + +// When this macro is defined as 1, an optimized CRC function is used +// that calculates the CRC about twice as fast as the standard version, +// but at the expense of 42 bytes of additional flash memory. +#define USBTINY_FAST_CRC 1 + +// Set the macro USBTINY_ENDPOINT to 1 to add an additional endpoint, +// according to the values of the three other macros. +#define USBTINY_ENDPOINT 0 +#define USBTINY_ENDPOINT_ADDRESS 0x81 // IN endpoint #1 +#define USBTINY_ENDPOINT_TYPE 0x00 // control transfer type +#define USBTINY_ENDPOINT_INTERVAL 0 // ignored + +// Set the macro USBTINY_NO_DATA to 1 to avoid using initialized data +// by USBtiny. This will slightly increase the code size, but when the +// data section is empty, the code to initialize the data section will +// be omitted from the startup code. +#define USBTINY_NO_DATA 1 diff --git a/Firmware/pocket-prog/usbtiny/common.mk b/Firmware/pocket-prog/usbtiny/common.mk index c550867..b5ebe91 100644 --- a/Firmware/pocket-prog/usbtiny/common.mk +++ b/Firmware/pocket-prog/usbtiny/common.mk @@ -7,23 +7,24 @@ # TARGET_ARCH - gcc -mmcu= option with AVR device type # OBJECTS - the objects in addition to the USBtiny objects # FLASH_CMD - command to upload main.hex to flash +# FUSES_CMD - command to program the fuse bytes # STACK - maximum stack size (optional) # FLASH - flash size (optional) # SRAM - SRAM size (optional) # SCHEM - Postscript version of the schematic to be generated # -# Copyright (C) 2006 Dick Streefland +# Copyright 2006-2010 Dick Streefland # # This is free software, licensed under the terms of the GNU General # Public License as published by the Free Software Foundation. # ====================================================================== +check = $(shell $(CC) $1 -c -xc /dev/null -o/dev/null 2>/dev/null && echo $1) + CC = avr-gcc -CFLAGS = -Os -g -Wall -I. -I$(USBTINY) -ASFLAGS = -Os -g -Wall -I. -#CFLAGS = -Os -g -Wall -I. -I$(USBTINY) -#ASFLAGS = -Os -g -Wall -I. -LDFLAGS = -g +OPTIM = -Os -ffunction-sections $(call check,-fno-split-wide-types) +CFLAGS = -g -Wall -I. -I$(USBTINY) $(OPTIM) +LDFLAGS = -g -Wl,--relax,--gc-sections MODULES = crc.o int.o usb.o $(OBJECTS) UTIL = $(USBTINY)/../util @@ -44,13 +45,17 @@ main.hex: main.elf $(UTIL)/check.py @python $(UTIL)/check.py main.elf $(STACK) $(FLASH) $(SRAM) avr-objcopy -j .text -j .data -O ihex main.elf main.hex +check: main.elf $(UTIL)/check.py + @python $(UTIL)/check.py main.elf $(STACK) $(FLASH) $(SRAM) + disasm: main.elf avr-objdump -S main.elf flash: main.hex $(FLASH_CMD) -fuse: - $(FUSE_CMD) + +fuses: + $(FUSES_CMD) crc.o: $(USBTINY)/crc.S $(USBTINY)/def.h usbtiny.h $(COMPILE.c) $(USBTINY)/crc.S diff --git a/Firmware/pocket-prog/usbtiny/crc.S b/Firmware/pocket-prog/usbtiny/crc.S index fc91e4b..a3bc0cc 100644 --- a/Firmware/pocket-prog/usbtiny/crc.S +++ b/Firmware/pocket-prog/usbtiny/crc.S @@ -1,19 +1,19 @@ ; ====================================================================== ; Calculate and append CRC ; -; The CRC is calculated 4 bits at a time, using a precomputed table of -; 16 values. Each value is 16 bits, but only the 8 significant bits are -; stored. The table should not cross a 256-byte page. The check.py script -; will check for this. +; There are two versions of the CRC16 calculation, selectable by the +; USBTINY_FAST_CRC macro. The default implementation calculates one bit +; at a time, and is compact but relatively slow. The "fast" version +; processes 4 bits at a time, and is about twice as fast, but 42 bytes +; larger. ; -; A bitwise algorithm would be a little smaller, but takes more time. -; In fact, it takes too much time for the USB controller in my laptop. -; The poll frequently is so high, that a lot of time is spent in the -; interrupt handler, sending NAK packets, leaving little time for the -; actual checksum calculation. An 8 bit algoritm would be even faster, +; The fast version calculates 4 bits at a time, using a precomputed table +; of 16 values. Each value is 16 bits, but only the 8 significant bits +; are stored. The table should not cross a 256-byte page. The check.py +; script will check for this. An 8 bit algoritm would be even faster, ; but requires a lookup table of 512 bytes. ; -; Copyright (C) 2006 Dick Streefland +; Copyright 2006-2010 Dick Streefland ; ; This is free software, licensed under the terms of the GNU General ; Public License as published by the Free Software Foundation. @@ -21,6 +21,7 @@ #include "def.h" +#if USBTINY_FAST_CRC ; ---------------------------------------------------------------------- ; void crc(unsigned char *data, unsigned char len); ; ---------------------------------------------------------------------- @@ -41,30 +42,42 @@ crc: movw XL, r24 ldi crc_h, 0xff ldi crc_l, 0xff - lsl len - breq done ldi zl, lo8(crc4tab) ldi ZH, hi8(crc4tab) + rjmp entry -next_nibble: - ; b = (len & 1 ? b >> 4 : *data++) - swap b - sbrs len, 0 +next_byte: + ; crc ^= b ld b, X+ + eor crc_l, b - ; index = (crc ^ b) & 0x0f + ; index1 = crc & 0x0f mov ZL, crc_l - eor ZL, b andi ZL, 0x0f - ; crc >>= 4 + ; tmp = crc4tab[index1] + add ZL, zl + lpm tmp, Z+ + + ; index2 = (crc >> 4) + mov ZL, crc_l + swap ZL + + ; crc >>= 8 + mov crc_l, crc_h + + ; index2 = (index2 ^ tmp) & 0xf + mov crc_h, tmp + andi tmp, 1 + eor ZL, tmp + andi ZL, 0x0f + + ; treat upper byte of CRC remainder swap crc_h - swap crc_l - andi crc_l, 0x0f mov tmp, crc_h - andi tmp, 0xf0 - or crc_l, tmp andi crc_h, 0x0f + andi tmp, 0xe0 + eor crc_l, tmp ; crc ^= crc4tab[index] add ZL, zl @@ -74,9 +87,10 @@ next_nibble: eor crc_h, tmp eor crc_l, tmp - ; next nibble +entry: + ; next byte dec len - brne next_nibble + brpl next_byte done: ; crc ^= 0xffff @@ -93,7 +107,7 @@ done: ; CRC table. As bits 1..8 are always zero, omit them. ; ---------------------------------------------------------------------- .section .progmem.crc,"a",@progbits -;;; .align 4 ; avoid crossing a page boundary +;;; .align 4 ; crude way to avoid crossing a page boundary crc4tab: .byte 0x00+0x00 .byte 0xcc+0x01 @@ -121,3 +135,49 @@ for crc in range(16): crc ^= 0xA001 # X^16 + X^15 + X^2 + 1 (reversed) print "\t.byte\t0x%02x+0x%02x" % (crc >> 8, crc & 0xff) \* ---------------------------------------------------------------------- */ +#else +; ---------------------------------------------------------------------- +; void crc(unsigned char *data, unsigned char len); +; ---------------------------------------------------------------------- +#define data r24 +#define len r22 + +#define b r18 +#define con_01 r19 +#define con_a0 r20 +#define crc_l r24 +#define crc_h r25 + + .text + .global crc + .type crc, @function +crc: + movw XL, r24 + ldi crc_h, 0xff + ldi crc_l, 0xff + tst len + breq done1 + ldi con_a0, 0xa0 + ldi con_01, 0x01 +next_byte: + ld b, X+ + eor crc_l, b + ldi b, 8 +next_bit: + lsr crc_h + ror crc_l + brcc noxor + eor crc_h, con_a0 + eor crc_l, con_01 +noxor: + dec b + brne next_bit + dec len + brne next_byte +done1: + com crc_l + com crc_h + st X+, crc_l + st X+, crc_h + ret +#endif diff --git a/Firmware/pocket-prog/usbtiny/def.h b/Firmware/pocket-prog/usbtiny/def.h index 7e1e0e5..57932d4 100644 --- a/Firmware/pocket-prog/usbtiny/def.h +++ b/Firmware/pocket-prog/usbtiny/def.h @@ -1,7 +1,7 @@ // ====================================================================== // Common definitions for the USB driver // -// Copyright (C) 2006 Dick Streefland +// Copyright 2006-2010 Dick Streefland // // This is free software, licensed under the terms of the GNU General // Public License as published by the Free Software Foundation. @@ -19,12 +19,12 @@ #define CAT3(a,b,c) CAT3EXP(a, b, c) #define CAT3EXP(a,b,c) a ## b ## c -// I/O Ports +// I/O Ports for USB #define USB_IN CAT2(PIN, USBTINY_PORT) #define USB_OUT CAT2(PORT, USBTINY_PORT) #define USB_DDR CAT2(DDR, USBTINY_PORT) -// I/O bit masks +// I/O bit masks for USB #define USB_MASK_DMINUS (1 << (USBTINY_DMINUS)) #define USB_MASK_DPLUS (1 << (USBTINY_DPLUS)) #define USB_MASK (USB_MASK_DMINUS | USB_MASK_DPLUS) @@ -36,11 +36,7 @@ # define USB_INT_CONFIG MCUCR #endif #define USB_INT_CONFIG_SET ((1 << CAT3(ISC,USBTINY_INT,1)) | (1 << CAT3(ISC,USBTINY_INT,0))) -#if defined SIG_INT0 -# define USB_INT_VECTOR CAT2(SIG_INT, USBTINY_INT) -#else -# define USB_INT_VECTOR CAT2(SIG_INTERRUPT, USBTINY_INT) -#endif +#define USB_INT_VECTOR CAT3(INT, USBTINY_INT, _vect) // Interrupt enable #if defined GIMSK @@ -59,6 +55,9 @@ # define USB_INT_PENDING GIFR #endif #define USB_INT_PENDING_BIT CAT2(INTF,USBTINY_INT) +#if defined INF0 && ! defined INTF0 +# define INTF0 INF0 // fix for incorrect definition in iotn13.h +#endif // USB PID values #define USB_PID_SETUP 0x2d @@ -72,3 +71,26 @@ // Various constants #define USB_BUFSIZE 11 // PID + data + CRC + +// Bit manipulation macros +#define BIT_CLR(reg,bit) { (reg) &= ~ _BV(bit); } +#define BIT_SET(reg,bit) { (reg) |= _BV(bit); } +#define BIT_TST(reg,bit) (((reg) & _BV(bit)) != 0) + +// I/O port manipulation macros +#define DDR_CLR(p,b) BIT_CLR(DDR ## p, b) +#define DDR_SET(p,b) BIT_SET(DDR ## p, b) +#define PORT_CLR(p,b) BIT_CLR(PORT ## p, b) +#define PORT_SET(p,b) BIT_SET(PORT ## p, b) +#define PORT_TST(p,b) BIT_TST(PORT ## p, b) +#define PIN_TST(p,b) BIT_TST(PIN ## p, b) +#define PIN_SET(p,b) BIT_SET(PIN ## p, b) + +// Macros that can be used with an argument of the form (port,bit) +#define INPUT(bit) DDR_CLR bit +#define OUTPUT(bit) DDR_SET bit +#define CLR(bit) PORT_CLR bit +#define SET(bit) PORT_SET bit +#define ISSET(bit) PORT_TST bit +#define TST(bit) PIN_TST bit +#define TOGGLE(bit) PIN_SET bit diff --git a/Firmware/pocket-prog/usbtiny/int.S b/Firmware/pocket-prog/usbtiny/int.S index e4ba1bf..5cd75ad 100644 --- a/Firmware/pocket-prog/usbtiny/int.S +++ b/Firmware/pocket-prog/usbtiny/int.S @@ -9,20 +9,26 @@ ; When a DATA0/DATA1 packet directly follows a SETUP or OUT packet, while ; this interrupt handler is not yet finished, there would be no time to ; return and take another interrupt. In that case, the second packet is -; decoded directly in the same invocation. +; decoded directly in the same invocation. A packet immediately following +; an ignored packet is also decoded directly. ; ; This code is *extremely* time critical. For instance, there is not a ; single spare cycle in the receiver loop, and only two in the transmitter ; loop. In addition, the various code paths are laid out in such a way that ; the various USB timeouts are not violated, in particular the maximum time -; between the reception of a packet and the reply, which is 6.5 bit times -; for a detachable cable (TRSPIPD1), and 7.5 bit times for a captive cable -; (TRSPIPD2). The worst-case delay here is 51 cycles, which is just below -; the 52 cycles for a detachable cable. +; between the reception of a packet and the reply, which is 7.5 bit times +; (TRSPIPD2) for a low-speed USB captive cable. The worst-case delay here +; is 51 cycles, which is well below the 60 cycles limit, and even below the +; 6.5 bit times limit for a detachable cable (TRSPIPD1). ; ; The interrupt handler must be reached within 34 cycles after D+ goes high -; for the first time, so the interrupts should not be disabled for longer -; than 34-4-2=28 cycles. +; for the first time. The interrupt response time is 4 cycles, and the RJMP +; in the vector table takes 2 cycles. Therefore, the interrupts should not +; be disabled for longer than: 34 - 4 - 2 = 28 cycles. When the I-bit is +; reenabled, a single instruction is always executed before a pending +; interrupt is served, so this instruction should be included in the +; calculation. For RETI, the next instruction can be anything, so we +; should assume the worst-case of 4 cycles. ; ; The end-of-packet (EOP) is sampled in the second bit, because the USB ; standard allows the EOP to be delayed by up to one bit. As the EOP @@ -30,7 +36,7 @@ ; ; Stack usage including the return address: 11 bytes. ; -; Copyright (C) 2006 Dick Streefland +; Copyright 2006-2010 Dick Streefland ; ; This is free software, licensed under the terms of the GNU General ; Public License as published by the Free Software Foundation. @@ -42,8 +48,8 @@ ; local data ; ---------------------------------------------------------------------- .data -tx_ack: .byte USB_PID_ACK ; ACK packet -tx_nak: .byte USB_PID_NAK ; NAK packet + .extern tx_ack ; ACK packet + .extern tx_nak ; NAK packet .lcomm token_pid, 1 ; PID of most recent token packet ; ---------------------------------------------------------------------- @@ -291,46 +297,51 @@ eop2: ; clear pending interrupt (SE0+3) ldi byte, 1< SOP <= 51 + +; ---------------------------------------------------------------------- +; exit point for ignored packets (SE0+21) ; ---------------------------------------------------------------------- ignore: - clr tmp - sts token_pid, tmp - pop even - pop fixup - pop byte - rjmp return + clr pid +ignore0: ; ---------------------------------------------------------------------- -; Handle SETUP/OUT (SE0+30) +; Handle SETUP/OUT (SE0+23) ; ---------------------------------------------------------------------- is_setup_out: sts token_pid, pid ; save PID of token packet @@ -339,10 +350,10 @@ is_setup_out: pop byte in count, USB_INT_PENDING ; next packet already started? sbrc count, USB_INT_PENDING_BIT - rjmp sync ; yes, get it right away (SE0+42) + rjmp sync ; yes, get it right away (SE0+35) ; ---------------------------------------------------------------------- -; restore registers and return from interrupt +; restore registers and return from interrupt (SE0+34) ; ---------------------------------------------------------------------- return: pop count @@ -355,27 +366,26 @@ return: reti ; ---------------------------------------------------------------------- -; Handle IN (SE0+26) +; send NAK packet (SE0+31) ; ---------------------------------------------------------------------- -is_in: - lds count, usb_tx_len - tst count ; data ready? - breq nak ; no, reply with NAK - lds tmp, usb_rx_len - tst tmp ; unprocessed input packet? - brne nak ; yes, don't send old data for new packet - sts usb_tx_len, tmp ; buffer is available again (after reti) - ldi YL, lo8(usb_tx_buf) - ldi YH, hi8(usb_tx_buf) - rjmp send_packet ; SE0+40, SE0 --> SOP <= 51 +nak: + ldi YL, lo8(tx_nak) + ldi YH, hi8(tx_nak) + rjmp send_token ; ---------------------------------------------------------------------- -; Handle DATA0/DATA1 (SE0+17) +; Handle Data and Handshake packets (SE0+14) +; ---------------------------------------------------------------------- +is_data_handshake: + andi pid, 0x01 + breq ignore0 ; ignore ACK/NAK/STALL + +; ---------------------------------------------------------------------- +; Handle DATA0/DATA1 (SE0+16) ; ---------------------------------------------------------------------- -is_data: lds pid, token_pid tst pid ; data following our SETUP/OUT - breq ignore ; no, ignore + breq ignore0 ; no, ignore lds tmp, usb_rx_len tst tmp ; buffer free? brne nak ; no, reply with NAK @@ -387,21 +397,12 @@ is_data: sts usb_rx_off, tmp ; ---------------------------------------------------------------------- -; send ACK packet (SE0+35) +; send ACK packet (SE0+34) ; ---------------------------------------------------------------------- -ack: ldi YL, lo8(tx_ack) ldi YH, hi8(tx_ack) - rjmp send_token - -; ---------------------------------------------------------------------- -; send NAK packet (SE0+36) -; ---------------------------------------------------------------------- -nak: - ldi YL, lo8(tx_nak) - ldi YH, hi8(tx_nak) send_token: - ldi count, 1 ; SE0+40, SE0 --> SOP <= 51 + ldi count, 1 ; SE0+37, SE0 --> SOP <= 48 ; ---------------------------------------------------------------------- ; acquire the bus and send a packet (11 cycles to SOP) diff --git a/Firmware/pocket-prog/usbtiny/usb.c b/Firmware/pocket-prog/usbtiny/usb.c index 58f2b0d..723fc24 100644 --- a/Firmware/pocket-prog/usbtiny/usb.c +++ b/Firmware/pocket-prog/usbtiny/usb.c @@ -17,10 +17,10 @@ // the callback functions usb_in() and usb_out() will be called for IN // and OUT transfers. // -// Maximum stack usage (gcc 3.4.3 & 4.1.0) of usb_poll(): 5 bytes plus +// Maximum stack usage (gcc 4.1.0 & 4.3.4) of usb_poll(): 5 bytes plus // possible additional stack usage in usb_setup(), usb_in() or usb_out(). // -// Copyright (C) 2006 Dick Streefland +// Copyright 2006-2010 Dick Streefland // // This is free software, licensed under the terms of the GNU General // Public License as published by the Free Software Foundation. @@ -33,6 +33,16 @@ #define LE(word) (word) & 0xff, (word) >> 8 +// ---------------------------------------------------------------------- +// typedefs +// ---------------------------------------------------------------------- + +#if USBTINY_CALLBACK_IN == 2 +typedef uint_t txlen_t; +#else +typedef byte_t txlen_t; +#endif + // ---------------------------------------------------------------------- // USB constants // ---------------------------------------------------------------------- @@ -50,6 +60,14 @@ enum // Interrupt handler interface // ---------------------------------------------------------------------- +#if USBTINY_NO_DATA +byte_t tx_ack; // ACK packet +byte_t tx_nak; // NAK packet +#else +byte_t tx_ack = USB_PID_ACK; // ACK packet +byte_t tx_nak = USB_PID_NAK; // NAK packet +#endif + byte_t usb_rx_buf[2*USB_BUFSIZE]; // two input buffers byte_t usb_rx_off; // buffer offset: 0 or USB_BUFSIZE byte_t usb_rx_len; // buffer size, 0 means empty @@ -58,7 +76,8 @@ byte_t usb_rx_token; // PID of token packet: SETUP or OUT byte_t usb_tx_buf[USB_BUFSIZE]; // output buffer byte_t usb_tx_len; // output buffer size, 0 means empty -byte_t usb_address; // assigned USB address +byte_t usb_address; // assigned device address +byte_t usb_new_address; // new device address // ---------------------------------------------------------------------- // Local data @@ -73,9 +92,8 @@ enum }; static byte_t usb_tx_state; // TX_STATE_*, see enum above -static byte_t usb_tx_total; // total transmit size +static txlen_t usb_tx_total; // total transmit size static byte_t* usb_tx_data; // pointer to data to transmit -static byte_t new_address; // new device address #if defined USBTINY_VENDOR_NAME struct @@ -83,7 +101,7 @@ struct byte_t length; byte_t type; int string[sizeof(USBTINY_VENDOR_NAME)-1]; -} string_vendor PROGMEM = +} const string_vendor PROGMEM = { 2 * sizeof(USBTINY_VENDOR_NAME), DESCRIPTOR_TYPE_STRING, @@ -100,7 +118,7 @@ struct byte_t length; byte_t type; int string[sizeof(USBTINY_DEVICE_NAME)-1]; -} string_device PROGMEM = +} const string_device PROGMEM = { 2 * sizeof(USBTINY_DEVICE_NAME), DESCRIPTOR_TYPE_STRING, @@ -117,7 +135,7 @@ struct byte_t length; byte_t type; int string[sizeof(USBTINY_SERIAL)-1]; -} string_serial PROGMEM = +} const string_serial PROGMEM = { 2 * sizeof(USBTINY_SERIAL), DESCRIPTOR_TYPE_STRING, @@ -129,7 +147,7 @@ struct #endif #if VENDOR_NAME_ID || DEVICE_NAME_ID || SERIAL_ID -static byte_t string_langid [] PROGMEM = +static byte_t const string_langid [] PROGMEM = { 4, // bLength DESCRIPTOR_TYPE_STRING, // bDescriptorType (string) @@ -138,7 +156,7 @@ static byte_t string_langid [] PROGMEM = #endif // Device Descriptor -static byte_t descr_device [18] PROGMEM = +static byte_t const descr_device [18] PROGMEM = { 18, // bLength DESCRIPTOR_TYPE_DEVICE, // bDescriptorType @@ -157,7 +175,7 @@ static byte_t descr_device [18] PROGMEM = }; // Configuration Descriptor -static byte_t descr_config [] PROGMEM = +static byte_t const descr_config [] PROGMEM = { 9, // bLength DESCRIPTOR_TYPE_CONFIGURATION, // bDescriptorType @@ -197,17 +215,22 @@ static void usb_receive ( byte_t* data, byte_t rx_len ) { byte_t len; byte_t type; - byte_t limit; + txlen_t limit; usb_tx_state = TX_STATE_RAM; len = 0; + limit = 0; if ( usb_rx_token == USB_PID_SETUP ) { +#if USBTINY_CALLBACK_IN == 2 + limit = * (uint_t*) & data[6]; +#else limit = data[6]; if ( data[7] ) { limit = 255; } +#endif type = data[0] & 0x60; if ( type == 0x00 ) { // Standard request @@ -223,7 +246,10 @@ static void usb_receive ( byte_t* data, byte_t rx_len ) } else if ( data[1] == 5 ) // SET_ADDRESS { - new_address = data[2]; + usb_new_address = data[2]; +#ifdef USBTINY_USB_OK_LED + SET(USBTINY_USB_OK_LED);// LED on +#endif } else if ( data[1] == 6 ) // GET_DESCRIPTOR { @@ -237,9 +263,6 @@ static void usb_receive ( byte_t* data, byte_t rx_len ) { // CONFIGURATION data = (byte_t*) &descr_config; len = sizeof(descr_config); - // If we got this far, there's a good chance everything is OK with enumeration so turn on the OK led - PORTD |= _BV(5); - } #if VENDOR_NAME_ID || DEVICE_NAME_ID || SERIAL_ID else if ( data[3] == 3 ) @@ -294,9 +317,13 @@ static void usb_receive ( byte_t* data, byte_t rx_len ) } #endif } - if ( len > limit ) + if ( len < limit +#if USBTINY_CALLBACK_IN == 2 + && len != 0xff +#endif + ) { - len = limit; + limit = len; } usb_tx_data = data; } @@ -306,7 +333,7 @@ static void usb_receive ( byte_t* data, byte_t rx_len ) usb_out( data, rx_len ); } #endif - usb_tx_total = len; + usb_tx_total = limit; usb_tx_buf[0] = USB_PID_DATA0; // next data packet will be DATA1 } @@ -322,11 +349,14 @@ static void usb_transmit ( void ) byte_t b; usb_tx_buf[0] ^= (USB_PID_DATA0 ^ USB_PID_DATA1); - len = usb_tx_total; - if ( len > 8 ) + if ( usb_tx_total > 8 ) { len = 8; } + else + { + len = (byte_t) usb_tx_total; + } dst = usb_tx_buf + 1; if ( len > 0 ) { @@ -374,6 +404,17 @@ extern void usb_init ( void ) { USB_INT_CONFIG |= USB_INT_CONFIG_SET; USB_INT_ENABLE |= (1 << USB_INT_ENABLE_BIT); +#ifdef USBTINY_USB_OK_LED + OUTPUT(USBTINY_USB_OK_LED); +#endif +#ifdef USBTINY_DMINUS_PULLUP + SET(USBTINY_DMINUS_PULLUP); + OUTPUT(USBTINY_DMINUS_PULLUP); // enable pullup on D- +#endif +#if USBTINY_NO_DATA + tx_ack = USB_PID_ACK; + tx_nak = USB_PID_NAK; +#endif sei(); } @@ -395,16 +436,9 @@ extern void usb_poll ( void ) usb_rx_len = 0; // accept next packet } // refill an empty transmit buffer, when the transmitter is active - if ( usb_tx_len == 0 ) + if ( usb_tx_len == 0 && usb_tx_state != TX_STATE_IDLE ) { - if ( usb_tx_state != TX_STATE_IDLE ) - { - usb_transmit(); - } - else - { // change the USB address at the end of a transfer - usb_address = new_address; - } + usb_transmit(); } // check for USB bus reset for ( i = 10; i > 0 && ! (USB_IN & USB_MASK_DMINUS); i-- ) @@ -412,6 +446,10 @@ extern void usb_poll ( void ) } if ( i == 0 ) { // SE0 for more than 2.5uS is a reset - new_address = 0; + usb_new_address = 0; + usb_address = 0; +#ifdef USBTINY_USB_OK_LED + CLR(USBTINY_USB_OK_LED); // LED off +#endif } } diff --git a/Firmware/pocket-prog/usbtiny/usb.h b/Firmware/pocket-prog/usbtiny/usb.h index ebd74f3..4121eec 100644 --- a/Firmware/pocket-prog/usbtiny/usb.h +++ b/Firmware/pocket-prog/usbtiny/usb.h @@ -1,7 +1,7 @@ // ====================================================================== // Public interface of the USB driver // -// Copyright (C) 2006 Dick Streefland +// 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. diff --git a/Firmware/pocket-prog/usbtinyisp/Makefile b/Firmware/pocket-prog/usbtinyisp/Makefile new file mode 100644 index 0000000..fe376d8 --- /dev/null +++ b/Firmware/pocket-prog/usbtinyisp/Makefile @@ -0,0 +1,20 @@ +# ====================================================================== +# Makefile for USBtinyISP AVR programmer +# +# Copyright 2006-2010 Dick Streefland +# +# This is free software, licensed under the terms of the GNU General +# Public License as published by the Free Software Foundation. +# ====================================================================== + +USBTINY = ../usbtiny +TARGET_ARCH = -mmcu=attiny2313 +OBJECTS = main.o +FLASH_CMD = avrdude -pt2313 -U flash:w:main.hex +FUSES_CMD = avrdude -pt2313 -U hfuse:w:0xdf:m -U lfuse:w:0xef:m +STACK = 32 +FLASH = 2048 +SRAM = 128 +SCHEM = + +include $(USBTINY)/common.mk diff --git a/Firmware/pocket-prog/usbtinyisp/main.c b/Firmware/pocket-prog/usbtinyisp/main.c new file mode 100644 index 0000000..1b687b8 --- /dev/null +++ b/Firmware/pocket-prog/usbtinyisp/main.c @@ -0,0 +1,305 @@ +// ====================================================================== +// USB AVR programmer and SPI interface +// +// http://www.ladyada.net/make/usbtinyisp/ +// +// This code works for both v1.0 and v2.0 devices. +// +// Copyright 2006-2010 Dick Streefland +// +// This is free software, licensed under the terms of the GNU General +// Public License as published by the Free Software Foundation. +// ====================================================================== + +#include +#include "def.h" +#include "usb.h" + +enum +{ + // Generic requests + USBTINY_ECHO, // echo test + USBTINY_READ, // read byte + USBTINY_WRITE, // write byte + USBTINY_CLR, // clear bit + USBTINY_SET, // set bit + // 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) + USBTINY_DDRWRITE, // set port direction + USBTINY_SPI1 // a single SPI command +}; + +// ---------------------------------------------------------------------- +// I/O pins: +// ---------------------------------------------------------------------- +#define PORT PORTB +#define DDR DDRB +#define PIN PINB + +#define LED PB0 // output +#define RESET PB4 // output +#define MOSI PB5 // output +#define MISO PB6 // input +#define SCK PB7 // output + +#define LED_MASK _BV(LED) +#define RESET_MASK _BV(RESET) +#define MOSI_MASK _BV(MOSI) +#define MISO_MASK _BV(MISO) +#define SCK_MASK _BV(SCK) + +#define BUFFEN (D,4) // output, active low + +// ---------------------------------------------------------------------- +// Local data +// ---------------------------------------------------------------------- +static byte_t sck_period; // SCK period in microseconds (1..250) +static byte_t poll1; // first poll byte for write +static byte_t poll2; // second poll byte for write +static uint_t address; // read/write address +static uint_t timeout; // write timeout in usec +static byte_t cmd0; // current read/write command byte +static byte_t cmd[4]; // SPI command buffer +static byte_t res[4]; // SPI result buffer + +// ---------------------------------------------------------------------- +// Delay exactly times 0.5 microseconds (6 cycles). +// ---------------------------------------------------------------------- +__attribute__((always_inline)) +static inline void delay ( void ) +{ + asm volatile( + " mov __tmp_reg__,%0 \n" + "0: rjmp 1f \n" + "1: nop \n" + " dec __tmp_reg__ \n" + " brne 0b \n" + : : "r" (sck_period) ); +} + +// ---------------------------------------------------------------------- +// Issue one SPI command. +// ---------------------------------------------------------------------- +static void spi ( byte_t* cmd, byte_t* res, byte_t n ) +{ + byte_t c; + byte_t r; + byte_t mask; + + while ( n != 0 ) + { + n--; + c = *cmd++; + r = 0; + for ( mask = 0x80; mask; mask >>= 1 ) + { + if ( c & mask ) + { + PORT |= MOSI_MASK; + } + delay(); + PORT |= SCK_MASK; + delay(); + r <<= 1; + if ( PIN & MISO_MASK ) + { + r++; + } + PORT &= ~ MOSI_MASK; + PORT &= ~ SCK_MASK; + } + *res++ = r; + } +} + +// ---------------------------------------------------------------------- +// Create and issue a read or write SPI command. +// ---------------------------------------------------------------------- +static void spi_rw ( void ) +{ + uint_t a; + + a = address++; + if ( cmd0 & 0x80 ) + { // eeprom + a <<= 1; + } + cmd[0] = cmd0; + if ( a & 1 ) + { + cmd[0] |= 0x08; + } + cmd[1] = a >> 9; + cmd[2] = a >> 1; + spi( cmd, res, 4 ); +} + +// ---------------------------------------------------------------------- +// Handle a non-standard SETUP packet. +// ---------------------------------------------------------------------- +extern byte_t usb_setup ( byte_t data[8] ) +{ + byte_t bit; + byte_t mask; + byte_t req; + + // Generic requests + req = data[1]; + if ( req == USBTINY_ECHO ) + { + return 8; + } + if ( req == USBTINY_READ ) + { + data[0] = PIN; + return 1; + } + if ( req == USBTINY_WRITE ) + { + PORT = data[2]; + return 0; + } + bit = data[2] & 7; + mask = 1 << bit; + if ( req == USBTINY_CLR ) + { + PORT &= ~ mask; + return 0; + } + if ( req == USBTINY_SET ) + { + PORT |= mask; + return 0; + } + if ( req == USBTINY_DDRWRITE ) + { + DDR = data[2]; + } + + // Programming requests + if ( req == USBTINY_POWERUP ) + { + sck_period = data[2]; + mask = LED_MASK; + if ( data[4] ) + { + mask |= RESET_MASK; + } + CLR(BUFFEN); + DDR = LED_MASK | RESET_MASK | SCK_MASK | MOSI_MASK; + PORT = mask; + return 0; + } + if ( req == USBTINY_POWERDOWN ) + { + DDR = 0x00; + PORT = 0x00; + SET(BUFFEN); + return 0; + } + if ( ! PORT ) + { + return 0; + } + if ( req == USBTINY_SPI ) + { + spi( data + 2, data + 0, 4 ); + return 4; + } + if ( req == USBTINY_SPI1 ) + { + spi( data + 2, data + 0, 1 ); + return 1; + } + if ( req == USBTINY_POLL_BYTES ) + { + poll1 = data[2]; + poll2 = data[3]; + return 0; + } + address = * (uint_t*) & data[4]; + if ( req == USBTINY_FLASH_READ ) + { + cmd0 = 0x20; + return 0xff; // usb_in() will be called to get the data + } + if ( req == USBTINY_EEPROM_READ ) + { + cmd0 = 0xa0; + return 0xff; // usb_in() will be called to get the data + } + timeout = * (uint_t*) & data[2]; + if ( req == USBTINY_FLASH_WRITE ) + { + cmd0 = 0x40; + return 0; // data will be received by usb_out() + } + if ( req == USBTINY_EEPROM_WRITE ) + { + cmd0 = 0xc0; + return 0; // data will be received by usb_out() + } + return 0; +} + +// ---------------------------------------------------------------------- +// Handle an IN packet. +// ---------------------------------------------------------------------- +extern byte_t usb_in ( byte_t* data, byte_t len ) +{ + byte_t i; + + for ( i = 0; i < len; i++ ) + { + spi_rw(); + data[i] = res[3]; + } + return len; +} + +// ---------------------------------------------------------------------- +// Handle an OUT packet. +// ---------------------------------------------------------------------- +extern void usb_out ( byte_t* data, byte_t len ) +{ + byte_t i; + uint_t usec; + byte_t r; + + for ( i = 0; i < len; i++ ) + { + cmd[3] = data[i]; + spi_rw(); + cmd[0] ^= 0x60; // turn write into read + for ( usec = 0; usec < timeout; usec += 32 * sck_period ) + { // when timeout > 0, poll until byte is written + spi( cmd, res, 4 ); + r = res[3]; + if ( r == cmd[3] && r != poll1 && r != poll2 ) + { + break; + } + } + } +} + +// ---------------------------------------------------------------------- +// Main +// ---------------------------------------------------------------------- +extern int main ( void ) +{ + SET(BUFFEN); + OUTPUT(BUFFEN); + usb_init(); + for ( ;; ) + { + usb_poll(); + } +} diff --git a/Firmware/pocket-prog/usbtinyisp/main.hex b/Firmware/pocket-prog/usbtinyisp/main.hex new file mode 100644 index 0000000..3902c9b --- /dev/null +++ b/Firmware/pocket-prog/usbtinyisp/main.hex @@ -0,0 +1,128 @@ +:1000000039C06CC045C044C043C042C041C040C0BC +:100010003FC03EC03DC03CC03BC03AC039C038C004 +:1000200037C036C035C000CDD914F13C28E5A16CED +:1000300078B5509D894409021200010100803209FF +:1000400004000000FF00000012010101FF00000891 +:1000500081179F0C07010002000104030904160325 +:10006000550053004200740069006E007900490099 +:100070005300500011241FBECFEDCDBF10E0A0E60D +:10008000B0E001C01D92AE39B107E1F7A4D3A8C317 +:10009000B7CFDC019FEF8FEF46E2F0E018C02D9163 +:1000A0008227E82FEF70E40F3591E82FE295892F32 +:1000B000932F3170E327EF709295392F9F70307E28 +:1000C0008327E40F359193273170932783276A950F +:1000D00032F7809590958D939D9308950F931F937C +:1000E0002F93DF93CF930FB70F938299FECF82990F +:1000F0000BC0829909C0829907C0829905C0829974 +:1001000003C000E40ABFACC0C0918600DD27C95718 +:10011000DF4F0BE01CE024E0829BE9CF3F934F933D +:100120006F9360B330E803C060B3432B4993442717 +:100130006C702627215020B32C70A9F137953C3FD5 +:10014000A0F56227615060B36C7037953C3F98F51D +:1001500026272150379520B32C703C3F90F562271D +:10016000615037953C3F60B36C70A0F52627215055 +:1001700037953C3FC8F520B32C7062276150379506 +:100180003C3FB0F50A9560B37AF06C702627215099 +:1001900037953C3F88F520B32C7062276150379526 +:1001A0003C3F10F22DC031C052C0612720B32C70EB +:1001B0003F774160C6CF3F77426060B36C702127C4 +:1001C000C7CF3F774460612720B32C70622761500E +:1001D0003795C8CF3F7748602127316060B36C7096 +:1001E000262721503795C6CF3F7740616127C1CF81 +:1001F0003F7740622127C4CF3F7740646127C9CF52 +:100200003F774068212700C08FCF30E43ABF0B50C2 +:100210000195C01BD040288121FD2DC019811F7779 +:1002200040919D00141799F4293691F400917600BD +:100230000023F1F0409185004423D1F440937600EF +:100240004091820040939D00C7E7D0E02BC0222759 +:10025000209360006F914F913F910AB706FD45CF03 +:100260000F910FBFCF91DF912F911F910F91189593 +:10027000C3E8D0E016C0217059F32091600022231A +:1002800039F340918500442399F70093850020932A +:100290008400009186004BE0401B40938600C5E738 +:1002A000D0E001E022B3237F286011B31C6022BBA1 +:1002B00011BB1CE030E830FF212722BB3795479562 +:1002C0004C3FC0F530FF2127379522BB47954C3F67 +:1002D000A8F530FF21273795000022BB47954C3FFA +:1002E00078F530FF21273795000022BB47954C3F1A +:1002F00048F530FF2127699122BB379547954C3F40 +:1003000018F530FF2127379522BB47954C3F00F564 +:1003100030FF21273795479522BB4C3FD8F430FF5B +:1003200021273795362F479522BB4C3FA8F40A95D5 +:1003300012F614C02127442722BBC2CF2127C5CFE4 +:100340002127CBCF2127D1CF2127442722BBD7CFAD +:100350002127DACF2127DFCF2127E5CF237F22BB3B +:100360006F914F913F9100E40ABFDF91CF9111B39C +:10037000022F286022BB137FDFBFDF912F91000087 +:1003800011BB02BB1F910F91189585B7836085BF84 +:100390008BB780648BBF8D9A969A8E9A82ED8093EC +:1003A00075008AE580938300789408951F93CF9316 +:1003B000DF9360918500662309F46FC08091860009 +:1003C000CCE0D0E0C81BD109C957DF4F81E0809352 +:1003D0006400809184008D3209F051C01E818F81AC +:1003E00081111FEF8881807669F58981811104C0B0 +:1003F0001882198282E03BC0853029F48A8180937B +:100400008200959A33C0863099F482E0809364002C +:100410008B818130F9F0823009F1833039F58A819E +:10042000882301F1823011F586E1CEE5D0E01FC0CE +:10043000883019F481E088831AC08A30B9F41882B0 +:1004400081E015C0CE01DCD08F3F89F483E080933A +:1004500064000FC082E1C8E4D0E009C082E1C6E3D5 +:10046000D0E005C084E0CAE5D0E001C080E081179B +:1004700008F0812FD0936200C093610005C06350E3 +:1004800011F0CE015DD180E08093630083EC809316 +:10049000770010927600109285008091760081118D +:1004A00050C080916400882309F44BC0909177007C +:1004B00028E892279093770010916300193018F480 +:1004C000112399F101C018E0833031F4612F88E7DE +:1004D00090E015D1182F24C0E0916100F0916200E6 +:1004E000813081F4DF0148E750E0EA019D012F5F90 +:1004F0003F4FF9018C9189938C2F841B811760F4F5 +:10050000D901F4CF28E730E0D90184918D93319659 +:100510008A2F821B8117C8F3F0936200E093610079 +:1005200080916300811B80936300612F88E790E0D6 +:10053000B0DD83E0810F80937600183010F41092C4 +:1005400064008AE0839907C08150E1F7109282002D +:1005500010929D009598DF91CF911F910895FB0116 +:10056000442341F14150DC017D91CD0128E030E090 +:1005700060E850E0A62FA72309F0C59AA091740067 +:100580000A2E00C000000A94E1F7C79AA0917400F7 +:100590000A2E00C000000A94E1F7550FB6995F5F7C +:1005A000C598C7986695215031092115310511F775 +:1005B0005193D6CF089580917000909171009C0165 +:1005C0002F5F3F4F309371002093700020916D009A +:1005D00027FF02C0880F991F80FD286020936900C3 +:1005E0009C01232F3327269520936A0096958795A3 +:1005F00080936B0044E065E670E089E690E0AFCF61 +:10060000FC012181222309F478C0213019F486B33A +:10061000808346C03281223011F438BB6CC0432F36 +:10062000477081E090E0042E01C0880F0A94EAF739 +:10063000233021F498B38095892317C0243021F406 +:1006400098B3982B98BB57C02D3011F437BB15C009 +:10065000253069F4309374008481811102C081E0F7 +:1006600001C081E1949891EB97BB88BB44C02630D0 +:1006700021F417BA18BA949A3EC088B38823D9F1E6 +:10068000273039F444E0BF01CF01029668DF84E0EF +:1006900008952E3039F441E0BF01CF0102965FDFAB +:1006A00081E00895283039F482818093730083813A +:1006B0008093720020C08481958190937100809313 +:1006C0007000293011F480E203C02B3029F480EA55 +:1006D00080936D008FEF08958281938190936F00D6 +:1006E00080936E002A3011F480E403C02C3019F49A +:1006F00080EC80936D0080E0089588E00895EF928B +:10070000FF920F931F93CF93DF931F92CDB7DD27F7 +:100710008C01862F78019E2D901B981748F48983B1 +:100720004ADF90916800F70191937F018981F3CFAF +:100730000F90DF91CF911F910F91FF90EF9008954F +:10074000CF92DF92EF92FF920F931F93CF93DF939D +:100750007C01D62EEC01E0E6CE2E8C2F8E198D1565 +:1007600088F5899180936C0026DF809169008C2543 +:100770008093690000E010E080916E0090916F001E +:100780000817190750F744E065E670E089E690E045 +:10079000E6DE8091680090916C00891308C090910A +:1007A0007300891721F0909172008913D6CF2091A0 +:1007B000740030E075E0220F331F7A95E1F7020FE5 +:1007C000131FDACFDF91CF911F910F91FF90EF9020 +:1007D000DF90CF900895949A8C9AD7DDE7DDFECF15 +:0407E000F894FFCFBB +:00000001FF diff --git a/Firmware/pocket-prog/usbtinyisp/usbtiny.h b/Firmware/pocket-prog/usbtinyisp/usbtiny.h new file mode 100644 index 0000000..693d0ba --- /dev/null +++ b/Firmware/pocket-prog/usbtinyisp/usbtiny.h @@ -0,0 +1,100 @@ +// ====================================================================== +// USBtiny Configuration +// +// Copyright 2006-2010 Dick Streefland +// +// This is free software, licensed under the terms of the GNU General +// Public License as published by the Free Software Foundation. +// ====================================================================== + +// The D+ and D- USB signals should be connected to two pins of the same +// I/O port. The following macros define the port letter and the input +// bit numbers: +#define USBTINY_PORT D +#define USBTINY_DPLUS 2 +#define USBTINY_DMINUS 3 + +// The D+ signal should be connected to an interrupt input to trigger an +// interrupt at the start of a packet. When you use the same pin for the +// D+ USB signal and the interrupt input, only two I/O pins are needed +// for the USB interface. The following macro defines the interrupt +// number: +#define USBTINY_INT 0 + +// Optional definition of the I/O pin to control the 1K5 pullup of the +// D- signal. This will force a reconnect after RESET. (+4 bytes) +#define USBTINY_DMINUS_PULLUP (D,6) + +// Optional definition of the I/O pin to drive the "USB OK" LED, that +// will turn on when the host has assigned a device address. (+6 bytes) +#define USBTINY_USB_OK_LED (D,5) + +// The power requirement of the USB device in mA, or 0 when the device +// is not bus powered: +#define USBTINY_MAX_POWER 100 + +// The USB vendor and device IDs. These values should be unique for +// every distinct device. You can get your own vendor ID from the USB +// Implementers Forum (www.usb.org) if you have a spare $1500 to kill. +// Alternatively, you can buy a small range of device IDs from +// www.voti.nl or www.mecanique.co.uk, or be naughty and use something +// else, like for instance vendor ID 0x6666, which is registered as +// "Prototype product Vendor ID". +// The USBtinyISP project (http://www.ladyada.net/make/usbtinyisp/) has +// allocated an official VID/PID pair for USBtiny. Since these IDs are +// supported by avrdude since version 5.5, we use them here as well: +#define USBTINY_VENDOR_ID 0x1781 // USBtinyISP +#define USBTINY_DEVICE_ID 0x0C9F // USBtinyISP + +// The version of the device as a 16-bit number: 256*major + minor. +#define USBTINY_DEVICE_VERSION 0x107 + +// The following optional macros may be used as an identification of +// your device. Undefine them when you run out of flash space. +//#define USBTINY_VENDOR_NAME "Dick Streefland" +#define USBTINY_DEVICE_NAME "USBtinyISP" +#undef USBTINY_SERIAL + +// Define the device class, subclass and protocol. Device class 0xff +// is "vendor specific". +#define USBTINY_DEVICE_CLASS 0xff +#define USBTINY_DEVICE_SUBCLASS 0 +#define USBTINY_DEVICE_PROTOCOL 0 + +// Define the interface class, subclass and protocol. Interface class +// 0xff is "vendor specific". +#define USBTINY_INTERFACE_CLASS 0xff +#define USBTINY_INTERFACE_SUBCLASS 0 +#define USBTINY_INTERFACE_PROTOCOL 0 + +// Normally, usb_setup() should write the reply of up to 8 bytes into the +// packet buffer, and return the reply length. When this macro is defined +// as 1, you have the option of returning 0xff instead. In that case, the +// USB driver will call a function usb_in() to obtain the data to send +// back to the host. This can be used to generate the data on-the-fly. +// When you set this macro to 2, the transfer count is not limited to 255. +#define USBTINY_CALLBACK_IN 1 + +// When this macro is defined as 0, OUT packets are simply ignored. +// When defined as 1, the function usb_out() is called for OUT packets. +// You need this option to send data from the host to the device in +// a control transfer. +#define USBTINY_CALLBACK_OUT 1 + +// When this macro is defined as 1, an optimized CRC function is used +// that calculates the CRC about twice as fast as the standard version, +// but at the expense of 42 bytes of additional flash memory. +#define USBTINY_FAST_CRC 1 + +// Set the macro USBTINY_ENDPOINT to 1 to add an additional endpoint, +// according to the values of the three other macros. +#define USBTINY_ENDPOINT 0 +#define USBTINY_ENDPOINT_ADDRESS 0x81 // IN endpoint #1 +#define USBTINY_ENDPOINT_TYPE 0x00 // control transfer type +#define USBTINY_ENDPOINT_INTERVAL 0 // ignored + +// Set the macro USBTINY_NO_DATA to 1 to avoid using initialized data +// by USBtiny. This will slightly increase the code size, but when the +// data section is empty, the code to initialize the data section will +// be omitted from the startup code. +#define USBTINY_NO_DATA 1 diff --git a/Firmware/pocket-prog/util/Makefile b/Firmware/pocket-prog/util/Makefile index 1ed091b..20122ba 100644 --- a/Firmware/pocket-prog/util/Makefile +++ b/Firmware/pocket-prog/util/Makefile @@ -1,7 +1,7 @@ # ====================================================================== # Build a Python wrapper for libusb. # -# Copyright (C) 2006 Dick Streefland +# Copyright 2006-2010 Dick Streefland # # This is free software, licensed under the terms of the GNU General # Public License as published by the Free Software Foundation. @@ -19,5 +19,5 @@ clobber: clean _libusb.so: libusb.i swig -python -D'__attribute__(x)=' -w302,454 -I/usr/include $< - gcc -s -shared -I$(PYTHONINC) -o _libusb.so libusb_wrap.c -lusb + gcc -s -shared -fPIC -I$(PYTHONINC) -o _libusb.so libusb_wrap.c -lusb @rm -f libusb_wrap.c diff --git a/Firmware/pocket-prog/util/_libusb.so b/Firmware/pocket-prog/util/_libusb.so index 95f69ea..5758225 100644 Binary files a/Firmware/pocket-prog/util/_libusb.so and b/Firmware/pocket-prog/util/_libusb.so differ diff --git a/Firmware/pocket-prog/util/check.py b/Firmware/pocket-prog/util/check.py index 38f59a7..e24948d 100644 --- a/Firmware/pocket-prog/util/check.py +++ b/Firmware/pocket-prog/util/check.py @@ -2,7 +2,7 @@ # ====================================================================== # check.py - Check section sizes and other constraints # -# Copyright (C) 2006 Dick Streefland +# Copyright 2006-2010 Dick Streefland # # This is free software, licensed under the terms of the GNU General # Public License as published by the Free Software Foundation. @@ -23,6 +23,10 @@ max_sram = ramsize - stacksize +crc4tab = 0 +text = 0 +data = 0 +bss = 0 for line in os.popen('avr-objdump -ht ' + sys.argv[1]).readlines(): a = line.split() if len(a) == 7: @@ -32,11 +36,14 @@ data = int(a[2], 16) if a[1] == '.bss': bss = int(a[2], 16) - if len(a) == 5 and a[4] == 'crc4tab': + if len(a) >= 5 and a[-1] == 'crc4tab': crc4tab = int(a[0], 16) print 'text: %d, data: %d, bss: %d' % (text, data, bss) status = 0 +if text == 0: + print 'ERROR: No code! Upgrade your binutils package or remove --gc-sections' + status = 1 overflow = text + data - flashsize if overflow > 0: print 'ERROR: Flash size limit exceeded by %d bytes.' % overflow diff --git a/Firmware/pocket-prog/util/crc16.py b/Firmware/pocket-prog/util/crc16.py index 1a967cc..49d4b5a 100644 --- a/Firmware/pocket-prog/util/crc16.py +++ b/Firmware/pocket-prog/util/crc16.py @@ -2,7 +2,7 @@ # ====================================================================== # crc16.py - Prototype implementations of CRC16 calculation # -# Copyright (C) 2006 Dick Streefland +# Copyright 2006-2010 Dick Streefland # # This is free software, licensed under the terms of the GNU General # Public License as published by the Free Software Foundation. @@ -12,9 +12,10 @@ polynomial = 0xA001 # X^16 + X^15 + X^2 + 1 - lower 16 bits, reversed -def crc_update(crc, value, bits): +def crc_update(crc, byte, bits): + crc ^= byte for bit in range(bits): - xor = (crc ^ (value >> bit)) & 1 + xor = crc & 1 crc >>= 1 if xor: crc ^= polynomial @@ -24,8 +25,28 @@ def crc1(crc, byte): return crc_update(crc, byte, 8) def crc4(crc, byte): - crc = (crc >> 4) ^ tab4[(crc ^ byte) & 0xf] - crc = (crc >> 4) ^ tab4[(crc ^ (byte >> 4)) & 0xf] + crc ^= byte + crc = (crc >> 4) ^ tab4[crc & 0xf] + crc = (crc >> 4) ^ tab4[crc & 0xf] + return crc + +def crc4a(crc, byte): + crc ^= byte + index1 = crc & 0xf + crc ^= tab4[index1] << 4 + index2 = (crc >> 4) & 0xf + crc >>= 8 + crc ^= tab4[index2] + return crc + +def crc4b(crc, byte): + crc ^= byte + index1 = crc & 0xf + tmp = tab4[index1] + index2 = ((crc >> 4) ^ tmp) & 0xf + crc >>= 8 + crc ^= tmp >> 4 + crc ^= tab4[index2] return crc def crc8(crc, byte): @@ -43,4 +64,6 @@ def crc_file(file, crcfunc): for file in sys.argv[1:]: crc_file(file, crc1) crc_file(file, crc4) + crc_file(file, crc4a) + crc_file(file, crc4b) crc_file(file, crc8) diff --git a/Firmware/pocket-prog/util/libusb.i b/Firmware/pocket-prog/util/libusb.i index 137e55c..711262d 100644 --- a/Firmware/pocket-prog/util/libusb.i +++ b/Firmware/pocket-prog/util/libusb.i @@ -1,7 +1,7 @@ // ====================================================================== // SWIG interface description for libusb // -// Copyright (C) 2006 Dick Streefland +// 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. @@ -82,7 +82,9 @@ static int usb_control_out ( usb_dev_handle *dev, int requesttype, %cstring_bounded_output( char* strbuf, 255 ); static void usb_string ( usb_dev_handle* dev, int index, char* strbuf ); +typedef unsigned short uint16_t; typedef unsigned short u_int16_t; +typedef unsigned char uint8_t; typedef unsigned char u_int8_t; %include usb.h diff --git a/Firmware/pocket-prog/util/libusb.py b/Firmware/pocket-prog/util/libusb.py index 2ab3eb9..a9e87d6 100644 --- a/Firmware/pocket-prog/util/libusb.py +++ b/Firmware/pocket-prog/util/libusb.py @@ -1,19 +1,48 @@ -# This file was created automatically by SWIG 1.3.28. -# Don't modify this file, modify the SWIG interface instead. -# This file is compatible with both classic and new-style classes. - -import _libusb -import new -new_instancemethod = new.instancemethod +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 2.0.11 +# +# Do not make changes to this file unless you know what you are doing--modify +# the SWIG interface file instead. + + + + + +from sys import version_info +if version_info >= (2,6,0): + def swig_import_helper(): + from os.path import dirname + import imp + fp = None + try: + fp, pathname, description = imp.find_module('_libusb', [dirname(__file__)]) + except ImportError: + import _libusb + return _libusb + if fp is not None: + try: + _mod = imp.load_module('_libusb', fp, pathname, description) + finally: + fp.close() + return _mod + _libusb = swig_import_helper() + del swig_import_helper +else: + import _libusb +del version_info +try: + _swig_property = property +except NameError: + pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): - if type(value).__name__ == 'PySwigObject': + if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) - if (not static) or hasattr(self,name): + if (not static): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) @@ -25,23 +54,32 @@ def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) - raise AttributeError,name + raise AttributeError(name) + +def _swig_repr(self): + try: strthis = "proxy of " + self.this.__repr__() + except: strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) -import types try: - _object = types.ObjectType + _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 -del types +def usb_control_in(*args): + return _libusb.usb_control_in(*args) usb_control_in = _libusb.usb_control_in +def usb_control_out(*args): + return _libusb.usb_control_out(*args) usb_control_out = _libusb.usb_control_out +def usb_string(*args): + return _libusb.usb_string(*args) usb_string = _libusb.usb_string USB_CLASS_PER_INTERFACE = _libusb.USB_CLASS_PER_INTERFACE USB_CLASS_AUDIO = _libusb.USB_CLASS_AUDIO @@ -73,81 +111,75 @@ class usb_descriptor_header(_object): __setattr__ = lambda self, name, value: _swig_setattr(self, usb_descriptor_header, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, usb_descriptor_header, name) - def __repr__(self): - try: strthis = "at 0x%x" %( self.this, ) - except: strthis = "" - return "<%s.%s; proxy of C usb_descriptor_header instance %s>" % (self.__class__.__module__, self.__class__.__name__, strthis,) + __repr__ = _swig_repr __swig_setmethods__["bLength"] = _libusb.usb_descriptor_header_bLength_set __swig_getmethods__["bLength"] = _libusb.usb_descriptor_header_bLength_get - if _newclass:bLength = property(_libusb.usb_descriptor_header_bLength_get, _libusb.usb_descriptor_header_bLength_set) + if _newclass:bLength = _swig_property(_libusb.usb_descriptor_header_bLength_get, _libusb.usb_descriptor_header_bLength_set) __swig_setmethods__["bDescriptorType"] = _libusb.usb_descriptor_header_bDescriptorType_set __swig_getmethods__["bDescriptorType"] = _libusb.usb_descriptor_header_bDescriptorType_get - if _newclass:bDescriptorType = property(_libusb.usb_descriptor_header_bDescriptorType_get, _libusb.usb_descriptor_header_bDescriptorType_set) - def __init__(self, *args): - this = _libusb.new_usb_descriptor_header(*args) + if _newclass:bDescriptorType = _swig_property(_libusb.usb_descriptor_header_bDescriptorType_get, _libusb.usb_descriptor_header_bDescriptorType_set) + def __init__(self): + this = _libusb.new_usb_descriptor_header() try: self.this.append(this) except: self.this = this __swig_destroy__ = _libusb.delete_usb_descriptor_header __del__ = lambda self : None; -_libusb.usb_descriptor_header_swigregister(usb_descriptor_header) +usb_descriptor_header_swigregister = _libusb.usb_descriptor_header_swigregister +usb_descriptor_header_swigregister(usb_descriptor_header) class usb_string_descriptor(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, usb_string_descriptor, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, usb_string_descriptor, name) - def __repr__(self): - try: strthis = "at 0x%x" %( self.this, ) - except: strthis = "" - return "<%s.%s; proxy of C usb_string_descriptor instance %s>" % (self.__class__.__module__, self.__class__.__name__, strthis,) + __repr__ = _swig_repr __swig_setmethods__["bLength"] = _libusb.usb_string_descriptor_bLength_set __swig_getmethods__["bLength"] = _libusb.usb_string_descriptor_bLength_get - if _newclass:bLength = property(_libusb.usb_string_descriptor_bLength_get, _libusb.usb_string_descriptor_bLength_set) + if _newclass:bLength = _swig_property(_libusb.usb_string_descriptor_bLength_get, _libusb.usb_string_descriptor_bLength_set) __swig_setmethods__["bDescriptorType"] = _libusb.usb_string_descriptor_bDescriptorType_set __swig_getmethods__["bDescriptorType"] = _libusb.usb_string_descriptor_bDescriptorType_get - if _newclass:bDescriptorType = property(_libusb.usb_string_descriptor_bDescriptorType_get, _libusb.usb_string_descriptor_bDescriptorType_set) + if _newclass:bDescriptorType = _swig_property(_libusb.usb_string_descriptor_bDescriptorType_get, _libusb.usb_string_descriptor_bDescriptorType_set) __swig_setmethods__["wData"] = _libusb.usb_string_descriptor_wData_set __swig_getmethods__["wData"] = _libusb.usb_string_descriptor_wData_get - if _newclass:wData = property(_libusb.usb_string_descriptor_wData_get, _libusb.usb_string_descriptor_wData_set) - def __init__(self, *args): - this = _libusb.new_usb_string_descriptor(*args) + if _newclass:wData = _swig_property(_libusb.usb_string_descriptor_wData_get, _libusb.usb_string_descriptor_wData_set) + def __init__(self): + this = _libusb.new_usb_string_descriptor() try: self.this.append(this) except: self.this = this __swig_destroy__ = _libusb.delete_usb_string_descriptor __del__ = lambda self : None; -_libusb.usb_string_descriptor_swigregister(usb_string_descriptor) +usb_string_descriptor_swigregister = _libusb.usb_string_descriptor_swigregister +usb_string_descriptor_swigregister(usb_string_descriptor) class usb_hid_descriptor(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, usb_hid_descriptor, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, usb_hid_descriptor, name) - def __repr__(self): - try: strthis = "at 0x%x" %( self.this, ) - except: strthis = "" - return "<%s.%s; proxy of C usb_hid_descriptor instance %s>" % (self.__class__.__module__, self.__class__.__name__, strthis,) + __repr__ = _swig_repr __swig_setmethods__["bLength"] = _libusb.usb_hid_descriptor_bLength_set __swig_getmethods__["bLength"] = _libusb.usb_hid_descriptor_bLength_get - if _newclass:bLength = property(_libusb.usb_hid_descriptor_bLength_get, _libusb.usb_hid_descriptor_bLength_set) + if _newclass:bLength = _swig_property(_libusb.usb_hid_descriptor_bLength_get, _libusb.usb_hid_descriptor_bLength_set) __swig_setmethods__["bDescriptorType"] = _libusb.usb_hid_descriptor_bDescriptorType_set __swig_getmethods__["bDescriptorType"] = _libusb.usb_hid_descriptor_bDescriptorType_get - if _newclass:bDescriptorType = property(_libusb.usb_hid_descriptor_bDescriptorType_get, _libusb.usb_hid_descriptor_bDescriptorType_set) + if _newclass:bDescriptorType = _swig_property(_libusb.usb_hid_descriptor_bDescriptorType_get, _libusb.usb_hid_descriptor_bDescriptorType_set) __swig_setmethods__["bcdHID"] = _libusb.usb_hid_descriptor_bcdHID_set __swig_getmethods__["bcdHID"] = _libusb.usb_hid_descriptor_bcdHID_get - if _newclass:bcdHID = property(_libusb.usb_hid_descriptor_bcdHID_get, _libusb.usb_hid_descriptor_bcdHID_set) + if _newclass:bcdHID = _swig_property(_libusb.usb_hid_descriptor_bcdHID_get, _libusb.usb_hid_descriptor_bcdHID_set) __swig_setmethods__["bCountryCode"] = _libusb.usb_hid_descriptor_bCountryCode_set __swig_getmethods__["bCountryCode"] = _libusb.usb_hid_descriptor_bCountryCode_get - if _newclass:bCountryCode = property(_libusb.usb_hid_descriptor_bCountryCode_get, _libusb.usb_hid_descriptor_bCountryCode_set) + if _newclass:bCountryCode = _swig_property(_libusb.usb_hid_descriptor_bCountryCode_get, _libusb.usb_hid_descriptor_bCountryCode_set) __swig_setmethods__["bNumDescriptors"] = _libusb.usb_hid_descriptor_bNumDescriptors_set __swig_getmethods__["bNumDescriptors"] = _libusb.usb_hid_descriptor_bNumDescriptors_get - if _newclass:bNumDescriptors = property(_libusb.usb_hid_descriptor_bNumDescriptors_get, _libusb.usb_hid_descriptor_bNumDescriptors_set) - def __init__(self, *args): - this = _libusb.new_usb_hid_descriptor(*args) + if _newclass:bNumDescriptors = _swig_property(_libusb.usb_hid_descriptor_bNumDescriptors_get, _libusb.usb_hid_descriptor_bNumDescriptors_set) + def __init__(self): + this = _libusb.new_usb_hid_descriptor() try: self.this.append(this) except: self.this = this __swig_destroy__ = _libusb.delete_usb_hid_descriptor __del__ = lambda self : None; -_libusb.usb_hid_descriptor_swigregister(usb_hid_descriptor) +usb_hid_descriptor_swigregister = _libusb.usb_hid_descriptor_swigregister +usb_hid_descriptor_swigregister(usb_hid_descriptor) USB_MAXENDPOINTS = _libusb.USB_MAXENDPOINTS class usb_endpoint_descriptor(_object): @@ -155,47 +187,45 @@ class usb_endpoint_descriptor(_object): __setattr__ = lambda self, name, value: _swig_setattr(self, usb_endpoint_descriptor, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, usb_endpoint_descriptor, name) - def __repr__(self): - try: strthis = "at 0x%x" %( self.this, ) - except: strthis = "" - return "<%s.%s; proxy of C usb_endpoint_descriptor instance %s>" % (self.__class__.__module__, self.__class__.__name__, strthis,) + __repr__ = _swig_repr __swig_setmethods__["bLength"] = _libusb.usb_endpoint_descriptor_bLength_set __swig_getmethods__["bLength"] = _libusb.usb_endpoint_descriptor_bLength_get - if _newclass:bLength = property(_libusb.usb_endpoint_descriptor_bLength_get, _libusb.usb_endpoint_descriptor_bLength_set) + if _newclass:bLength = _swig_property(_libusb.usb_endpoint_descriptor_bLength_get, _libusb.usb_endpoint_descriptor_bLength_set) __swig_setmethods__["bDescriptorType"] = _libusb.usb_endpoint_descriptor_bDescriptorType_set __swig_getmethods__["bDescriptorType"] = _libusb.usb_endpoint_descriptor_bDescriptorType_get - if _newclass:bDescriptorType = property(_libusb.usb_endpoint_descriptor_bDescriptorType_get, _libusb.usb_endpoint_descriptor_bDescriptorType_set) + if _newclass:bDescriptorType = _swig_property(_libusb.usb_endpoint_descriptor_bDescriptorType_get, _libusb.usb_endpoint_descriptor_bDescriptorType_set) __swig_setmethods__["bEndpointAddress"] = _libusb.usb_endpoint_descriptor_bEndpointAddress_set __swig_getmethods__["bEndpointAddress"] = _libusb.usb_endpoint_descriptor_bEndpointAddress_get - if _newclass:bEndpointAddress = property(_libusb.usb_endpoint_descriptor_bEndpointAddress_get, _libusb.usb_endpoint_descriptor_bEndpointAddress_set) + if _newclass:bEndpointAddress = _swig_property(_libusb.usb_endpoint_descriptor_bEndpointAddress_get, _libusb.usb_endpoint_descriptor_bEndpointAddress_set) __swig_setmethods__["bmAttributes"] = _libusb.usb_endpoint_descriptor_bmAttributes_set __swig_getmethods__["bmAttributes"] = _libusb.usb_endpoint_descriptor_bmAttributes_get - if _newclass:bmAttributes = property(_libusb.usb_endpoint_descriptor_bmAttributes_get, _libusb.usb_endpoint_descriptor_bmAttributes_set) + if _newclass:bmAttributes = _swig_property(_libusb.usb_endpoint_descriptor_bmAttributes_get, _libusb.usb_endpoint_descriptor_bmAttributes_set) __swig_setmethods__["wMaxPacketSize"] = _libusb.usb_endpoint_descriptor_wMaxPacketSize_set __swig_getmethods__["wMaxPacketSize"] = _libusb.usb_endpoint_descriptor_wMaxPacketSize_get - if _newclass:wMaxPacketSize = property(_libusb.usb_endpoint_descriptor_wMaxPacketSize_get, _libusb.usb_endpoint_descriptor_wMaxPacketSize_set) + if _newclass:wMaxPacketSize = _swig_property(_libusb.usb_endpoint_descriptor_wMaxPacketSize_get, _libusb.usb_endpoint_descriptor_wMaxPacketSize_set) __swig_setmethods__["bInterval"] = _libusb.usb_endpoint_descriptor_bInterval_set __swig_getmethods__["bInterval"] = _libusb.usb_endpoint_descriptor_bInterval_get - if _newclass:bInterval = property(_libusb.usb_endpoint_descriptor_bInterval_get, _libusb.usb_endpoint_descriptor_bInterval_set) + if _newclass:bInterval = _swig_property(_libusb.usb_endpoint_descriptor_bInterval_get, _libusb.usb_endpoint_descriptor_bInterval_set) __swig_setmethods__["bRefresh"] = _libusb.usb_endpoint_descriptor_bRefresh_set __swig_getmethods__["bRefresh"] = _libusb.usb_endpoint_descriptor_bRefresh_get - if _newclass:bRefresh = property(_libusb.usb_endpoint_descriptor_bRefresh_get, _libusb.usb_endpoint_descriptor_bRefresh_set) + if _newclass:bRefresh = _swig_property(_libusb.usb_endpoint_descriptor_bRefresh_get, _libusb.usb_endpoint_descriptor_bRefresh_set) __swig_setmethods__["bSynchAddress"] = _libusb.usb_endpoint_descriptor_bSynchAddress_set __swig_getmethods__["bSynchAddress"] = _libusb.usb_endpoint_descriptor_bSynchAddress_get - if _newclass:bSynchAddress = property(_libusb.usb_endpoint_descriptor_bSynchAddress_get, _libusb.usb_endpoint_descriptor_bSynchAddress_set) + if _newclass:bSynchAddress = _swig_property(_libusb.usb_endpoint_descriptor_bSynchAddress_get, _libusb.usb_endpoint_descriptor_bSynchAddress_set) __swig_setmethods__["extra"] = _libusb.usb_endpoint_descriptor_extra_set __swig_getmethods__["extra"] = _libusb.usb_endpoint_descriptor_extra_get - if _newclass:extra = property(_libusb.usb_endpoint_descriptor_extra_get, _libusb.usb_endpoint_descriptor_extra_set) + if _newclass:extra = _swig_property(_libusb.usb_endpoint_descriptor_extra_get, _libusb.usb_endpoint_descriptor_extra_set) __swig_setmethods__["extralen"] = _libusb.usb_endpoint_descriptor_extralen_set __swig_getmethods__["extralen"] = _libusb.usb_endpoint_descriptor_extralen_get - if _newclass:extralen = property(_libusb.usb_endpoint_descriptor_extralen_get, _libusb.usb_endpoint_descriptor_extralen_set) - def __init__(self, *args): - this = _libusb.new_usb_endpoint_descriptor(*args) + if _newclass:extralen = _swig_property(_libusb.usb_endpoint_descriptor_extralen_get, _libusb.usb_endpoint_descriptor_extralen_set) + def __init__(self): + this = _libusb.new_usb_endpoint_descriptor() try: self.this.append(this) except: self.this = this __swig_destroy__ = _libusb.delete_usb_endpoint_descriptor __del__ = lambda self : None; -_libusb.usb_endpoint_descriptor_swigregister(usb_endpoint_descriptor) +usb_endpoint_descriptor_swigregister = _libusb.usb_endpoint_descriptor_swigregister +usb_endpoint_descriptor_swigregister(usb_endpoint_descriptor) USB_ENDPOINT_ADDRESS_MASK = _libusb.USB_ENDPOINT_ADDRESS_MASK USB_ENDPOINT_DIR_MASK = _libusb.USB_ENDPOINT_DIR_MASK @@ -210,53 +240,51 @@ class usb_interface_descriptor(_object): __setattr__ = lambda self, name, value: _swig_setattr(self, usb_interface_descriptor, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, usb_interface_descriptor, name) - def __repr__(self): - try: strthis = "at 0x%x" %( self.this, ) - except: strthis = "" - return "<%s.%s; proxy of C usb_interface_descriptor instance %s>" % (self.__class__.__module__, self.__class__.__name__, strthis,) + __repr__ = _swig_repr __swig_setmethods__["bLength"] = _libusb.usb_interface_descriptor_bLength_set __swig_getmethods__["bLength"] = _libusb.usb_interface_descriptor_bLength_get - if _newclass:bLength = property(_libusb.usb_interface_descriptor_bLength_get, _libusb.usb_interface_descriptor_bLength_set) + if _newclass:bLength = _swig_property(_libusb.usb_interface_descriptor_bLength_get, _libusb.usb_interface_descriptor_bLength_set) __swig_setmethods__["bDescriptorType"] = _libusb.usb_interface_descriptor_bDescriptorType_set __swig_getmethods__["bDescriptorType"] = _libusb.usb_interface_descriptor_bDescriptorType_get - if _newclass:bDescriptorType = property(_libusb.usb_interface_descriptor_bDescriptorType_get, _libusb.usb_interface_descriptor_bDescriptorType_set) + if _newclass:bDescriptorType = _swig_property(_libusb.usb_interface_descriptor_bDescriptorType_get, _libusb.usb_interface_descriptor_bDescriptorType_set) __swig_setmethods__["bInterfaceNumber"] = _libusb.usb_interface_descriptor_bInterfaceNumber_set __swig_getmethods__["bInterfaceNumber"] = _libusb.usb_interface_descriptor_bInterfaceNumber_get - if _newclass:bInterfaceNumber = property(_libusb.usb_interface_descriptor_bInterfaceNumber_get, _libusb.usb_interface_descriptor_bInterfaceNumber_set) + if _newclass:bInterfaceNumber = _swig_property(_libusb.usb_interface_descriptor_bInterfaceNumber_get, _libusb.usb_interface_descriptor_bInterfaceNumber_set) __swig_setmethods__["bAlternateSetting"] = _libusb.usb_interface_descriptor_bAlternateSetting_set __swig_getmethods__["bAlternateSetting"] = _libusb.usb_interface_descriptor_bAlternateSetting_get - if _newclass:bAlternateSetting = property(_libusb.usb_interface_descriptor_bAlternateSetting_get, _libusb.usb_interface_descriptor_bAlternateSetting_set) + if _newclass:bAlternateSetting = _swig_property(_libusb.usb_interface_descriptor_bAlternateSetting_get, _libusb.usb_interface_descriptor_bAlternateSetting_set) __swig_setmethods__["bNumEndpoints"] = _libusb.usb_interface_descriptor_bNumEndpoints_set __swig_getmethods__["bNumEndpoints"] = _libusb.usb_interface_descriptor_bNumEndpoints_get - if _newclass:bNumEndpoints = property(_libusb.usb_interface_descriptor_bNumEndpoints_get, _libusb.usb_interface_descriptor_bNumEndpoints_set) + if _newclass:bNumEndpoints = _swig_property(_libusb.usb_interface_descriptor_bNumEndpoints_get, _libusb.usb_interface_descriptor_bNumEndpoints_set) __swig_setmethods__["bInterfaceClass"] = _libusb.usb_interface_descriptor_bInterfaceClass_set __swig_getmethods__["bInterfaceClass"] = _libusb.usb_interface_descriptor_bInterfaceClass_get - if _newclass:bInterfaceClass = property(_libusb.usb_interface_descriptor_bInterfaceClass_get, _libusb.usb_interface_descriptor_bInterfaceClass_set) + if _newclass:bInterfaceClass = _swig_property(_libusb.usb_interface_descriptor_bInterfaceClass_get, _libusb.usb_interface_descriptor_bInterfaceClass_set) __swig_setmethods__["bInterfaceSubClass"] = _libusb.usb_interface_descriptor_bInterfaceSubClass_set __swig_getmethods__["bInterfaceSubClass"] = _libusb.usb_interface_descriptor_bInterfaceSubClass_get - if _newclass:bInterfaceSubClass = property(_libusb.usb_interface_descriptor_bInterfaceSubClass_get, _libusb.usb_interface_descriptor_bInterfaceSubClass_set) + if _newclass:bInterfaceSubClass = _swig_property(_libusb.usb_interface_descriptor_bInterfaceSubClass_get, _libusb.usb_interface_descriptor_bInterfaceSubClass_set) __swig_setmethods__["bInterfaceProtocol"] = _libusb.usb_interface_descriptor_bInterfaceProtocol_set __swig_getmethods__["bInterfaceProtocol"] = _libusb.usb_interface_descriptor_bInterfaceProtocol_get - if _newclass:bInterfaceProtocol = property(_libusb.usb_interface_descriptor_bInterfaceProtocol_get, _libusb.usb_interface_descriptor_bInterfaceProtocol_set) + if _newclass:bInterfaceProtocol = _swig_property(_libusb.usb_interface_descriptor_bInterfaceProtocol_get, _libusb.usb_interface_descriptor_bInterfaceProtocol_set) __swig_setmethods__["iInterface"] = _libusb.usb_interface_descriptor_iInterface_set __swig_getmethods__["iInterface"] = _libusb.usb_interface_descriptor_iInterface_get - if _newclass:iInterface = property(_libusb.usb_interface_descriptor_iInterface_get, _libusb.usb_interface_descriptor_iInterface_set) + if _newclass:iInterface = _swig_property(_libusb.usb_interface_descriptor_iInterface_get, _libusb.usb_interface_descriptor_iInterface_set) __swig_setmethods__["endpoint"] = _libusb.usb_interface_descriptor_endpoint_set __swig_getmethods__["endpoint"] = _libusb.usb_interface_descriptor_endpoint_get - if _newclass:endpoint = property(_libusb.usb_interface_descriptor_endpoint_get, _libusb.usb_interface_descriptor_endpoint_set) + if _newclass:endpoint = _swig_property(_libusb.usb_interface_descriptor_endpoint_get, _libusb.usb_interface_descriptor_endpoint_set) __swig_setmethods__["extra"] = _libusb.usb_interface_descriptor_extra_set __swig_getmethods__["extra"] = _libusb.usb_interface_descriptor_extra_get - if _newclass:extra = property(_libusb.usb_interface_descriptor_extra_get, _libusb.usb_interface_descriptor_extra_set) + if _newclass:extra = _swig_property(_libusb.usb_interface_descriptor_extra_get, _libusb.usb_interface_descriptor_extra_set) __swig_setmethods__["extralen"] = _libusb.usb_interface_descriptor_extralen_set __swig_getmethods__["extralen"] = _libusb.usb_interface_descriptor_extralen_get - if _newclass:extralen = property(_libusb.usb_interface_descriptor_extralen_get, _libusb.usb_interface_descriptor_extralen_set) - def __init__(self, *args): - this = _libusb.new_usb_interface_descriptor(*args) + if _newclass:extralen = _swig_property(_libusb.usb_interface_descriptor_extralen_get, _libusb.usb_interface_descriptor_extralen_set) + def __init__(self): + this = _libusb.new_usb_interface_descriptor() try: self.this.append(this) except: self.this = this __swig_destroy__ = _libusb.delete_usb_interface_descriptor __del__ = lambda self : None; -_libusb.usb_interface_descriptor_swigregister(usb_interface_descriptor) +usb_interface_descriptor_swigregister = _libusb.usb_interface_descriptor_swigregister +usb_interface_descriptor_swigregister(usb_interface_descriptor) USB_MAXALTSETTING = _libusb.USB_MAXALTSETTING class usb_interface(_object): @@ -264,23 +292,21 @@ class usb_interface(_object): __setattr__ = lambda self, name, value: _swig_setattr(self, usb_interface, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, usb_interface, name) - def __repr__(self): - try: strthis = "at 0x%x" %( self.this, ) - except: strthis = "" - return "<%s.%s; proxy of C usb_interface instance %s>" % (self.__class__.__module__, self.__class__.__name__, strthis,) + __repr__ = _swig_repr __swig_setmethods__["altsetting"] = _libusb.usb_interface_altsetting_set __swig_getmethods__["altsetting"] = _libusb.usb_interface_altsetting_get - if _newclass:altsetting = property(_libusb.usb_interface_altsetting_get, _libusb.usb_interface_altsetting_set) + if _newclass:altsetting = _swig_property(_libusb.usb_interface_altsetting_get, _libusb.usb_interface_altsetting_set) __swig_setmethods__["num_altsetting"] = _libusb.usb_interface_num_altsetting_set __swig_getmethods__["num_altsetting"] = _libusb.usb_interface_num_altsetting_get - if _newclass:num_altsetting = property(_libusb.usb_interface_num_altsetting_get, _libusb.usb_interface_num_altsetting_set) - def __init__(self, *args): - this = _libusb.new_usb_interface(*args) + if _newclass:num_altsetting = _swig_property(_libusb.usb_interface_num_altsetting_get, _libusb.usb_interface_num_altsetting_set) + def __init__(self): + this = _libusb.new_usb_interface() try: self.this.append(this) except: self.this = this __swig_destroy__ = _libusb.delete_usb_interface __del__ = lambda self : None; -_libusb.usb_interface_swigregister(usb_interface) +usb_interface_swigregister = _libusb.usb_interface_swigregister +usb_interface_swigregister(usb_interface) USB_MAXCONFIG = _libusb.USB_MAXCONFIG class usb_config_descriptor(_object): @@ -288,141 +314,135 @@ class usb_config_descriptor(_object): __setattr__ = lambda self, name, value: _swig_setattr(self, usb_config_descriptor, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, usb_config_descriptor, name) - def __repr__(self): - try: strthis = "at 0x%x" %( self.this, ) - except: strthis = "" - return "<%s.%s; proxy of C usb_config_descriptor instance %s>" % (self.__class__.__module__, self.__class__.__name__, strthis,) + __repr__ = _swig_repr __swig_setmethods__["bLength"] = _libusb.usb_config_descriptor_bLength_set __swig_getmethods__["bLength"] = _libusb.usb_config_descriptor_bLength_get - if _newclass:bLength = property(_libusb.usb_config_descriptor_bLength_get, _libusb.usb_config_descriptor_bLength_set) + if _newclass:bLength = _swig_property(_libusb.usb_config_descriptor_bLength_get, _libusb.usb_config_descriptor_bLength_set) __swig_setmethods__["bDescriptorType"] = _libusb.usb_config_descriptor_bDescriptorType_set __swig_getmethods__["bDescriptorType"] = _libusb.usb_config_descriptor_bDescriptorType_get - if _newclass:bDescriptorType = property(_libusb.usb_config_descriptor_bDescriptorType_get, _libusb.usb_config_descriptor_bDescriptorType_set) + if _newclass:bDescriptorType = _swig_property(_libusb.usb_config_descriptor_bDescriptorType_get, _libusb.usb_config_descriptor_bDescriptorType_set) __swig_setmethods__["wTotalLength"] = _libusb.usb_config_descriptor_wTotalLength_set __swig_getmethods__["wTotalLength"] = _libusb.usb_config_descriptor_wTotalLength_get - if _newclass:wTotalLength = property(_libusb.usb_config_descriptor_wTotalLength_get, _libusb.usb_config_descriptor_wTotalLength_set) + if _newclass:wTotalLength = _swig_property(_libusb.usb_config_descriptor_wTotalLength_get, _libusb.usb_config_descriptor_wTotalLength_set) __swig_setmethods__["bNumInterfaces"] = _libusb.usb_config_descriptor_bNumInterfaces_set __swig_getmethods__["bNumInterfaces"] = _libusb.usb_config_descriptor_bNumInterfaces_get - if _newclass:bNumInterfaces = property(_libusb.usb_config_descriptor_bNumInterfaces_get, _libusb.usb_config_descriptor_bNumInterfaces_set) + if _newclass:bNumInterfaces = _swig_property(_libusb.usb_config_descriptor_bNumInterfaces_get, _libusb.usb_config_descriptor_bNumInterfaces_set) __swig_setmethods__["bConfigurationValue"] = _libusb.usb_config_descriptor_bConfigurationValue_set __swig_getmethods__["bConfigurationValue"] = _libusb.usb_config_descriptor_bConfigurationValue_get - if _newclass:bConfigurationValue = property(_libusb.usb_config_descriptor_bConfigurationValue_get, _libusb.usb_config_descriptor_bConfigurationValue_set) + if _newclass:bConfigurationValue = _swig_property(_libusb.usb_config_descriptor_bConfigurationValue_get, _libusb.usb_config_descriptor_bConfigurationValue_set) __swig_setmethods__["iConfiguration"] = _libusb.usb_config_descriptor_iConfiguration_set __swig_getmethods__["iConfiguration"] = _libusb.usb_config_descriptor_iConfiguration_get - if _newclass:iConfiguration = property(_libusb.usb_config_descriptor_iConfiguration_get, _libusb.usb_config_descriptor_iConfiguration_set) + if _newclass:iConfiguration = _swig_property(_libusb.usb_config_descriptor_iConfiguration_get, _libusb.usb_config_descriptor_iConfiguration_set) __swig_setmethods__["bmAttributes"] = _libusb.usb_config_descriptor_bmAttributes_set __swig_getmethods__["bmAttributes"] = _libusb.usb_config_descriptor_bmAttributes_get - if _newclass:bmAttributes = property(_libusb.usb_config_descriptor_bmAttributes_get, _libusb.usb_config_descriptor_bmAttributes_set) + if _newclass:bmAttributes = _swig_property(_libusb.usb_config_descriptor_bmAttributes_get, _libusb.usb_config_descriptor_bmAttributes_set) __swig_setmethods__["MaxPower"] = _libusb.usb_config_descriptor_MaxPower_set __swig_getmethods__["MaxPower"] = _libusb.usb_config_descriptor_MaxPower_get - if _newclass:MaxPower = property(_libusb.usb_config_descriptor_MaxPower_get, _libusb.usb_config_descriptor_MaxPower_set) + if _newclass:MaxPower = _swig_property(_libusb.usb_config_descriptor_MaxPower_get, _libusb.usb_config_descriptor_MaxPower_set) __swig_setmethods__["interface"] = _libusb.usb_config_descriptor_interface_set __swig_getmethods__["interface"] = _libusb.usb_config_descriptor_interface_get - if _newclass:interface = property(_libusb.usb_config_descriptor_interface_get, _libusb.usb_config_descriptor_interface_set) + if _newclass:interface = _swig_property(_libusb.usb_config_descriptor_interface_get, _libusb.usb_config_descriptor_interface_set) __swig_setmethods__["extra"] = _libusb.usb_config_descriptor_extra_set __swig_getmethods__["extra"] = _libusb.usb_config_descriptor_extra_get - if _newclass:extra = property(_libusb.usb_config_descriptor_extra_get, _libusb.usb_config_descriptor_extra_set) + if _newclass:extra = _swig_property(_libusb.usb_config_descriptor_extra_get, _libusb.usb_config_descriptor_extra_set) __swig_setmethods__["extralen"] = _libusb.usb_config_descriptor_extralen_set __swig_getmethods__["extralen"] = _libusb.usb_config_descriptor_extralen_get - if _newclass:extralen = property(_libusb.usb_config_descriptor_extralen_get, _libusb.usb_config_descriptor_extralen_set) - def __init__(self, *args): - this = _libusb.new_usb_config_descriptor(*args) + if _newclass:extralen = _swig_property(_libusb.usb_config_descriptor_extralen_get, _libusb.usb_config_descriptor_extralen_set) + def __init__(self): + this = _libusb.new_usb_config_descriptor() try: self.this.append(this) except: self.this = this __swig_destroy__ = _libusb.delete_usb_config_descriptor __del__ = lambda self : None; -_libusb.usb_config_descriptor_swigregister(usb_config_descriptor) +usb_config_descriptor_swigregister = _libusb.usb_config_descriptor_swigregister +usb_config_descriptor_swigregister(usb_config_descriptor) class usb_device_descriptor(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, usb_device_descriptor, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, usb_device_descriptor, name) - def __repr__(self): - try: strthis = "at 0x%x" %( self.this, ) - except: strthis = "" - return "<%s.%s; proxy of C usb_device_descriptor instance %s>" % (self.__class__.__module__, self.__class__.__name__, strthis,) + __repr__ = _swig_repr __swig_setmethods__["bLength"] = _libusb.usb_device_descriptor_bLength_set __swig_getmethods__["bLength"] = _libusb.usb_device_descriptor_bLength_get - if _newclass:bLength = property(_libusb.usb_device_descriptor_bLength_get, _libusb.usb_device_descriptor_bLength_set) + if _newclass:bLength = _swig_property(_libusb.usb_device_descriptor_bLength_get, _libusb.usb_device_descriptor_bLength_set) __swig_setmethods__["bDescriptorType"] = _libusb.usb_device_descriptor_bDescriptorType_set __swig_getmethods__["bDescriptorType"] = _libusb.usb_device_descriptor_bDescriptorType_get - if _newclass:bDescriptorType = property(_libusb.usb_device_descriptor_bDescriptorType_get, _libusb.usb_device_descriptor_bDescriptorType_set) + if _newclass:bDescriptorType = _swig_property(_libusb.usb_device_descriptor_bDescriptorType_get, _libusb.usb_device_descriptor_bDescriptorType_set) __swig_setmethods__["bcdUSB"] = _libusb.usb_device_descriptor_bcdUSB_set __swig_getmethods__["bcdUSB"] = _libusb.usb_device_descriptor_bcdUSB_get - if _newclass:bcdUSB = property(_libusb.usb_device_descriptor_bcdUSB_get, _libusb.usb_device_descriptor_bcdUSB_set) + if _newclass:bcdUSB = _swig_property(_libusb.usb_device_descriptor_bcdUSB_get, _libusb.usb_device_descriptor_bcdUSB_set) __swig_setmethods__["bDeviceClass"] = _libusb.usb_device_descriptor_bDeviceClass_set __swig_getmethods__["bDeviceClass"] = _libusb.usb_device_descriptor_bDeviceClass_get - if _newclass:bDeviceClass = property(_libusb.usb_device_descriptor_bDeviceClass_get, _libusb.usb_device_descriptor_bDeviceClass_set) + if _newclass:bDeviceClass = _swig_property(_libusb.usb_device_descriptor_bDeviceClass_get, _libusb.usb_device_descriptor_bDeviceClass_set) __swig_setmethods__["bDeviceSubClass"] = _libusb.usb_device_descriptor_bDeviceSubClass_set __swig_getmethods__["bDeviceSubClass"] = _libusb.usb_device_descriptor_bDeviceSubClass_get - if _newclass:bDeviceSubClass = property(_libusb.usb_device_descriptor_bDeviceSubClass_get, _libusb.usb_device_descriptor_bDeviceSubClass_set) + if _newclass:bDeviceSubClass = _swig_property(_libusb.usb_device_descriptor_bDeviceSubClass_get, _libusb.usb_device_descriptor_bDeviceSubClass_set) __swig_setmethods__["bDeviceProtocol"] = _libusb.usb_device_descriptor_bDeviceProtocol_set __swig_getmethods__["bDeviceProtocol"] = _libusb.usb_device_descriptor_bDeviceProtocol_get - if _newclass:bDeviceProtocol = property(_libusb.usb_device_descriptor_bDeviceProtocol_get, _libusb.usb_device_descriptor_bDeviceProtocol_set) + if _newclass:bDeviceProtocol = _swig_property(_libusb.usb_device_descriptor_bDeviceProtocol_get, _libusb.usb_device_descriptor_bDeviceProtocol_set) __swig_setmethods__["bMaxPacketSize0"] = _libusb.usb_device_descriptor_bMaxPacketSize0_set __swig_getmethods__["bMaxPacketSize0"] = _libusb.usb_device_descriptor_bMaxPacketSize0_get - if _newclass:bMaxPacketSize0 = property(_libusb.usb_device_descriptor_bMaxPacketSize0_get, _libusb.usb_device_descriptor_bMaxPacketSize0_set) + if _newclass:bMaxPacketSize0 = _swig_property(_libusb.usb_device_descriptor_bMaxPacketSize0_get, _libusb.usb_device_descriptor_bMaxPacketSize0_set) __swig_setmethods__["idVendor"] = _libusb.usb_device_descriptor_idVendor_set __swig_getmethods__["idVendor"] = _libusb.usb_device_descriptor_idVendor_get - if _newclass:idVendor = property(_libusb.usb_device_descriptor_idVendor_get, _libusb.usb_device_descriptor_idVendor_set) + if _newclass:idVendor = _swig_property(_libusb.usb_device_descriptor_idVendor_get, _libusb.usb_device_descriptor_idVendor_set) __swig_setmethods__["idProduct"] = _libusb.usb_device_descriptor_idProduct_set __swig_getmethods__["idProduct"] = _libusb.usb_device_descriptor_idProduct_get - if _newclass:idProduct = property(_libusb.usb_device_descriptor_idProduct_get, _libusb.usb_device_descriptor_idProduct_set) + if _newclass:idProduct = _swig_property(_libusb.usb_device_descriptor_idProduct_get, _libusb.usb_device_descriptor_idProduct_set) __swig_setmethods__["bcdDevice"] = _libusb.usb_device_descriptor_bcdDevice_set __swig_getmethods__["bcdDevice"] = _libusb.usb_device_descriptor_bcdDevice_get - if _newclass:bcdDevice = property(_libusb.usb_device_descriptor_bcdDevice_get, _libusb.usb_device_descriptor_bcdDevice_set) + if _newclass:bcdDevice = _swig_property(_libusb.usb_device_descriptor_bcdDevice_get, _libusb.usb_device_descriptor_bcdDevice_set) __swig_setmethods__["iManufacturer"] = _libusb.usb_device_descriptor_iManufacturer_set __swig_getmethods__["iManufacturer"] = _libusb.usb_device_descriptor_iManufacturer_get - if _newclass:iManufacturer = property(_libusb.usb_device_descriptor_iManufacturer_get, _libusb.usb_device_descriptor_iManufacturer_set) + if _newclass:iManufacturer = _swig_property(_libusb.usb_device_descriptor_iManufacturer_get, _libusb.usb_device_descriptor_iManufacturer_set) __swig_setmethods__["iProduct"] = _libusb.usb_device_descriptor_iProduct_set __swig_getmethods__["iProduct"] = _libusb.usb_device_descriptor_iProduct_get - if _newclass:iProduct = property(_libusb.usb_device_descriptor_iProduct_get, _libusb.usb_device_descriptor_iProduct_set) + if _newclass:iProduct = _swig_property(_libusb.usb_device_descriptor_iProduct_get, _libusb.usb_device_descriptor_iProduct_set) __swig_setmethods__["iSerialNumber"] = _libusb.usb_device_descriptor_iSerialNumber_set __swig_getmethods__["iSerialNumber"] = _libusb.usb_device_descriptor_iSerialNumber_get - if _newclass:iSerialNumber = property(_libusb.usb_device_descriptor_iSerialNumber_get, _libusb.usb_device_descriptor_iSerialNumber_set) + if _newclass:iSerialNumber = _swig_property(_libusb.usb_device_descriptor_iSerialNumber_get, _libusb.usb_device_descriptor_iSerialNumber_set) __swig_setmethods__["bNumConfigurations"] = _libusb.usb_device_descriptor_bNumConfigurations_set __swig_getmethods__["bNumConfigurations"] = _libusb.usb_device_descriptor_bNumConfigurations_get - if _newclass:bNumConfigurations = property(_libusb.usb_device_descriptor_bNumConfigurations_get, _libusb.usb_device_descriptor_bNumConfigurations_set) - def __init__(self, *args): - this = _libusb.new_usb_device_descriptor(*args) + if _newclass:bNumConfigurations = _swig_property(_libusb.usb_device_descriptor_bNumConfigurations_get, _libusb.usb_device_descriptor_bNumConfigurations_set) + def __init__(self): + this = _libusb.new_usb_device_descriptor() try: self.this.append(this) except: self.this = this __swig_destroy__ = _libusb.delete_usb_device_descriptor __del__ = lambda self : None; -_libusb.usb_device_descriptor_swigregister(usb_device_descriptor) +usb_device_descriptor_swigregister = _libusb.usb_device_descriptor_swigregister +usb_device_descriptor_swigregister(usb_device_descriptor) class usb_ctrl_setup(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, usb_ctrl_setup, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, usb_ctrl_setup, name) - def __repr__(self): - try: strthis = "at 0x%x" %( self.this, ) - except: strthis = "" - return "<%s.%s; proxy of C usb_ctrl_setup instance %s>" % (self.__class__.__module__, self.__class__.__name__, strthis,) + __repr__ = _swig_repr __swig_setmethods__["bRequestType"] = _libusb.usb_ctrl_setup_bRequestType_set __swig_getmethods__["bRequestType"] = _libusb.usb_ctrl_setup_bRequestType_get - if _newclass:bRequestType = property(_libusb.usb_ctrl_setup_bRequestType_get, _libusb.usb_ctrl_setup_bRequestType_set) + if _newclass:bRequestType = _swig_property(_libusb.usb_ctrl_setup_bRequestType_get, _libusb.usb_ctrl_setup_bRequestType_set) __swig_setmethods__["bRequest"] = _libusb.usb_ctrl_setup_bRequest_set __swig_getmethods__["bRequest"] = _libusb.usb_ctrl_setup_bRequest_get - if _newclass:bRequest = property(_libusb.usb_ctrl_setup_bRequest_get, _libusb.usb_ctrl_setup_bRequest_set) + if _newclass:bRequest = _swig_property(_libusb.usb_ctrl_setup_bRequest_get, _libusb.usb_ctrl_setup_bRequest_set) __swig_setmethods__["wValue"] = _libusb.usb_ctrl_setup_wValue_set __swig_getmethods__["wValue"] = _libusb.usb_ctrl_setup_wValue_get - if _newclass:wValue = property(_libusb.usb_ctrl_setup_wValue_get, _libusb.usb_ctrl_setup_wValue_set) + if _newclass:wValue = _swig_property(_libusb.usb_ctrl_setup_wValue_get, _libusb.usb_ctrl_setup_wValue_set) __swig_setmethods__["wIndex"] = _libusb.usb_ctrl_setup_wIndex_set __swig_getmethods__["wIndex"] = _libusb.usb_ctrl_setup_wIndex_get - if _newclass:wIndex = property(_libusb.usb_ctrl_setup_wIndex_get, _libusb.usb_ctrl_setup_wIndex_set) + if _newclass:wIndex = _swig_property(_libusb.usb_ctrl_setup_wIndex_get, _libusb.usb_ctrl_setup_wIndex_set) __swig_setmethods__["wLength"] = _libusb.usb_ctrl_setup_wLength_set __swig_getmethods__["wLength"] = _libusb.usb_ctrl_setup_wLength_get - if _newclass:wLength = property(_libusb.usb_ctrl_setup_wLength_get, _libusb.usb_ctrl_setup_wLength_set) - def __init__(self, *args): - this = _libusb.new_usb_ctrl_setup(*args) + if _newclass:wLength = _swig_property(_libusb.usb_ctrl_setup_wLength_get, _libusb.usb_ctrl_setup_wLength_set) + def __init__(self): + this = _libusb.new_usb_ctrl_setup() try: self.this.append(this) except: self.this = this __swig_destroy__ = _libusb.delete_usb_ctrl_setup __del__ = lambda self : None; -_libusb.usb_ctrl_setup_swigregister(usb_ctrl_setup) +usb_ctrl_setup_swigregister = _libusb.usb_ctrl_setup_swigregister +usb_ctrl_setup_swigregister(usb_ctrl_setup) USB_REQ_GET_STATUS = _libusb.USB_REQ_GET_STATUS USB_REQ_CLEAR_FEATURE = _libusb.USB_REQ_CLEAR_FEATURE @@ -446,142 +466,192 @@ def __init__(self, *args): USB_ENDPOINT_IN = _libusb.USB_ENDPOINT_IN USB_ENDPOINT_OUT = _libusb.USB_ENDPOINT_OUT USB_ERROR_BEGIN = _libusb.USB_ERROR_BEGIN +LIBUSB_PATH_MAX = _libusb.LIBUSB_PATH_MAX class usb_device(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, usb_device, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, usb_device, name) - def __repr__(self): - try: strthis = "at 0x%x" %( self.this, ) - except: strthis = "" - return "<%s.%s; proxy of C usb_device instance %s>" % (self.__class__.__module__, self.__class__.__name__, strthis,) + __repr__ = _swig_repr __swig_setmethods__["next"] = _libusb.usb_device_next_set __swig_getmethods__["next"] = _libusb.usb_device_next_get - if _newclass:next = property(_libusb.usb_device_next_get, _libusb.usb_device_next_set) + if _newclass:next = _swig_property(_libusb.usb_device_next_get, _libusb.usb_device_next_set) __swig_setmethods__["prev"] = _libusb.usb_device_prev_set __swig_getmethods__["prev"] = _libusb.usb_device_prev_get - if _newclass:prev = property(_libusb.usb_device_prev_get, _libusb.usb_device_prev_set) + if _newclass:prev = _swig_property(_libusb.usb_device_prev_get, _libusb.usb_device_prev_set) __swig_setmethods__["filename"] = _libusb.usb_device_filename_set __swig_getmethods__["filename"] = _libusb.usb_device_filename_get - if _newclass:filename = property(_libusb.usb_device_filename_get, _libusb.usb_device_filename_set) + if _newclass:filename = _swig_property(_libusb.usb_device_filename_get, _libusb.usb_device_filename_set) __swig_setmethods__["bus"] = _libusb.usb_device_bus_set __swig_getmethods__["bus"] = _libusb.usb_device_bus_get - if _newclass:bus = property(_libusb.usb_device_bus_get, _libusb.usb_device_bus_set) + if _newclass:bus = _swig_property(_libusb.usb_device_bus_get, _libusb.usb_device_bus_set) __swig_setmethods__["descriptor"] = _libusb.usb_device_descriptor_set __swig_getmethods__["descriptor"] = _libusb.usb_device_descriptor_get - if _newclass:descriptor = property(_libusb.usb_device_descriptor_get, _libusb.usb_device_descriptor_set) + if _newclass:descriptor = _swig_property(_libusb.usb_device_descriptor_get, _libusb.usb_device_descriptor_set) __swig_setmethods__["config"] = _libusb.usb_device_config_set __swig_getmethods__["config"] = _libusb.usb_device_config_get - if _newclass:config = property(_libusb.usb_device_config_get, _libusb.usb_device_config_set) + if _newclass:config = _swig_property(_libusb.usb_device_config_get, _libusb.usb_device_config_set) __swig_setmethods__["dev"] = _libusb.usb_device_dev_set __swig_getmethods__["dev"] = _libusb.usb_device_dev_get - if _newclass:dev = property(_libusb.usb_device_dev_get, _libusb.usb_device_dev_set) + if _newclass:dev = _swig_property(_libusb.usb_device_dev_get, _libusb.usb_device_dev_set) __swig_setmethods__["devnum"] = _libusb.usb_device_devnum_set __swig_getmethods__["devnum"] = _libusb.usb_device_devnum_get - if _newclass:devnum = property(_libusb.usb_device_devnum_get, _libusb.usb_device_devnum_set) + if _newclass:devnum = _swig_property(_libusb.usb_device_devnum_get, _libusb.usb_device_devnum_set) __swig_setmethods__["num_children"] = _libusb.usb_device_num_children_set __swig_getmethods__["num_children"] = _libusb.usb_device_num_children_get - if _newclass:num_children = property(_libusb.usb_device_num_children_get, _libusb.usb_device_num_children_set) + if _newclass:num_children = _swig_property(_libusb.usb_device_num_children_get, _libusb.usb_device_num_children_set) __swig_setmethods__["children"] = _libusb.usb_device_children_set __swig_getmethods__["children"] = _libusb.usb_device_children_get - if _newclass:children = property(_libusb.usb_device_children_get, _libusb.usb_device_children_set) - def __init__(self, *args): - this = _libusb.new_usb_device(*args) + if _newclass:children = _swig_property(_libusb.usb_device_children_get, _libusb.usb_device_children_set) + def __init__(self): + this = _libusb.new_usb_device() try: self.this.append(this) except: self.this = this __swig_destroy__ = _libusb.delete_usb_device __del__ = lambda self : None; -_libusb.usb_device_swigregister(usb_device) +usb_device_swigregister = _libusb.usb_device_swigregister +usb_device_swigregister(usb_device) class usb_bus(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, usb_bus, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, usb_bus, name) - def __repr__(self): - try: strthis = "at 0x%x" %( self.this, ) - except: strthis = "" - return "<%s.%s; proxy of C usb_bus instance %s>" % (self.__class__.__module__, self.__class__.__name__, strthis,) + __repr__ = _swig_repr __swig_setmethods__["next"] = _libusb.usb_bus_next_set __swig_getmethods__["next"] = _libusb.usb_bus_next_get - if _newclass:next = property(_libusb.usb_bus_next_get, _libusb.usb_bus_next_set) + if _newclass:next = _swig_property(_libusb.usb_bus_next_get, _libusb.usb_bus_next_set) __swig_setmethods__["prev"] = _libusb.usb_bus_prev_set __swig_getmethods__["prev"] = _libusb.usb_bus_prev_get - if _newclass:prev = property(_libusb.usb_bus_prev_get, _libusb.usb_bus_prev_set) + if _newclass:prev = _swig_property(_libusb.usb_bus_prev_get, _libusb.usb_bus_prev_set) __swig_setmethods__["dirname"] = _libusb.usb_bus_dirname_set __swig_getmethods__["dirname"] = _libusb.usb_bus_dirname_get - if _newclass:dirname = property(_libusb.usb_bus_dirname_get, _libusb.usb_bus_dirname_set) + if _newclass:dirname = _swig_property(_libusb.usb_bus_dirname_get, _libusb.usb_bus_dirname_set) __swig_setmethods__["devices"] = _libusb.usb_bus_devices_set __swig_getmethods__["devices"] = _libusb.usb_bus_devices_get - if _newclass:devices = property(_libusb.usb_bus_devices_get, _libusb.usb_bus_devices_set) + if _newclass:devices = _swig_property(_libusb.usb_bus_devices_get, _libusb.usb_bus_devices_set) __swig_setmethods__["location"] = _libusb.usb_bus_location_set __swig_getmethods__["location"] = _libusb.usb_bus_location_get - if _newclass:location = property(_libusb.usb_bus_location_get, _libusb.usb_bus_location_set) + if _newclass:location = _swig_property(_libusb.usb_bus_location_get, _libusb.usb_bus_location_set) __swig_setmethods__["root_dev"] = _libusb.usb_bus_root_dev_set __swig_getmethods__["root_dev"] = _libusb.usb_bus_root_dev_get - if _newclass:root_dev = property(_libusb.usb_bus_root_dev_get, _libusb.usb_bus_root_dev_set) - def __init__(self, *args): - this = _libusb.new_usb_bus(*args) + if _newclass:root_dev = _swig_property(_libusb.usb_bus_root_dev_get, _libusb.usb_bus_root_dev_set) + def __init__(self): + this = _libusb.new_usb_bus() try: self.this.append(this) except: self.this = this __swig_destroy__ = _libusb.delete_usb_bus __del__ = lambda self : None; -_libusb.usb_bus_swigregister(usb_bus) +usb_bus_swigregister = _libusb.usb_bus_swigregister +usb_bus_swigregister(usb_bus) +def usb_open(*args): + return _libusb.usb_open(*args) usb_open = _libusb.usb_open +def usb_close(*args): + return _libusb.usb_close(*args) usb_close = _libusb.usb_close +def usb_get_string(*args): + return _libusb.usb_get_string(*args) usb_get_string = _libusb.usb_get_string +def usb_get_string_simple(*args): + return _libusb.usb_get_string_simple(*args) usb_get_string_simple = _libusb.usb_get_string_simple +def usb_get_descriptor_by_endpoint(*args): + return _libusb.usb_get_descriptor_by_endpoint(*args) usb_get_descriptor_by_endpoint = _libusb.usb_get_descriptor_by_endpoint +def usb_get_descriptor(*args): + return _libusb.usb_get_descriptor(*args) usb_get_descriptor = _libusb.usb_get_descriptor +def usb_bulk_write(*args): + return _libusb.usb_bulk_write(*args) usb_bulk_write = _libusb.usb_bulk_write +def usb_bulk_read(*args): + return _libusb.usb_bulk_read(*args) usb_bulk_read = _libusb.usb_bulk_read +def usb_interrupt_write(*args): + return _libusb.usb_interrupt_write(*args) usb_interrupt_write = _libusb.usb_interrupt_write +def usb_interrupt_read(*args): + return _libusb.usb_interrupt_read(*args) usb_interrupt_read = _libusb.usb_interrupt_read +def usb_control_msg(*args): + return _libusb.usb_control_msg(*args) usb_control_msg = _libusb.usb_control_msg +def usb_set_configuration(*args): + return _libusb.usb_set_configuration(*args) usb_set_configuration = _libusb.usb_set_configuration +def usb_claim_interface(*args): + return _libusb.usb_claim_interface(*args) usb_claim_interface = _libusb.usb_claim_interface +def usb_release_interface(*args): + return _libusb.usb_release_interface(*args) usb_release_interface = _libusb.usb_release_interface +def usb_set_altinterface(*args): + return _libusb.usb_set_altinterface(*args) usb_set_altinterface = _libusb.usb_set_altinterface +def usb_resetep(*args): + return _libusb.usb_resetep(*args) usb_resetep = _libusb.usb_resetep +def usb_clear_halt(*args): + return _libusb.usb_clear_halt(*args) usb_clear_halt = _libusb.usb_clear_halt +def usb_reset(*args): + return _libusb.usb_reset(*args) usb_reset = _libusb.usb_reset LIBUSB_HAS_GET_DRIVER_NP = _libusb.LIBUSB_HAS_GET_DRIVER_NP +def usb_get_driver_np(*args): + return _libusb.usb_get_driver_np(*args) usb_get_driver_np = _libusb.usb_get_driver_np LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP = _libusb.LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP +def usb_detach_kernel_driver_np(*args): + return _libusb.usb_detach_kernel_driver_np(*args) usb_detach_kernel_driver_np = _libusb.usb_detach_kernel_driver_np +def usb_strerror(): + return _libusb.usb_strerror() usb_strerror = _libusb.usb_strerror +def usb_init(): + return _libusb.usb_init() usb_init = _libusb.usb_init +def usb_set_debug(*args): + return _libusb.usb_set_debug(*args) usb_set_debug = _libusb.usb_set_debug +def usb_find_busses(): + return _libusb.usb_find_busses() usb_find_busses = _libusb.usb_find_busses +def usb_find_devices(): + return _libusb.usb_find_devices() usb_find_devices = _libusb.usb_find_devices +def usb_get_busses(): + return _libusb.usb_get_busses() usb_get_busses = _libusb.usb_get_busses +# This file is compatible with both classic and new-style classes. cvar = _libusb.cvar diff --git a/Firmware/pocket-prog/util/lsusb.py b/Firmware/pocket-prog/util/lsusb.py index 437d9ae..f08e38d 100644 --- a/Firmware/pocket-prog/util/lsusb.py +++ b/Firmware/pocket-prog/util/lsusb.py @@ -2,7 +2,7 @@ # ====================================================================== # lsusb.py - Python version of the lsusb command # -# Copyright (C) 2006 Dick Streefland +# 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. diff --git a/Firmware/pocket-prog/util/sch2ps b/Firmware/pocket-prog/util/sch2ps index 3b5dc42..4f2e59b 100644 --- a/Firmware/pocket-prog/util/sch2ps +++ b/Firmware/pocket-prog/util/sch2ps @@ -2,7 +2,7 @@ # ====================================================================== # sch2ps - Convert gschem schematic to Postscript # -# Copyright (C) 2006 Dick Streefland +# Copyright 2006-2010 Dick Streefland # # This is free software, licensed under the terms of the GNU General # Public License as published by the Free Software Foundation. @@ -16,7 +16,7 @@ cat < $tmp ; Usage: gschem -q -s