From cd948a94d1cf4d1d732c82403fad22430b78f10d Mon Sep 17 00:00:00 2001 From: optixx Date: Fri, 28 Aug 2009 08:53:50 +0200 Subject: [PATCH] cleanup --- tools/gnusb/bootloader/Readme.txt | 1 - tools/gnusb/bootloader/firmware/Makefile | 90 - tools/gnusb/bootloader/firmware/checksize | 35 - .../bootloader/firmware/snesram_bootloader.c | 164 -- tools/gnusb/bootloader/firmware/usbconfig.h | 163 -- .../bootloader/firmware/usbdrv/Changelog.txt | 277 --- .../firmware/usbdrv/CommercialLicense.txt | 157 -- .../bootloader/firmware/usbdrv/License.txt | 361 --- .../bootloader/firmware/usbdrv/Readme.txt | 158 -- .../firmware/usbdrv/USBID-License.txt | 154 -- .../bootloader/firmware/usbdrv/asmcommon.inc | 188 -- .../bootloader/firmware/usbdrv/oddebug.c | 50 - .../bootloader/firmware/usbdrv/oddebug.h | 123 - .../firmware/usbdrv/usbconfig-prototype.h | 357 --- .../gnusb/bootloader/firmware/usbdrv/usbdrv.c | 625 ----- .../gnusb/bootloader/firmware/usbdrv/usbdrv.h | 733 ------ .../bootloader/firmware/usbdrv/usbdrvasm.S | 305 --- .../bootloader/firmware/usbdrv/usbdrvasm.asm | 21 - .../firmware/usbdrv/usbdrvasm12.inc | 393 --- .../firmware/usbdrv/usbdrvasm128.inc | 752 ------ .../firmware/usbdrv/usbdrvasm15.inc | 423 ---- .../firmware/usbdrv/usbdrvasm16.inc | 343 --- .../firmware/usbdrv/usbdrvasm165.inc | 453 ---- .../firmware/usbdrv/usbdrvasm18-crc.inc | 707 ------ .../firmware/usbdrv/usbdrvasm20.inc | 360 --- .../firmware/usbdrv/usbportability.h | 140 -- tools/gnusb/bootloader/software/Makefile | 33 - tools/gnusb/bootloader/software/Makefile.win | 37 - .../software/snesram_bootuploader.c | 315 --- .../software/windows-driver/libusb0.dll | Bin 46592 -> 0 bytes .../software/windows-driver/libusb0.sys | Bin 33792 -> 0 bytes .../software/windows-driver/snesboot.cat | 3 - .../software/windows-driver/snesboot.inf | 136 -- .../software/windows-driver/snesboot_x64.cat | 3 - tools/gnusb/bootloader/usb_cmds.h | 38 - tools/gnusb/common/gnusb_cmds.h | 35 - tools/gnusb/firmware/Makefile | 68 - tools/gnusb/firmware/gnusb.c | 251 -- tools/gnusb/firmware/gnusb.h | 151 -- tools/gnusb/firmware/main.c | 200 -- tools/gnusb/firmware/usbconfig.h | 252 -- tools/gnusb/firmware/usbdrv/Changelog.txt | 168 -- .../firmware/usbdrv/CommercialLicense.txt | 155 -- tools/gnusb/firmware/usbdrv/License.txt | 359 --- tools/gnusb/firmware/usbdrv/Readme.txt | 152 -- tools/gnusb/firmware/usbdrv/USBID-License.txt | 143 -- tools/gnusb/firmware/usbdrv/iarcompat.h | 70 - tools/gnusb/firmware/usbdrv/oddebug.c | 50 - tools/gnusb/firmware/usbdrv/oddebug.h | 126 - .../firmware/usbdrv/usbconfig-prototype.h | 274 --- tools/gnusb/firmware/usbdrv/usbdrv.c | 560 ----- tools/gnusb/firmware/usbdrv/usbdrv.h | 655 ----- tools/gnusb/firmware/usbdrv/usbdrvasm.S | 221 -- tools/gnusb/firmware/usbdrv/usbdrvasm.asm | 21 - tools/gnusb/firmware/usbdrv/usbdrvasm12.S | 561 ----- tools/gnusb/firmware/usbdrv/usbdrvasm15.S | 547 ----- tools/gnusb/firmware/usbdrv/usbdrvasm16.S | 472 ---- tools/gnusb/firmware/usbdrv/usbdrvasm165.S | 580 ----- .../gnusb/maxmsp/Contents/MacOS/libusb.dylib | Bin 179048 -> 0 bytes tools/gnusb/maxmsp/Info.plist | 24 - tools/gnusb/maxmsp/Makefile | 3 - tools/gnusb/maxmsp/gnusb.c | 509 ---- tools/gnusb/maxmsp/gnusb.help | 1 - .../gnusb/maxmsp/gnusb.xcodeproj/anyma.mode1 | 1324 ---------- .../maxmsp/gnusb.xcodeproj/anyma.pbxuser | 60 - tools/gnusb/maxmsp/gnusb.xcodeproj/me.mode1 | 1391 ----------- tools/gnusb/maxmsp/gnusb.xcodeproj/me.pbxuser | 221 -- .../maxmsp/gnusb.xcodeproj/project.pbxproj | 339 --- tools/gnusb/puredata/gnusb.c | 493 ---- tools/gnusb/puredata/gnusb.help.pd | 43 - tools/gnusb/puredata/m_imp.h | 223 -- tools/gnusb/puredata/m_pd.h | 594 ----- tools/gnusb/puredata/makefile | 7 - tools/gnusb/puredata/makefile_mac | 7 - tools/gnusb/puredata/makefile_other | 1 - tools/pyusb/PKG-INFO | 14 - tools/pyusb/README | 144 -- tools/pyusb/license.txt | 28 - tools/pyusb/pyusb.c | 2149 ----------------- tools/pyusb/pyusb.h | 248 -- tools/pyusb/pyusb.sln | 19 - tools/pyusb/samples/usbenum.py | 40 - tools/pyusb/samples/usbprint.py | 125 - tools/pyusb/setup.py | 64 - 84 files changed, 22240 deletions(-) delete mode 100644 tools/gnusb/bootloader/Readme.txt delete mode 100644 tools/gnusb/bootloader/firmware/Makefile delete mode 100644 tools/gnusb/bootloader/firmware/checksize delete mode 100644 tools/gnusb/bootloader/firmware/snesram_bootloader.c delete mode 100644 tools/gnusb/bootloader/firmware/usbconfig.h delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/Changelog.txt delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/CommercialLicense.txt delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/License.txt delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/Readme.txt delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/USBID-License.txt delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/asmcommon.inc delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/oddebug.c delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/oddebug.h delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbconfig-prototype.h delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbdrv.c delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbdrv.h delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm.S delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm.asm delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm12.inc delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm128.inc delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm15.inc delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm16.inc delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm165.inc delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm18-crc.inc delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm20.inc delete mode 100644 tools/gnusb/bootloader/firmware/usbdrv/usbportability.h delete mode 100644 tools/gnusb/bootloader/software/Makefile delete mode 100644 tools/gnusb/bootloader/software/Makefile.win delete mode 100644 tools/gnusb/bootloader/software/snesram_bootuploader.c delete mode 100644 tools/gnusb/bootloader/software/windows-driver/libusb0.dll delete mode 100644 tools/gnusb/bootloader/software/windows-driver/libusb0.sys delete mode 100644 tools/gnusb/bootloader/software/windows-driver/snesboot.cat delete mode 100644 tools/gnusb/bootloader/software/windows-driver/snesboot.inf delete mode 100644 tools/gnusb/bootloader/software/windows-driver/snesboot_x64.cat delete mode 100644 tools/gnusb/bootloader/usb_cmds.h delete mode 100644 tools/gnusb/common/gnusb_cmds.h delete mode 100644 tools/gnusb/firmware/Makefile delete mode 100644 tools/gnusb/firmware/gnusb.c delete mode 100644 tools/gnusb/firmware/gnusb.h delete mode 100644 tools/gnusb/firmware/main.c delete mode 100644 tools/gnusb/firmware/usbconfig.h delete mode 100644 tools/gnusb/firmware/usbdrv/Changelog.txt delete mode 100644 tools/gnusb/firmware/usbdrv/CommercialLicense.txt delete mode 100644 tools/gnusb/firmware/usbdrv/License.txt delete mode 100644 tools/gnusb/firmware/usbdrv/Readme.txt delete mode 100644 tools/gnusb/firmware/usbdrv/USBID-License.txt delete mode 100644 tools/gnusb/firmware/usbdrv/iarcompat.h delete mode 100644 tools/gnusb/firmware/usbdrv/oddebug.c delete mode 100644 tools/gnusb/firmware/usbdrv/oddebug.h delete mode 100644 tools/gnusb/firmware/usbdrv/usbconfig-prototype.h delete mode 100644 tools/gnusb/firmware/usbdrv/usbdrv.c delete mode 100644 tools/gnusb/firmware/usbdrv/usbdrv.h delete mode 100644 tools/gnusb/firmware/usbdrv/usbdrvasm.S delete mode 100644 tools/gnusb/firmware/usbdrv/usbdrvasm.asm delete mode 100644 tools/gnusb/firmware/usbdrv/usbdrvasm12.S delete mode 100644 tools/gnusb/firmware/usbdrv/usbdrvasm15.S delete mode 100644 tools/gnusb/firmware/usbdrv/usbdrvasm16.S delete mode 100644 tools/gnusb/firmware/usbdrv/usbdrvasm165.S delete mode 100644 tools/gnusb/maxmsp/Contents/MacOS/libusb.dylib delete mode 100644 tools/gnusb/maxmsp/Info.plist delete mode 100644 tools/gnusb/maxmsp/Makefile delete mode 100644 tools/gnusb/maxmsp/gnusb.c delete mode 100644 tools/gnusb/maxmsp/gnusb.help delete mode 100644 tools/gnusb/maxmsp/gnusb.xcodeproj/anyma.mode1 delete mode 100644 tools/gnusb/maxmsp/gnusb.xcodeproj/anyma.pbxuser delete mode 100644 tools/gnusb/maxmsp/gnusb.xcodeproj/me.mode1 delete mode 100644 tools/gnusb/maxmsp/gnusb.xcodeproj/me.pbxuser delete mode 100644 tools/gnusb/maxmsp/gnusb.xcodeproj/project.pbxproj delete mode 100644 tools/gnusb/puredata/gnusb.c delete mode 100644 tools/gnusb/puredata/gnusb.help.pd delete mode 100644 tools/gnusb/puredata/m_imp.h delete mode 100644 tools/gnusb/puredata/m_pd.h delete mode 100644 tools/gnusb/puredata/makefile delete mode 100644 tools/gnusb/puredata/makefile_mac delete mode 100644 tools/gnusb/puredata/makefile_other delete mode 100644 tools/pyusb/PKG-INFO delete mode 100644 tools/pyusb/README delete mode 100644 tools/pyusb/license.txt delete mode 100644 tools/pyusb/pyusb.c delete mode 100644 tools/pyusb/pyusb.h delete mode 100644 tools/pyusb/pyusb.sln delete mode 100644 tools/pyusb/samples/usbenum.py delete mode 100644 tools/pyusb/samples/usbprint.py delete mode 100644 tools/pyusb/setup.py diff --git a/tools/gnusb/bootloader/Readme.txt b/tools/gnusb/bootloader/Readme.txt deleted file mode 100644 index 91b5ed7..0000000 --- a/tools/gnusb/bootloader/Readme.txt +++ /dev/null @@ -1 +0,0 @@ -This is the README file for the uBOOT - a bootloader for the uDMX USB-DMX Interface version 1.2 ---------------------------------------------------------------------------------------- Like the uDMX, uBOOT is based on the open source firmware only usb driver by Objective Development. It shares the same hardware with the uDMX... Please see the Readme.txt file for the uDMX for details about licensing and more details ---------------------------------------------------------------------------------------- ------------------------ BASIC DESCRIPTION The uBOOT is a Bootloader application residing in the last 2k of the AVRs application flash memory with it's own usb driver. If you set the AVR fuse bits to 0xc8, 0xef: cd /udMX/sources/bootloader/firmware make fuse the Boot-Reset fuse gets set, so every time the AVR is powered up it jumps to the Bootloader address (1800) instead of the main program (0000). There we check if the jumper is set, or if a "soft jumper" is set in the EEPROM. If not, we jump to the main application, and the device initializes itself as a uDMX USB-DMX interface. The uDMX command line tool version 1.2 introduces the -bootloader option to set the soft jumper, as in ./udmx -bootloader If one of the above jumpers are set, the device starts the bootloader instead of the main application on power up and connects to the host computer as "uBOOT". Now we can start talking to the device using the uboot commandline tool: ./uboot -upload file_to_upload.hex upload hex file ./uboot -clear_flag clear softjumper ./uboot -leave leave bootloader and start application It might be wise to check the uploaded program first (just -leave), before clearing the soft jumper because if it is corrupted it won't be able to set the soft jumper anymore, no way to ever call the bootloader again, and you've locked yourself out of the (not functioning) device... ------------------------ INSTALLATION Make the uBOOT firmware and flash it to the device first cd bootloader/firmware/ make make fuse make flash Then you can either upload the uDMX.hex file using the ./uboot command line tool, or flash the hex file as usual with uisp, for example. Just make sure you don't use the --erase option, this would erase your bootloader... ------------------------ MORE INFORMATION For more information about uDMX please visit http://www.anyma.ch/research/udmx/ or contact research@anyma.ch For more information about Objective Development's firmware-only USB driver for Atmel's AVR microcontrollers please visit the URL http://www.obdev.at/products/avrusb/ A technical documentation of the driver's interface can be found in the file "firmware/usbdrv/usbdrv.h". uDMX is (c) 2006 [ a n y m a ], developed by Max & Michael Egger avrusb is (c) 2005, 2006 by OBJECTIVE DEVELOPMENT Software GmbH. http://www.obdev.at/ \ No newline at end of file diff --git a/tools/gnusb/bootloader/firmware/Makefile b/tools/gnusb/bootloader/firmware/Makefile deleted file mode 100644 index edb9391..0000000 --- a/tools/gnusb/bootloader/firmware/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -# Snesram -# 2009-05-06 davdi@optixx.org -# -# -# based on -# Project snesram_bootloader -# 2007-01-07 me@anyma.ch -# -# based on -# Makefile for AVRUSBBoot -# Modified by: Thomas Fischl -# Modified: 2006-06-25 - -# Original file by: Christian Starkjohann -# Creation Date: 2004-12-29 -# Tabsize: 4 -# Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH -# License: Proprietary, free under certain conditions. See Documentation. -# This Revision: $Id: Makefile 147 2006-03-01 17:33:03Z cs $ - -BOOTLOADER_ADDRESS = 3800 - -LDFLAGS += -Wl,--section-start=.text=$(BOOTLOADER_ADDRESS) - -UISP = uisp -dprog=stk500 -dserial=`echo /dev/tty.[Uu][Ss]*` -dpart=atmega16 - -# The two lines above are for "uisp" and the AVR910 serial programmer connected -# to a Keyspan USB to serial converter to a Mac running Mac OS X. -# Choose your favorite programmer and interface. - -COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega16 -#-DDEBUG_LEVEL=2 -# NEVER compile the final product with debugging! Any debug output will -# distort timing so that the specs can't be met. - -OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o snesram_bootloader.o -# Note that we link usbdrv.o first! This is required for correct alignment of -# driver-internal global variables! - - -# symbolic targets: -all: snesram_bootloader.hex - -.c.o: - $(COMPILE) -c $< -o $@ - -.S.o: - $(COMPILE) -x assembler-with-cpp -c $< -o $@ -# "-x assembler-with-cpp" should not be necessary since this is the default -# file type for the .S (with capital S) extension. However, upper case -# characters are not always preserved on Windows. To ensure WinAVR -# compatibility define the file type manually. - -.c.s: - $(COMPILE) -S $< -o $@ - -flash: all - $(UISP) --erase --upload --verify if=snesram_bootloader.hex -# $(UISP) --erase --upload if=snesram_bootloader.hex - -fuse: - $(UISP) --wr_fuse_h=0xc8 - $(UISP) --wr_fuse_l=0xef - -avrdude: - avrdude -c avr910 -p atmega8 -U flash:w:snesram_bootloader.hex - - -clean: - rm -f snesram_bootloader.hex snesram_bootloader.lst snesram_bootloader.obj snesram_bootloader.cof snesram_bootloader.list snesram_bootloader.map snesram_bootloader.eep.hex snesram_bootloader.bin *.o usbdrv/*.o snesram_bootloader.s usbdrv/oddebug.s usbdrv/usbdrv.s - -# file targets: -snesram_bootloader.bin: $(OBJECTS) - $(COMPILE) -o snesram_bootloader.bin $(OBJECTS) $(LDFLAGS) - -snesram_bootloader.hex: snesram_bootloader.bin - rm -f snesram_bootloader.hex snesram_bootloader.eep.hex - avr-objcopy -j .text -j .data -O ihex snesram_bootloader.bin snesram_bootloader.hex - ./checksize snesram_bootloader.bin -# do the checksize script as our last action to allow successful compilation -# on Windows with WinAVR where the Unix commands will fail. - -disasm: snesram_bootloader.bin - avr-objdump -d snesram_bootloader.bin - -cpp: - $(COMPILE) -E snesram_bootloader.c - -download: - $(UISP) --download diff --git a/tools/gnusb/bootloader/firmware/checksize b/tools/gnusb/bootloader/firmware/checksize deleted file mode 100644 index 5ca1c32..0000000 --- a/tools/gnusb/bootloader/firmware/checksize +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# Name: checksize -# Project: PowerSwitch/AVR-USB -# Author: Christian Starkjohann -# Creation Date: 2004-12-29 -# Tabsize: 4 -# Copyright: (c) 2005 OBJECTIVE DEVELOPMENT Software GmbH. -# Revision: $Id: checksize 83 2006-01-05 22:20:53Z cs $ - -error=0 -codelimit=2048 # default value -datalimit=96 # default value; leave 32 bytes for stack - -if [ $# -gt 1 ]; then - codelimit="$2" -fi -if [ $# -gt 2 ]; then - datalimit="$3" -fi - -set -- `avr-size -d "$1" | awk '/[0-9]/ {print $1 + $2, $2 + $3, $2}'` -if [ $1 -gt $codelimit ]; then - echo "*** code size $1 exceeds limit of $codelimit" - error=1 -else - echo "ROM: $1 bytes (data=$3)" -fi -if [ $2 -gt $datalimit ]; then - echo "*** data size $2 exceeds limit of $datalimit" - error=1 -else - echo "RAM: $2 bytes" -fi - -exit $error diff --git a/tools/gnusb/bootloader/firmware/snesram_bootloader.c b/tools/gnusb/bootloader/firmware/snesram_bootloader.c deleted file mode 100644 index ab1f3f9..0000000 --- a/tools/gnusb/bootloader/firmware/snesram_bootloader.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * ===================================================================================== - * - * Filename: snesram_bootloader.c - * - * Description: - * - * Version: 1.0 - * Created: 05/06/2009 03:06:26 PM - * Revision: none - * Compiler: gcc - * - * Author: David Voswinkel (DV), david@optixx.org - * Company: Optixx - - * inspired by - * AVRUSBBoot - USB bootloader for Atmel AVR controllers - * Thomas Fischl - * - * ===================================================================================== - */ - -#include -#include -#include -#include -#include - -#include "usbdrv.h" -#include "../usb_cmds.h" - -#define SNESRAM_BOOT_SOFTJUMPER_ADDRESS 0x05 -#define SNESRAM_BOOT_SOFTJUMPER 0xd9 - - -static uchar replyBuffer[8]; // reply buffer for USB -static unsigned int page; // address of page we're currently writing to -static unsigned int byte_counter; // address of next byte to write to -static uchar ready; - -void (*jump_to_app) (void) = 0x0000; - -void leaveBootloader() -{ - cli(); - boot_rww_enable(); - GICR = (1 << IVCE); /* enable change of interrupt vectors */ - GICR = (0 << IVSEL); /* move interrupts to application flash section */ - jump_to_app(); -} - -void writePage(void) -{ - PORTD ^= (1 << 5); // Toggle yellow led - - eeprom_busy_wait(); - - cli(); - boot_page_erase(page); // erase page - boot_spm_busy_wait(); // wait until page is erased - boot_page_write(page); // Store buffer in flash page. - boot_spm_busy_wait(); // Wait until the memory is written. - sei(); - - byte_counter = 0; - page += SPM_PAGESIZE; -} - -uchar usbFunctionSetup(uchar data[8]) -{ - uchar len = 0; - - usbMsgPtr = replyBuffer; - - if (data[1] == SNESRAM_BOOT_CMD_LEAVE) { - usbDeviceDisconnect(); - leaveBootloader(); - - } else if (data[1] == SNESRAM_BOOT_CMD_START) { - page = 0; - byte_counter = 0; - ready = 1; - } else if (data[1] == SNESRAM_BOOT_CMD_STATUS) { - - if (byte_counter >= SPM_PAGESIZE) { - writePage(); - } - replyBuffer[0] = ready; - len = 1; - - } else if (data[1] == SNESRAM_BOOT_CMD_WRITE) { - - replyBuffer[0] = data[2]; - replyBuffer[1] = data[3]; - len = 2; - - cli(); - boot_page_fill(page + byte_counter, data[3] | (data[2] << 8)); - sei(); - - byte_counter += 2; - - } else if (data[1] == SNESRAM_BOOT_CMD_FINISH) { - if (byte_counter) { - writePage(); - } - ready = 0; - PORTD &= ~(1 << 5); // Light yellow Led - - } else if (data[1] == SNESRAM_BOOT_CMD_CLEAR_FLAG) { - - while (EECR & (1 << EEWE)) ; - // write 00 to eeprom - EEARL = SNESRAM_BOOT_SOFTJUMPER_ADDRESS; - EEDR = 0x00; - cli(); - EECR |= 1 << EEMWE; - EECR |= 1 << EEWE; // must follow within a couple of cycles -- therefore cli() - sei(); - - } - - return len; -} - -int main(void) -{ - // set PORT D Directions -> 1110 0000, output 0 on USB pullup PD7 - DDRD = 0xe0; // 1110 0000 -> set PD0..PD4 to inputs -> USB pins - PORTD = 0x70; // 0111 0000 -> set Pullup for Bootloader Jumper, no pullups on USB pins - - // see if hardware jumper is set - if (!((PIND & (1 << 4)) == 0)) { - - // no jumper, let's see if we have softjumper flag in EEPROM - while (EECR & (1 << EEWE)) ; - EEARL = SNESRAM_BOOT_SOFTJUMPER_ADDRESS; - EECR |= 1 << EERE; - if (EEDR != SNESRAM_BOOT_SOFTJUMPER) - leaveBootloader(); - } - - GICR = (1 << IVCE); // enable change of interrupt vectors - GICR = (1 << IVSEL); // move interrupts to boot flash section - - uchar i, j; - PORTD = 0xd0; // 1101 0000 -> pull up pd7 for device connect, pullup on jumper, light yellow led to show we're in bootloader - DDRD = 0xe3; // 1110 0011 -> set USB pins to output -> SE0 - j = 0; - while (--j) { - i = 0; - while (--i) ; // delay >10ms for USB reset - } - - DDRD = 0xe0; // 1110 0000 -> set USB pins to input - - usbInit(); - sei(); // turn on interrupts - - while (1) { // main event loop - usbPoll(); - } - return 0; -} diff --git a/tools/gnusb/bootloader/firmware/usbconfig.h b/tools/gnusb/bootloader/firmware/usbconfig.h deleted file mode 100644 index ad0509b..0000000 --- a/tools/gnusb/bootloader/firmware/usbconfig.h +++ /dev/null @@ -1,163 +0,0 @@ -/* Name: usbconfig.h - * Project: AVR USB driver - * Author: Christian Starkjohann - * Creation Date: 2005-04-01 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: Proprietary, free under certain conditions. See Documentation. - * This Revision: $Id: usbconfig.h 43 2005-04-10 21:04:36Z cs $ - */ - -#ifndef __usbconfig_h_included__ -#define __usbconfig_h_included__ - -/* -General Description: -This file contains parts of the USB driver which can be configured and can or -must be adapted to your hardware. - -Please note that the usbdrv contains a usbconfig-prototype.h file now. We -recommend that you use that file as a template because it will always list -the newest features and options. -*/ - -/* ---------------------------- Hardware Config ---------------------------- */ - -#define USB_CFG_IOPORTNAME D -/* This is the port where the USB bus is connected. When you configure it to - * "PORTB", the registers PORTB, PINB (=PORTB-2) and DDRB (=PORTB-1) will be - * used. - */ -#define USB_CFG_DMINUS_BIT 0 -/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. - * This MUST be bit 0 or 7. All other values will result in a compile error! - */ -#define USB_CFG_DPLUS_BIT 1 -/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. - * This may be any bit in the port. Please note that D+ must also be connected - * to interrupt pin INT0! - */ - - #define USB_CFG_PULLUP_IOPORTNAME D -/* This is the port where the USB D- pullup resistor is connected. When you - * configure it to "PORTB", the registers PORTB and DDRB (=PORTB-1) will be - * used. If this constant is defined, the macros usbDeviceConnect() and - * usbDeviceDisconnect will be available. - */ - #define USB_CFG_PULLUP_BIT 7 -/* This is the bit number in USB_CFG_PULLUP_IOPORT where the USB D- 1.5 kOhm - * pullup resistor is connected instead of VBUS. This may be any bit in - * the port. - */ - -/* --------------------------- Functional Range ---------------------------- */ - -#define USB_CFG_HAVE_INTRIN_ENDPOINT 0 -/* Define this to 1 if you want to compile a version with two endpoints: The - * default control endpoint 0 and an interrupt-in endpoint 1. - */ -#define USB_CFG_IMPLEMENT_HALT 0 -/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature - * for endpoint 1 (interrupt endpoint). Although you may not need this feature, - * it is required by the standard. We have made it a config option because it - * bloats the code considerably. - */ -#define USB_CFG_INTR_POLL_INTERVAL 10 -/* If you compile a version with endpoint 1 (interrupt-in), this is the poll - * interval. The value is in milliseconds and must not be less than 10 ms for - * low speed devices. - */ -#define USB_CFG_IS_SELF_POWERED 0 -/* Define this to 1 if the device has its own power supply. Set it to 0 if the - * device is powered from the USB bus. - */ -#define USB_CFG_MAX_BUS_POWER 300 -/* Set this variable to the maximum USB bus power consumption of your device. - * The value is in milliamperes. [It will be divided by two since USB - * communicates power requirements in units of 2 mA.] - */ -#define USB_CFG_SAMPLE_EXACT 0 -/* This variable affects Sampling Jitter for USB receiving. When it is 0, the - * driver guarantees a sampling window of 1/2 bit. The USB spec requires - * that the receiver has at most 1/4 bit sampling window. The 1/2 bit window - * should still work reliably enough because we work at low speed. If you want - * to meet the spec, set this value to 1. This will unroll a loop which - * results in bigger code size. - * If you have problems with long cables, try setting this value to 1. - */ -#define USB_CFG_IMPLEMENT_FN_WRITE 0 -/* Set this to 1 if you want usbFunctionWrite() to be called for control-out - * transfers. Set it to 0 if you don't need it and want to save a couple of - * bytes. - */ -#define USB_CFG_IMPLEMENT_FN_READ 0 -/* Set this to 1 if you need to send control replies which are generated - * "on the fly" when usbFunctionRead() is called. If you only want to send - * data from a static buffer, set it to 0 and return the data from - * usbFunctionSetup(). This saves a couple of bytes. - */ - -/* -------------------------- Device Description --------------------------- */ - -#define USB_CFG_VENDOR_ID 0xc0, 0x16 /* 5824 in dec, stands for VOTI */ -/* USB vendor ID for the device, low byte first. If you have registered your - * own Vendor ID, define it here. Otherwise you use obdev's free shared - * VID/PID pair. Be sure to read USBID-License.txt for rules! - */ -#define USB_CFG_DEVICE_ID 0xdc, 0x05 /* 1500 in dec, obdev's free PID */ -/* This is the ID of the product, low byte first. It is interpreted in the - * scope of the vendor ID. If you have registered your own VID with usb.org - * or if you have licensed a PID from somebody else, define it here. Otherwise - * you use obdev's free shared VID/PID pair. Be sure to read the rules in - * USBID-License.txt! - */ -#define USB_CFG_DEVICE_VERSION 0x00, 0x01 -/* Version number of the device: Minor number first, then major number. - */ -#define USB_CFG_VENDOR_NAME 'w', 'w', 'w', '.', 'a', 'n', 'y', 'm', 'a', '.', 'c', 'h' -#define USB_CFG_VENDOR_NAME_LEN 12 -/* These two values define the vendor name returned by the USB device. The name - * must be given as a list of characters under single quotes. The characters - * are interpreted as Unicode (UTF-16) entities. - * If you don't want a vendor name string, undefine these macros. - * ALWAYS define a vendor name containing your Internet domain name if you use - * obdev's free shared VID/PID pair. See the file USBID-License.txt for - * details. - */ -#define USB_CFG_DEVICE_NAME 'g', 'n', 'u', 's','b','o','o','t' -#define USB_CFG_DEVICE_NAME_LEN 8 -/* Same as above for the device name. If you don't want a device name, undefine - * the macros. See the file USBID-License.txt before you assign a name. - */ -#define USB_CFG_SERIAL_NUMBER_LENGTH 0 -/* Set this define to the number of charcters in the serial number if your - * device should have a serial number to uniquely identify each hardware - * instance. You must supply the serial number in a string descriptor with the - * name "usbCfgSerialNumberStringDescriptor", e.g.: - * #define USB_CFG_SERIAL_NUMBER_LENGTH 5 - * int usbCfgSerialNumberStringDescriptor[] PROGMEM = { - * USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LENGTH), - * '1', '2', '3', '4', '5' - * }; - * See usbdrv.h for more information about the USB_STRING_DESCRIPTOR_HEADER() - * macro or usbdrv.c for example string descriptors. - * You may want to put "usbCfgSerialNumberStringDescriptor" at a constant - * flash memory address (with magic linker commands) so that you don't need - * to recompile if you change it. - */ -#define USB_CFG_DEVICE_CLASS 0xff -#define USB_CFG_DEVICE_SUBCLASS 0 -/* See USB specification if you want to conform to an existing device class. - */ -#define USB_CFG_INTERFACE_CLASS 0 -#define USB_CFG_INTERFACE_SUBCLASS 0 -#define USB_CFG_INTERFACE_PROTOCOL 0 -/* See USB specification if you want to conform to an existing device class or - * protocol. - */ -#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0 /* total length of report descriptor */ -/* Define this to the length of the HID report descriptor, if you implement - * an HID device. Otherwise don't define it or define it to 0. - */ - -#endif /* __usbconfig_h_included__ */ diff --git a/tools/gnusb/bootloader/firmware/usbdrv/Changelog.txt b/tools/gnusb/bootloader/firmware/usbdrv/Changelog.txt deleted file mode 100644 index 041268e..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/Changelog.txt +++ /dev/null @@ -1,277 +0,0 @@ -This file documents changes in the firmware-only USB driver for atmel's AVR -microcontrollers. New entries are always appended to the end of the file. -Scroll down to the bottom to see the most recent changes. - -2005-04-01: - - Implemented endpoint 1 as interrupt-in endpoint. - - Moved all configuration options to usbconfig.h which is not part of the - driver. - - Changed interface for usbVendorSetup(). - - Fixed compatibility with ATMega8 device. - - Various minor optimizations. - -2005-04-11: - - Changed interface to application: Use usbFunctionSetup(), usbFunctionRead() - and usbFunctionWrite() now. Added configuration options to choose which - of these functions to compile in. - - Assembler module delivers receive data non-inverted now. - - Made register and bit names compatible with more AVR devices. - -2005-05-03: - - Allow address of usbRxBuf on any memory page as long as the buffer does - not cross 256 byte page boundaries. - - Better device compatibility: works with Mega88 now. - - Code optimization in debugging module. - - Documentation updates. - -2006-01-02: - - Added (free) default Vendor- and Product-IDs bought from voti.nl. - - Added USBID-License.txt file which defines the rules for using the free - shared VID/PID pair. - - Added Readme.txt to the usbdrv directory which clarifies administrative - issues. - -2006-01-25: - - Added "configured state" to become more standards compliant. - - Added "HALT" state for interrupt endpoint. - - Driver passes the "USB Command Verifier" test from usb.org now. - - Made "serial number" a configuration option. - - Minor optimizations, we now recommend compiler option "-Os" for best - results. - - Added a version number to usbdrv.h - -2006-02-03: - - New configuration variable USB_BUFFER_SECTION for the memory section where - the USB rx buffer will go. This defaults to ".bss" if not defined. Since - this buffer MUST NOT cross 256 byte pages (not even touch a page at the - end), the user may want to pass a linker option similar to - "-Wl,--section-start=.mybuffer=0x800060". - - Provide structure for usbRequest_t. - - New defines for USB constants. - - Prepared for HID implementations. - - Increased data size limit for interrupt transfers to 8 bytes. - - New macro usbInterruptIsReady() to query interrupt buffer state. - -2006-02-18: - - Ensure that the data token which is sent as an ack to an OUT transfer is - always zero sized. This fixes a bug where the host reports an error after - sending an out transfer to the device, although all data arrived at the - device. - - Updated docs in usbdrv.h to reflect changed API in usbFunctionWrite(). - -* Release 2006-02-20 - - - Give a compiler warning when compiling with debugging turned on. - - Added Oleg Semyonov's changes for IAR-cc compatibility. - - Added new (optional) functions usbDeviceConnect() and usbDeviceDisconnect() - (also thanks to Oleg!). - - Rearranged tests in usbPoll() to save a couple of instructions in the most - likely case that no actions are pending. - - We need a delay between the SET ADDRESS request until the new address - becomes active. This delay was handled in usbPoll() until now. Since the - spec says that the delay must not exceed 2ms, previous versions required - aggressive polling during the enumeration phase. We have now moved the - handling of the delay into the interrupt routine. - - We must not reply with NAK to a SETUP transaction. We can only achieve this - by making sure that the rx buffer is empty when SETUP tokens are expected. - We therefore don't pass zero sized data packets from the status phase of - a transfer to usbPoll(). This change MAY cause troubles if you rely on - receiving a less than 8 bytes long packet in usbFunctionWrite() to - identify the end of a transfer. usbFunctionWrite() will NEVER be called - with a zero length. - -* Release 2006-03-14 - - - Improved IAR C support: tiny memory model, more devices - - Added template usbconfig.h file under the name usbconfig-prototype.h - -* Release 2006-03-26 - - - Added provision for one more interrupt-in endpoint (endpoint 3). - - Added provision for one interrupt-out endpoint (endpoint 1). - - Added flowcontrol macros for USB. - - Added provision for custom configuration descriptor. - - Allow ANY two port bits for D+ and D-. - - Merged (optional) receive endpoint number into global usbRxToken variable. - - Use USB_CFG_IOPORTNAME instead of USB_CFG_IOPORT. We now construct the - variable name from the single port letter instead of computing the address - of related ports from the output-port address. - -* Release 2006-06-26 - - - Updated documentation in usbdrv.h and usbconfig-prototype.h to reflect the - new features. - - Removed "#warning" directives because IAR does not understand them. Use - unused static variables instead to generate a warning. - - Do not include when compiling with IAR. - - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each - USB descriptor should be handled. It is now possible to provide descriptor - data in Flash, RAM or dynamically at runtime. - - STALL is now a status in usbTxLen* instead of a message. We can now conform - to the spec and leave the stall status pending until it is cleared. - - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the - application code to reset data toggling on interrupt pipes. - -* Release 2006-07-18 - - - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes - an assembler error. - - usbDeviceDisconnect() takes pull-up resistor to high impedance now. - -* Release 2007-02-01 - - - Merged in some code size improvements from usbtiny (thanks to Dick - Streefland for these optimizations!) - - Special alignment requirement for usbRxBuf not required any more. Thanks - again to Dick Streefland for this hint! - - Reverted to "#warning" instead of unused static variables -- new versions - of IAR CC should handle this directive. - - Changed Open Source license to GNU GPL v2 in order to make linking against - other free libraries easier. We no longer require publication of the - circuit diagrams, but we STRONGLY encourage it. If you improve the driver - itself, PLEASE grant us a royalty free license to your changes for our - commercial license. - -* Release 2007-03-29 - - - New configuration option "USB_PUBLIC" in usbconfig.h. - - Set USB version number to 1.10 instead of 1.01. - - Code used USB_CFG_DESCR_PROPS_STRING_DEVICE and - USB_CFG_DESCR_PROPS_STRING_PRODUCT inconsistently. Changed all occurrences - to USB_CFG_DESCR_PROPS_STRING_PRODUCT. - - New assembler module for 16.5 MHz RC oscillator clock with PLL in receiver - code. - - New assembler module for 16 MHz crystal. - - usbdrvasm.S contains common code only, clock-specific parts have been moved - to usbdrvasm12.S, usbdrvasm16.S and usbdrvasm165.S respectively. - -* Release 2007-06-25 - - - 16 MHz module: Do SE0 check in stuffed bits as well. - -* Release 2007-07-07 - - - Define hi8(x) for IAR compiler to limit result to 8 bits. This is necessary - for negative values. - - Added 15 MHz module contributed by V. Bosch. - - Interrupt vector name can now be configured. This is useful if somebody - wants to use a different hardware interrupt than INT0. - -* Release 2007-08-07 - - - Moved handleIn3 routine in usbdrvasm16.S so that relative jump range is - not exceeded. - - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN, - USB_COUNT_SOF - - USB_INTR_PENDING can now be a memory address, not just I/O - -* Release 2007-09-19 - - - Split out common parts of assembler modules into separate include file - - Made endpoint numbers configurable so that given interface definitions - can be matched. See USB_CFG_EP3_NUMBER in usbconfig-prototype.h. - - Store endpoint number for interrupt/bulk-out so that usbFunctionWriteOut() - can handle any number of endpoints. - - Define usbDeviceConnect() and usbDeviceDisconnect() even if no - USB_CFG_PULLUP_IOPORTNAME is defined. Directly set D+ and D- to 0 in this - case. - -* Release 2007-12-01 - - - Optimize usbDeviceConnect() and usbDeviceDisconnect() for less code size - when USB_CFG_PULLUP_IOPORTNAME is not defined. - -* Release 2007-12-13 - - - Renamed all include-only assembler modules from *.S to *.inc so that - people don't add them to their project sources. - - Distribute leap bits in tx loop more evenly for 16 MHz module. - - Use "macro" and "endm" instead of ".macro" and ".endm" for IAR - - Avoid compiler warnings for constant expr range by casting some values in - USB descriptors. - -* Release 2008-01-21 - - - Fixed bug in 15 and 16 MHz module where the new address set with - SET_ADDRESS was already accepted at the next NAK or ACK we send, not at - the next data packet we send. This caused problems when the host polled - too fast. Thanks to Alexander Neumann for his help and patience debugging - this issue! - -* Release 2008-02-05 - - - Fixed bug in 16.5 MHz module where a register was used in the interrupt - handler before it was pushed. This bug was introduced with version - 2007-09-19 when common parts were moved to a separate file. - - Optimized CRC routine (thanks to Reimar Doeffinger). - -* Release 2008-02-16 - - - Removed outdated IAR compatibility stuff (code sections). - - Added hook macros for USB_RESET_HOOK() and USB_SET_ADDRESS_HOOK(). - - Added optional routine usbMeasureFrameLength() for calibration of the - internal RC oscillator. - -* Release 2008-02-28 - - - USB_INITIAL_DATATOKEN defaults to USBPID_DATA1 now, which means that we - start with sending USBPID_DATA0. - - Changed defaults in usbconfig-prototype.h - - Added free USB VID/PID pair for MIDI class devices - - Restructured AVR-USB as separate package, not part of PowerSwitch any more. - -* Release 2008-04-18 - - - Restructured usbdrv.c so that it is easier to read and understand. - - Better code optimization with gcc 4. - - If a second interrupt in endpoint is enabled, also add it to config - descriptor. - - Added config option for long transfers (above 254 bytes), see - USB_CFG_LONG_TRANSFERS in usbconfig.h. - - Added 20 MHz module contributed by Jeroen Benschop. - -* Release 2008-05-13 - - - Fixed bug in libs-host/hiddata.c function usbhidGetReport(): length - was not incremented, pointer to length was incremented instead. - - Added code to command line tool(s) which claims an interface. This code - is disabled by default, but may be necessary on newer Linux kernels. - - Added usbconfig.h option "USB_CFG_CHECK_DATA_TOGGLING". - - New header "usbportability.h" prepares ports to other development - environments. - - Long transfers (above 254 bytes) did not work when usbFunctionRead() was - used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!] - - In hiddata.c (example code for sending/receiving data over HID), use - USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE for control transfers so - that we need not claim the interface. - - in usbPoll() loop 20 times polling for RESET state instead of 10 times. - This accounts for the higher clock rates we now support. - - Added a module for 12.8 MHz RC oscillator with PLL in receiver loop. - - Added hook to SOF code so that oscillator can be tuned to USB frame clock. - - Added timeout to waitForJ loop. Helps preventing unexpected hangs. - - Added example code for oscillator tuning to libs-device (thanks to - Henrik Haftmann for the idea to this routine). - - Implemented option USB_CFG_SUPPRESS_INTR_CODE. - -* Release 2008-10-22 - - - Fixed libs-device/osctune.h: OSCCAL is memory address on ATMega88 and - similar, not offset of 0x20 needs to be added. - - Allow distribution under GPLv3 for those who have to link against other - code distributed under GPLv3. - -* Release 2008-11-26 - - - Removed libusb-win32 dependency for hid-data example in Makefile.windows. - It was never required and confused many people. - - Added extern uchar usbRxToken to usbdrv.h. - - Integrated a module with CRC checks at 18 MHz by Lukas Schrittwieser. - -* Release 2009-03-23 - - - Hid-mouse example used settings from hid-data example, fixed that. - - Renamed project to V-USB due to a trademark issue with Atmel(r). - - Changed CommercialLicense.txt and USBID-License.txt to make the - background of USB ID registration clearer. - -* Release 2009-04-15 diff --git a/tools/gnusb/bootloader/firmware/usbdrv/CommercialLicense.txt b/tools/gnusb/bootloader/firmware/usbdrv/CommercialLicense.txt deleted file mode 100644 index 33c9311..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/CommercialLicense.txt +++ /dev/null @@ -1,157 +0,0 @@ -V-USB Driver Software License Agreement -Version 2009-04-14 - -THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN -ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING -THE AMOUNT ACCORDING TO SECTION 4 ("PAYMENT") TO OBJECTIVE DEVELOPMENT. - - -1 DEFINITIONS - -1.1 "OBJECTIVE DEVELOPMENT" shall mean OBJECTIVE DEVELOPMENT Software GmbH, -Grosse Schiffgasse 1A/7, 1020 Wien, AUSTRIA. - -1.2 "You" shall mean the Licensee. - -1.3 "V-USB" shall mean all files included in the package distributed under -the name "vusb" by OBJECTIVE DEVELOPMENT (http://www.obdev.at/vusb/) -unless otherwise noted. This includes the firmware-only USB device -implementation for Atmel AVR microcontrollers, some simple device examples -and host side software examples and libraries. - - -2 LICENSE GRANTS - -2.1 Source Code. OBJECTIVE DEVELOPMENT shall furnish you with the source -code of V-USB. - -2.2 Distribution and Use. OBJECTIVE DEVELOPMENT grants you the -non-exclusive right to use, copy and distribute V-USB with your hardware -product(s), restricted by the limitations in section 3 below. - -2.3 Modifications. OBJECTIVE DEVELOPMENT grants you the right to modify -the source code and your copy of V-USB according to your needs. - -2.4 USB IDs. OBJECTIVE DEVELOPMENT furnishes you with one or two USB Product -ID(s), sent to you in e-mail. These Product IDs are reserved exclusively for -you. They have been obtained from Wouter van Ooijen (www.voti.nl), who has -reserved the Vendor ID 5824 (decimal) at the USB Implementers Forum, Inc. -(www.usb.org). This mechanism ensures that there are no Product ID conflicts, -but you cannot become USB certified (enter into the USB-IF Trademark License -Agreement) as you would need your own Vendor ID for that. - - -3 LICENSE RESTRICTIONS - -3.1 Number of Units. Only one of the following three definitions is -applicable. Which one is determined by the amount you pay to OBJECTIVE -DEVELOPMENT, see section 4 ("Payment") below. - -Hobby License: You may use V-USB according to section 2 above in no more -than 5 hardware units. These units must not be sold for profit. - -Entry Level License: You may use V-USB according to section 2 above in no -more than 150 hardware units. - -Professional License: You may use V-USB according to section 2 above in -any number of hardware units, except for large scale production ("unlimited -fair use"). Quantities below 10,000 units are not considered large scale -production. If your reach quantities which are obviously large scale -production, you must pay a license fee of 0.10 EUR per unit for all units -above 10,000. - -3.2 Rental. You may not rent, lease, or lend V-USB or otherwise encumber -any copy of V-USB, or any of the rights granted herein. - -3.3 Transfer. You may not transfer your rights under this Agreement to -another party without OBJECTIVE DEVELOPMENT's prior written consent. If -such consent is obtained, you may permanently transfer this License to -another party. The recipient of such transfer must agree to all terms and -conditions of this Agreement. - -3.4 Reservation of Rights. OBJECTIVE DEVELOPMENT retains all rights not -expressly granted. - -3.5 Non-Exclusive Rights. Your license rights under this Agreement are -non-exclusive. - -3.6 Third Party Rights. This Agreement cannot grant you rights controlled -by third parties. In particular, you are not allowed to use the USB logo or -other trademarks owned by the USB Implementers Forum, Inc. without their -consent. Since such consent depends on USB certification, it should be -noted that V-USB will not pass certification because it does not -implement checksum verification and the microcontroller ports do not meet -the electrical specifications. - - -4 PAYMENT - -The payment amount depends on the variation of this agreement (according to -section 3.1) into which you want to enter. Concrete prices are listed on -OBJECTIVE DEVELOPMENT's web site, usually at -http://www.obdev.at/vusb/license.html. You agree to pay the amount listed -there to OBJECTIVE DEVELOPMENT or OBJECTIVE DEVELOPMENT's payment processor -or reseller. - - -5 COPYRIGHT AND OWNERSHIP - -V-USB is protected by copyright laws and international copyright -treaties, as well as other intellectual property laws and treaties. V-USB -is licensed, not sold. - - -6 TERM AND TERMINATION - -6.1 Term. This Agreement shall continue indefinitely. However, OBJECTIVE -DEVELOPMENT may terminate this Agreement and revoke the granted license and -USB-IDs if you fail to comply with any of its terms and conditions. - -6.2 Survival of Terms. All provisions regarding secrecy, confidentiality -and limitation of liability shall survive termination of this agreement. - - -7 DISCLAIMER OF WARRANTY AND LIABILITY - -LIMITED WARRANTY. V-USB IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, OBJECTIVE -DEVELOPMENT AND ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND -NON-INFRINGEMENT, WITH REGARD TO V-USB, AND THE PROVISION OF OR FAILURE -TO PROVIDE SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL -RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO -STATE/JURISDICTION. - -LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, -IN NO EVENT SHALL OBJECTIVE DEVELOPMENT OR ITS SUPPLIERS BE LIABLE FOR ANY -SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER -(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, -BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY -LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE V-USB OR THE -PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIVE -DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY -CASE, OBJECTIVE DEVELOPMENT'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS -AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR V-USB. - - -8 MISCELLANEOUS TERMS - -8.1 Marketing. OBJECTIVE DEVELOPMENT has the right to mention for marketing -purposes that you entered into this agreement. - -8.2 Entire Agreement. This document represents the entire agreement between -OBJECTIVE DEVELOPMENT and you. It may only be modified in writing signed by -an authorized representative of both, OBJECTIVE DEVELOPMENT and you. - -8.3 Severability. In case a provision of these terms and conditions should -be or become partly or entirely invalid, ineffective, or not executable, -the validity of all other provisions shall not be affected. - -8.4 Applicable Law. This agreement is governed by the laws of the Republic -of Austria. - -8.5 Responsible Courts. The responsible courts in Vienna/Austria will have -exclusive jurisdiction regarding all disputes in connection with this -agreement. - diff --git a/tools/gnusb/bootloader/firmware/usbdrv/License.txt b/tools/gnusb/bootloader/firmware/usbdrv/License.txt deleted file mode 100644 index 4460cfb..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/License.txt +++ /dev/null @@ -1,361 +0,0 @@ -OBJECTIVE DEVELOPMENT GmbH's V-USB driver software is distributed under the -terms and conditions of the GNU GPL version 2 or the GNU GPL version 3. It is -your choice whether you apply the terms of version 2 or version 3. The full -text of GPLv2 is included below. In addition to the requirements in the GPL, -we STRONGLY ENCOURAGE you to do the following: - -(1) Publish your entire project on a web site and drop us a note with the URL. -Use the form at http://www.obdev.at/vusb/feedback.html for your submission. - -(2) Adhere to minimum publication standards. Please include AT LEAST: - - a circuit diagram in PDF, PNG or GIF format - - full source code for the host software - - a Readme.txt file in ASCII format which describes the purpose of the - project and what can be found in which directories and which files - - a reference to http://www.obdev.at/vusb/ - -(3) If you improve the driver firmware itself, please give us a free license -to your modifications for our commercial license offerings. - - - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/tools/gnusb/bootloader/firmware/usbdrv/Readme.txt b/tools/gnusb/bootloader/firmware/usbdrv/Readme.txt deleted file mode 100644 index aade7c0..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/Readme.txt +++ /dev/null @@ -1,158 +0,0 @@ -This is the Readme file to Objective Development's firmware-only USB driver -for Atmel AVR microcontrollers. For more information please visit -http://www.obdev.at/vusb/ - -This directory contains the USB firmware only. Copy it as-is to your own -project and add all .c and .S files to your project (these files are marked -with an asterisk in the list below). Then copy usbconfig-prototype.h as -usbconfig.h to your project and edit it according to your configuration. - - -TECHNICAL DOCUMENTATION -======================= -The technical documentation (API) for the firmware driver is contained in the -file "usbdrv.h". Please read all of it carefully! Configuration options are -documented in "usbconfig-prototype.h". - -The driver consists of the following files: - Readme.txt ............. The file you are currently reading. - Changelog.txt .......... Release notes for all versions of the driver. - usbdrv.h ............... Driver interface definitions and technical docs. -* usbdrv.c ............... High level language part of the driver. Link this - module to your code! -* usbdrvasm.S ............ Assembler part of the driver. This module is mostly - a stub and includes one of the usbdrvasm*.S files - depending on processor clock. Link this module to - your code! - usbdrvasm*.inc ......... Assembler routines for particular clock frequencies. - Included by usbdrvasm.S, don't link it directly! - asmcommon.inc .......... Common assembler routines. Included by - usbdrvasm*.inc, don't link it directly! - usbconfig-prototype.h .. Prototype for your own usbdrv.h file. -* oddebug.c .............. Debug functions. Only used when DEBUG_LEVEL is - defined to a value greater than 0. Link this module - to your code! - oddebug.h .............. Interface definitions of the debug module. - usbportability.h ....... Header with compiler-dependent stuff. - usbdrvasm.asm .......... Compatibility stub for IAR-C-compiler. Use this - module instead of usbdrvasm.S when you assembler - with IAR's tools. - License.txt ............ Open Source license for this driver. - CommercialLicense.txt .. Optional commercial license for this driver. - USBID-License.txt ...... Terms and conditions for using particular USB ID - values for particular purposes. - -(*) ... These files should be linked to your project. - - -CPU CORE CLOCK FREQUENCY -======================== -We supply assembler modules for clock frequencies of 12 MHz, 12.8 MHz, 15 MHz, -16 MHz, 16.5 MHz 18 MHz and 20 MHz. Other clock rates are not supported. The -actual clock rate must be configured in usbdrv.h unless you use the default -12 MHz. - -12 MHz Clock -This is the traditional clock rate of V-USB because it's the lowest clock -rate where the timing constraints of the USB spec can be met. - -15 MHz Clock -Similar to 12 MHz, but some NOPs inserted. On the other hand, the higher clock -rate allows for some loops which make the resulting code size somewhat smaller -than the 12 MHz version. - -16 MHz Clock -This clock rate has been added for users of the Arduino board and other -ready-made boards which come with a fixed 16 MHz crystal. It's also an option -if you need the slightly higher clock rate for performance reasons. Since -16 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code -is somewhat tricky and has to insert a leap cycle every third byte. - -12.8 MHz and 16.5 MHz Clock -The assembler modules for these clock rates differ from the other modules -because they have been built for an RC oscillator with only 1% precision. The -receiver code inserts leap cycles to compensate for clock deviations. 1% is -also the precision which can be achieved by calibrating the internal RC -oscillator of the AVR. Please note that only AVRs with internal 64 MHz PLL -oscillator can reach 16.5 MHz with the RC oscillator. This includes the very -popular ATTiny25, ATTiny45, ATTiny85 series as well as the ATTiny26. Almost -all AVRs can reach 12.8 MHz, although this is outside the specified range. - -See the EasyLogger example at http://www.obdev.at/vusb/easylogger.html for -code which calibrates the RC oscillator based on the USB frame clock. - -18 MHz Clock -This module is closer to the USB specification because it performs an on the -fly CRC check for incoming packets. Packets with invalid checksum are -discarded as required by the spec. If you also implement checks for data -PID toggling on application level (see option USB_CFG_CHECK_DATA_TOGGLING -in usbconfig.h for more info), this ensures data integrity. Due to the CRC -tables and alignment requirements, this code is bigger than modules for other -clock rates. To activate this module, you must define USB_CFG_CHECK_CRC to 1 -and USB_CFG_CLOCK_KHZ to 18000 in usbconfig.h. - -20 MHz Clock -This module is for people who won't do it with less than the maximum. Since -20 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code -uses similar tricks as the 16 MHz module to insert leap cycles. - - -USB IDENTIFIERS -=============== -Every USB device needs a vendor- and a product-identifier (VID and PID). VIDs -are obtained from usb.org for a price of 1,500 USD. Once you have a VID, you -can assign PIDs at will. - -Since an entry level cost of 1,500 USD is too high for most small companies -and hobbyists, we provide some VID/PID pairs for free. See the file -USBID-License.txt for details. - -Objective Development also has some license offerings which include product -IDs. See http://www.obdev.at/vusb/ for details. - - -DEVELOPMENT SYSTEM -================== -This driver has been developed and optimized for the GNU compiler version 3 -(gcc 3). It does work well with gcc 4, but with bigger code size. We recommend -that you use the GNU compiler suite because it is freely available. V-USB -has also been ported to the IAR compiler and assembler. It has been tested -with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the "small" and "tiny" -memory model. Not every release is tested with IAR CC and the driver may -therefore fail to compile with IAR. Please note that gcc is more efficient for -usbdrv.c because this module has been deliberately optimized for gcc. - - -USING V-USB FOR FREE -==================== -The AVR firmware driver is published under the GNU General Public License -Version 2 (GPL2) and the GNU General Public License Version 3 (GPL3). It is -your choice whether you apply the terms of version 2 or version 3. - -If you decide for the free GPL2 or GPL3, we STRONGLY ENCOURAGE you to do the -following things IN ADDITION to the obligations from the GPL: - -(1) Publish your entire project on a web site and drop us a note with the URL. -Use the form at http://www.obdev.at/vusb/feedback.html for your submission. -If you don't have a web site, you can publish the project in obdev's -documentation wiki at -http://www.obdev.at/goto.php?t=vusb-wiki&p=hosted-projects. - -(2) Adhere to minimum publication standards. Please include AT LEAST: - - a circuit diagram in PDF, PNG or GIF format - - full source code for the host software - - a Readme.txt file in ASCII format which describes the purpose of the - project and what can be found in which directories and which files - - a reference to http://www.obdev.at/vusb/ - -(3) If you improve the driver firmware itself, please give us a free license -to your modifications for our commercial license offerings. - - -COMMERCIAL LICENSES FOR V-USB -============================= -If you don't want to publish your source code under the terms of the GPL, -you can simply pay money for V-USB. As an additional benefit you get -USB PIDs for free, reserved exclusively to you. See the file -"CommercialLicense.txt" for details. - diff --git a/tools/gnusb/bootloader/firmware/usbdrv/USBID-License.txt b/tools/gnusb/bootloader/firmware/usbdrv/USBID-License.txt deleted file mode 100644 index c40be92..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/USBID-License.txt +++ /dev/null @@ -1,154 +0,0 @@ -Royalty-Free Non-Exclusive Use of USB Product-IDs -================================================= - -Version 2009-04-13 - -Strictly speaking, this is not a license. You can't give a license to use -a simple number (such as e.g. 1500) for any purpose. This is a set of rules -which should make it possible to build USB devices without the requirement -for individual USB IDs. If you break one of the rules, you will run into -technical problems sooner or later, but you don't risk legal trouble. - - -OBJECTIVE DEVELOPMENT Software GmbH hereby grants you the non-exclusive -right to use four USB.org vendor-ID (VID) / product-ID (PID) pairs with -products based on Objective Development's firmware-only USB driver for -Atmel AVR microcontrollers: - - * VID = 5824 (=0x16c0) / PID = 1500 (=0x5dc) for devices implementing no - USB device class (vendor-class devices with USB class = 0xff). Devices - using this pair will be referred to as "VENDOR CLASS" devices. - - * VID = 5824 (=0x16c0) / PID = 1503 (=0x5df) for HID class devices - (excluding mice and keyboards). Devices using this pair will be referred - to as "HID CLASS" devices. - - * VID = 5824 (=0x16c0) / PID = 1505 (=0x5e1) for CDC class modem devices - Devices using this pair will be referred to as "CDC-ACM CLASS" devices. - - * VID = 5824 (=0x16c0) / PID = 1508 (=0x5e4) for MIDI class devices - Devices using this pair will be referred to as "MIDI CLASS" devices. - -Since the granted right is non-exclusive, the same VID/PID pairs may be -used by many companies and individuals for different products. To avoid -conflicts, your device and host driver software MUST adhere to the rules -outlined below. - -OBJECTIVE DEVELOPMENT Software GmbH has obtained these VID/PID pairs from -Wouter van Ooijen (see www.voti.nl) for exclusive disposition. Wouter van -Ooijen has obtained the VID from the USB Implementers Forum, Inc. -(see www.usb.org). The VID is registered for the company name -"Van Ooijen Technische Informatica". - - -RULES AND RESTRICTIONS -====================== - -(1) The USB device MUST provide a textual representation of the -manufacturer and product identification. The manufacturer identification -MUST be available at least in USB language 0x0409 (English/US). - -(2) The textual manufacturer identification MUST contain either an Internet -domain name (e.g. "mycompany.com") registered and owned by you, or an -e-mail address under your control (e.g. "myname@gmx.net"). You can embed -the domain name or e-mail address in any string you like, e.g. "Objective -Development http://www.obdev.at/vusb/". - -(3) You are responsible for retaining ownership of the domain or e-mail -address for as long as any of your products are in use. - -(4) You may choose any string for the textual product identification, as -long as this string is unique within the scope of your textual manufacturer -identification. - -(5) Matching of device-specific drivers MUST be based on the textual -manufacturer and product identification in addition to the usual VID/PID -matching. This means that operating system features which are based on -VID/PID matching only (e.g. Windows kernel level drivers, automatic actions -when the device is plugged in etc) MUST NOT be used. The driver matching -MUST be a comparison of the entire strings, NOT a sub-string match. For -CDC-ACM CLASS and MIDI CLASS devices, a generic class driver should be used -and the matching is based on the USB device class. - -(6) The extent to which VID/PID matching is allowed for non device-specific -drivers or features depends on the operating system and particular VID/PID -pair used: - - * Mac OS X, Linux, FreeBSD and other Unixes: No VID/PID matching is - required and hence no VID/PID-only matching is allowed at all. - - * Windows: The operating system performs VID/PID matching for the kernel - level driver. You are REQUIRED to use libusb-win32 (see - http://libusb-win32.sourceforge.net/) as the kernel level driver for - VENDOR CLASS devices. HID CLASS devices all use the generic HID class - driver shipped with Windows, except mice and keyboards. You therefore - MUST NOT use any of the shared VID/PID pairs for mice or keyboards. - CDC-ACM CLASS devices require a ".inf" file which matches on the VID/PID - pair. This ".inf" file MUST load the "usbser" driver to configure the - device as modem (COM-port). - -(7) OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any -problems which are caused by the shared use of these VID/PID pairs. You -have been warned that the sharing of VID/PID pairs may cause problems. If -you want to avoid them, get your own VID/PID pair for exclusive use. - - -HOW TO IMPLEMENT THESE RULES -============================ - -The following rules are for VENDOR CLASS and HID CLASS devices. CDC-ACM -CLASS and MIDI CLASS devices use the operating system's class driver and -don't need a custom driver. - -The host driver MUST iterate over all devices with the given VID/PID -numbers in their device descriptors and query the string representation for -the manufacturer name in USB language 0x0409 (English/US). It MUST compare -the ENTIRE string with your textual manufacturer identification chosen in -(2) above. A substring search for your domain or e-mail address is NOT -acceptable. The driver MUST NOT touch the device (other than querying the -descriptors) unless the strings match. - -For all USB devices with matching VID/PID and textual manufacturer -identification, the host driver must query the textual product -identification and string-compare it with the name of the product it can -control. It may only initialize the device if the product matches exactly. - -Objective Development provides examples for these matching rules with the -"PowerSwitch" project (using libusb) and with the "Automator" project -(using Windows calls on Windows and libusb on Unix). - - -Technical Notes: -================ - -Sharing the same VID/PID pair among devices is possible as long as ALL -drivers which match the VID/PID also perform matching on the textual -identification strings. This is easy on all operating systems except -Windows, since Windows establishes a static connection between the VID/PID -pair and a kernel level driver. All devices with the same VID/PID pair must -therefore use THE SAME kernel level driver. - -We therefore demand that you use libusb-win32 for VENDOR CLASS devices. -This is a generic kernel level driver which allows all types of USB access -for user space applications. This is only a partial solution of the -problem, though, because different device drivers may come with different -versions of libusb-win32 and they may not work with the libusb version of -the respective other driver. You are therefore encouraged to test your -driver against a broad range of libusb-win32 versions. Do not use new -features in new versions, or check for their existence before you use them. -When a new libusb-win32 becomes available, make sure that your driver is -compatible with it. - -For HID CLASS devices it is necessary that all those devices bind to the -same kernel driver: Microsoft's generic USB HID driver. This is true for -all HID devices except those with a specialized driver. Currently, the only -HIDs with specialized drivers are mice and keyboards. You therefore MUST -NOT use a shared VID/PID with mouse and keyboard devices. - -Sharing the same VID/PID among different products is unusual and probably -violates the USB specification. If you do it, you do it at your own risk. - -To avoid possible incompatibilities, we highly recommend that you get your -own VID/PID pair if you intend to sell your product. Objective -Development's commercial licenses for V-USB include a PID for -unrestricted exclusive use. diff --git a/tools/gnusb/bootloader/firmware/usbdrv/asmcommon.inc b/tools/gnusb/bootloader/firmware/usbdrv/asmcommon.inc deleted file mode 100644 index 07d692b..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/asmcommon.inc +++ /dev/null @@ -1,188 +0,0 @@ -/* Name: asmcommon.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2007-11-05 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id$ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file contains assembler code which is shared among the USB driver -implementations for different CPU cocks. Since the code must be inserted -in the middle of the module, it's split out into this file and #included. - -Jump destinations called from outside: - sofError: Called when no start sequence was found. - se0: Called when a package has been successfully received. - overflow: Called when receive buffer overflows. - doReturn: Called after sending data. - -Outside jump destinations used by this module: - waitForJ: Called to receive an already arriving packet. - sendAckAndReti: - sendNakAndReti: - sendCntAndReti: - usbSendAndReti: - -The following macros must be defined before this file is included: - .macro POP_STANDARD - .endm - .macro POP_RETI - .endm -*/ - -#define token x1 - -overflow: - ldi x2, 1< 0 - -#warning "Never compile production devices with debugging enabled" - -static void uartPutc(char c) -{ - while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */ - ODDBG_UDR = c; -} - -static uchar hexAscii(uchar h) -{ - h &= 0xf; - if(h >= 10) - h += 'a' - (uchar)10 - '0'; - h += '0'; - return h; -} - -static void printHex(uchar c) -{ - uartPutc(hexAscii(c >> 4)); - uartPutc(hexAscii(c)); -} - -void odDebug(uchar prefix, uchar *data, uchar len) -{ - printHex(prefix); - uartPutc(':'); - while(len--){ - uartPutc(' '); - printHex(*data++); - } - uartPutc('\r'); - uartPutc('\n'); -} - -#endif diff --git a/tools/gnusb/bootloader/firmware/usbdrv/oddebug.h b/tools/gnusb/bootloader/firmware/usbdrv/oddebug.h deleted file mode 100644 index d61309d..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/oddebug.h +++ /dev/null @@ -1,123 +0,0 @@ -/* Name: oddebug.h - * Project: AVR library - * Author: Christian Starkjohann - * Creation Date: 2005-01-16 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: oddebug.h 692 2008-11-07 15:07:40Z cs $ - */ - -#ifndef __oddebug_h_included__ -#define __oddebug_h_included__ - -/* -General Description: -This module implements a function for debug logs on the serial line of the -AVR microcontroller. Debugging can be configured with the define -'DEBUG_LEVEL'. If this macro is not defined or defined to 0, all debugging -calls are no-ops. If it is 1, DBG1 logs will appear, but not DBG2. If it is -2, DBG1 and DBG2 logs will be printed. - -A debug log consists of a label ('prefix') to indicate which debug log created -the output and a memory block to dump in hex ('data' and 'len'). -*/ - - -#ifndef F_CPU -# define F_CPU 12000000 /* 12 MHz */ -#endif - -/* make sure we have the UART defines: */ -#include "usbportability.h" - -#ifndef uchar -# define uchar unsigned char -#endif - -#if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */ -# warning "Debugging disabled because device has no UART" -# undef DEBUG_LEVEL -#endif - -#ifndef DEBUG_LEVEL -# define DEBUG_LEVEL 0 -#endif - -/* ------------------------------------------------------------------------- */ - -#if DEBUG_LEVEL > 0 -# define DBG1(prefix, data, len) odDebug(prefix, data, len) -#else -# define DBG1(prefix, data, len) -#endif - -#if DEBUG_LEVEL > 1 -# define DBG2(prefix, data, len) odDebug(prefix, data, len) -#else -# define DBG2(prefix, data, len) -#endif - -/* ------------------------------------------------------------------------- */ - -#if DEBUG_LEVEL > 0 -extern void odDebug(uchar prefix, uchar *data, uchar len); - -/* Try to find our control registers; ATMEL likes to rename these */ - -#if defined UBRR -# define ODDBG_UBRR UBRR -#elif defined UBRRL -# define ODDBG_UBRR UBRRL -#elif defined UBRR0 -# define ODDBG_UBRR UBRR0 -#elif defined UBRR0L -# define ODDBG_UBRR UBRR0L -#endif - -#if defined UCR -# define ODDBG_UCR UCR -#elif defined UCSRB -# define ODDBG_UCR UCSRB -#elif defined UCSR0B -# define ODDBG_UCR UCSR0B -#endif - -#if defined TXEN -# define ODDBG_TXEN TXEN -#else -# define ODDBG_TXEN TXEN0 -#endif - -#if defined USR -# define ODDBG_USR USR -#elif defined UCSRA -# define ODDBG_USR UCSRA -#elif defined UCSR0A -# define ODDBG_USR UCSR0A -#endif - -#if defined UDRE -# define ODDBG_UDRE UDRE -#else -# define ODDBG_UDRE UDRE0 -#endif - -#if defined UDR -# define ODDBG_UDR UDR -#elif defined UDR0 -# define ODDBG_UDR UDR0 -#endif - -static inline void odDebugInit(void) -{ - ODDBG_UCR |= (1<len & 0x10){ /* packet buffer was empty */ - txStatus->buffer[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* toggle token */ - }else{ - txStatus->len = USBPID_NAK; /* avoid sending outdated (overwritten) interrupt data */ - } - p = txStatus->buffer + 1; - i = len; - do{ /* if len == 0, we still copy 1 byte, but that's no problem */ - *p++ = *data++; - }while(--i > 0); /* loop control at the end is 2 bytes shorter than at beginning */ - usbCrc16Append(&txStatus->buffer[1], len); - txStatus->len = len + 4; /* len must be given including sync byte */ - DBG2(0x21 + (((int)txStatus >> 3) & 3), txStatus->buffer, len + 3); -} - -USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len) -{ - usbGenericSetInterrupt(data, len, &usbTxStatus1); -} -#endif - -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 -USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len) -{ - usbGenericSetInterrupt(data, len, &usbTxStatus3); -} -#endif -#endif /* USB_CFG_SUPPRESS_INTR_CODE */ - -/* ------------------ utilities for code following below ------------------- */ - -/* Use defines for the switch statement so that we can choose between an - * if()else if() and a switch/case based implementation. switch() is more - * efficient for a LARGE set of sequential choices, if() is better in all other - * cases. - */ -#if USB_CFG_USE_SWITCH_STATEMENT -# define SWITCH_START(cmd) switch(cmd){{ -# define SWITCH_CASE(value) }break; case (value):{ -# define SWITCH_CASE2(v1,v2) }break; case (v1): case(v2):{ -# define SWITCH_CASE3(v1,v2,v3) }break; case (v1): case(v2): case(v3):{ -# define SWITCH_DEFAULT }break; default:{ -# define SWITCH_END }} -#else -# define SWITCH_START(cmd) {uchar _cmd = cmd; if(0){ -# define SWITCH_CASE(value) }else if(_cmd == (value)){ -# define SWITCH_CASE2(v1,v2) }else if(_cmd == (v1) || _cmd == (v2)){ -# define SWITCH_CASE3(v1,v2,v3) }else if(_cmd == (v1) || _cmd == (v2) || (_cmd == v3)){ -# define SWITCH_DEFAULT }else{ -# define SWITCH_END }} -#endif - -#ifndef USB_RX_USER_HOOK -#define USB_RX_USER_HOOK(data, len) -#endif -#ifndef USB_SET_ADDRESS_HOOK -#define USB_SET_ADDRESS_HOOK() -#endif - -/* ------------------------------------------------------------------------- */ - -/* We use if() instead of #if in the macro below because #if can't be used - * in macros and the compiler optimizes constant conditions anyway. - * This may cause problems with undefined symbols if compiled without - * optimizing! - */ -#define GET_DESCRIPTOR(cfgProp, staticName) \ - if(cfgProp){ \ - if((cfgProp) & USB_PROP_IS_RAM) \ - flags = 0; \ - if((cfgProp) & USB_PROP_IS_DYNAMIC){ \ - len = usbFunctionDescriptor(rq); \ - }else{ \ - len = USB_PROP_LENGTH(cfgProp); \ - usbMsgPtr = (uchar *)(staticName); \ - } \ - } - -/* usbDriverDescriptor() is similar to usbFunctionDescriptor(), but used - * internally for all types of descriptors. - */ -static inline usbMsgLen_t usbDriverDescriptor(usbRequest_t *rq) -{ -usbMsgLen_t len = 0; -uchar flags = USB_FLG_MSGPTR_IS_ROM; - - SWITCH_START(rq->wValue.bytes[1]) - SWITCH_CASE(USBDESCR_DEVICE) /* 1 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_DEVICE, usbDescriptorDevice) - SWITCH_CASE(USBDESCR_CONFIG) /* 2 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_CONFIGURATION, usbDescriptorConfiguration) - SWITCH_CASE(USBDESCR_STRING) /* 3 */ -#if USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC - if(USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_RAM) - flags = 0; - len = usbFunctionDescriptor(rq); -#else /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ - SWITCH_START(rq->wValue.bytes[0]) - SWITCH_CASE(0) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_0, usbDescriptorString0) - SWITCH_CASE(1) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_VENDOR, usbDescriptorStringVendor) - SWITCH_CASE(2) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_PRODUCT, usbDescriptorStringDevice) - SWITCH_CASE(3) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER, usbDescriptorStringSerialNumber) - SWITCH_DEFAULT - if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){ - len = usbFunctionDescriptor(rq); - } - SWITCH_END -#endif /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ -#if USB_CFG_DESCR_PROPS_HID_REPORT /* only support HID descriptors if enabled */ - SWITCH_CASE(USBDESCR_HID) /* 0x21 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID, usbDescriptorConfiguration + 18) - SWITCH_CASE(USBDESCR_HID_REPORT)/* 0x22 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID_REPORT, usbDescriptorHidReport) -#endif - SWITCH_DEFAULT - if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){ - len = usbFunctionDescriptor(rq); - } - SWITCH_END - usbMsgFlags = flags; - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbDriverSetup() is similar to usbFunctionSetup(), but it's used for - * standard requests instead of class and custom requests. - */ -static inline usbMsgLen_t usbDriverSetup(usbRequest_t *rq) -{ -uchar len = 0, *dataPtr = usbTxBuf + 9; /* there are 2 bytes free space at the end of the buffer */ -uchar value = rq->wValue.bytes[0]; -#if USB_CFG_IMPLEMENT_HALT -uchar index = rq->wIndex.bytes[0]; -#endif - - dataPtr[0] = 0; /* default reply common to USBRQ_GET_STATUS and USBRQ_GET_INTERFACE */ - SWITCH_START(rq->bRequest) - SWITCH_CASE(USBRQ_GET_STATUS) /* 0 */ - uchar recipient = rq->bmRequestType & USBRQ_RCPT_MASK; /* assign arith ops to variables to enforce byte size */ - if(USB_CFG_IS_SELF_POWERED && recipient == USBRQ_RCPT_DEVICE) - dataPtr[0] = USB_CFG_IS_SELF_POWERED; -#if USB_CFG_IMPLEMENT_HALT - if(recipient == USBRQ_RCPT_ENDPOINT && index == 0x81) /* request status for endpoint 1 */ - dataPtr[0] = usbTxLen1 == USBPID_STALL; -#endif - dataPtr[1] = 0; - len = 2; -#if USB_CFG_IMPLEMENT_HALT - SWITCH_CASE2(USBRQ_CLEAR_FEATURE, USBRQ_SET_FEATURE) /* 1, 3 */ - if(value == 0 && index == 0x81){ /* feature 0 == HALT for endpoint == 1 */ - usbTxLen1 = rq->bRequest == USBRQ_CLEAR_FEATURE ? USBPID_NAK : USBPID_STALL; - usbResetDataToggling(); - } -#endif - SWITCH_CASE(USBRQ_SET_ADDRESS) /* 5 */ - usbNewDeviceAddr = value; - USB_SET_ADDRESS_HOOK(); - SWITCH_CASE(USBRQ_GET_DESCRIPTOR) /* 6 */ - len = usbDriverDescriptor(rq); - goto skipMsgPtrAssignment; - SWITCH_CASE(USBRQ_GET_CONFIGURATION) /* 8 */ - dataPtr = &usbConfiguration; /* send current configuration value */ - len = 1; - SWITCH_CASE(USBRQ_SET_CONFIGURATION) /* 9 */ - usbConfiguration = value; - usbResetStall(); - SWITCH_CASE(USBRQ_GET_INTERFACE) /* 10 */ - len = 1; -#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE - SWITCH_CASE(USBRQ_SET_INTERFACE) /* 11 */ - usbResetDataToggling(); - usbResetStall(); -#endif - SWITCH_DEFAULT /* 7=SET_DESCRIPTOR, 12=SYNC_FRAME */ - /* Should we add an optional hook here? */ - SWITCH_END - usbMsgPtr = dataPtr; -skipMsgPtrAssignment: - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbProcessRx() is called for every message received by the interrupt - * routine. It distinguishes between SETUP and DATA packets and processes - * them accordingly. - */ -static inline void usbProcessRx(uchar *data, uchar len) -{ -usbRequest_t *rq = (void *)data; - -/* usbRxToken can be: - * 0x2d 00101101 (USBPID_SETUP for setup data) - * 0xe1 11100001 (USBPID_OUT: data phase of setup transfer) - * 0...0x0f for OUT on endpoint X - */ - DBG2(0x10 + (usbRxToken & 0xf), data, len + 2); /* SETUP=1d, SETUP-DATA=11, OUTx=1x */ - USB_RX_USER_HOOK(data, len) -#if USB_CFG_IMPLEMENT_FN_WRITEOUT - if(usbRxToken < 0x10){ /* OUT to endpoint != 0: endpoint number in usbRxToken */ - usbFunctionWriteOut(data, len); - return; - } -#endif - if(usbRxToken == (uchar)USBPID_SETUP){ - if(len != 8) /* Setup size must be always 8 bytes. Ignore otherwise. */ - return; - usbMsgLen_t replyLen; - usbTxBuf[0] = USBPID_DATA0; /* initialize data toggling */ - usbTxLen = USBPID_NAK; /* abort pending transmit */ - usbMsgFlags = 0; - uchar type = rq->bmRequestType & USBRQ_TYPE_MASK; - if(type != USBRQ_TYPE_STANDARD){ /* standard requests are handled by driver */ - replyLen = usbFunctionSetup(data); - }else{ - replyLen = usbDriverSetup(rq); - } -#if USB_CFG_IMPLEMENT_FN_READ || USB_CFG_IMPLEMENT_FN_WRITE - if(replyLen == USB_NO_MSG){ /* use user-supplied read/write function */ - /* do some conditioning on replyLen, but on IN transfers only */ - if((rq->bmRequestType & USBRQ_DIR_MASK) != USBRQ_DIR_HOST_TO_DEVICE){ - if(sizeof(replyLen) < sizeof(rq->wLength.word)){ /* help compiler with optimizing */ - replyLen = rq->wLength.bytes[0]; - }else{ - replyLen = rq->wLength.word; - } - } - usbMsgFlags = USB_FLG_USE_USER_RW; - }else /* The 'else' prevents that we limit a replyLen of USB_NO_MSG to the maximum transfer len. */ -#endif - if(sizeof(replyLen) < sizeof(rq->wLength.word)){ /* help compiler with optimizing */ - if(!rq->wLength.bytes[1] && replyLen > rq->wLength.bytes[0]) /* limit length to max */ - replyLen = rq->wLength.bytes[0]; - }else{ - if(replyLen > rq->wLength.word) /* limit length to max */ - replyLen = rq->wLength.word; - } - usbMsgLen = replyLen; - }else{ /* usbRxToken must be USBPID_OUT, which means data phase of setup (control-out) */ -#if USB_CFG_IMPLEMENT_FN_WRITE - if(usbMsgFlags & USB_FLG_USE_USER_RW){ - uchar rval = usbFunctionWrite(data, len); - if(rval == 0xff){ /* an error occurred */ - usbTxLen = USBPID_STALL; - }else if(rval != 0){ /* This was the final package */ - usbMsgLen = 0; /* answer with a zero-sized data packet */ - } - } -#endif - } -} - -/* ------------------------------------------------------------------------- */ - -/* This function is similar to usbFunctionRead(), but it's also called for - * data handled automatically by the driver (e.g. descriptor reads). - */ -static uchar usbDeviceRead(uchar *data, uchar len) -{ - if(len > 0){ /* don't bother app with 0 sized reads */ -#if USB_CFG_IMPLEMENT_FN_READ - if(usbMsgFlags & USB_FLG_USE_USER_RW){ - len = usbFunctionRead(data, len); - }else -#endif - { - uchar i = len, *r = usbMsgPtr; - if(usbMsgFlags & USB_FLG_MSGPTR_IS_ROM){ /* ROM data */ - do{ - uchar c = USB_READ_FLASH(r); /* assign to char size variable to enforce byte ops */ - *data++ = c; - r++; - }while(--i); - }else{ /* RAM data */ - do{ - *data++ = *r++; - }while(--i); - } - usbMsgPtr = r; - } - } - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbBuildTxBlock() is called when we have data to transmit and the - * interrupt routine's transmit buffer is empty. - */ -static inline void usbBuildTxBlock(void) -{ -usbMsgLen_t wantLen; -uchar len; - - wantLen = usbMsgLen; - if(wantLen > 8) - wantLen = 8; - usbMsgLen -= wantLen; - usbTxBuf[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* DATA toggling */ - len = usbDeviceRead(usbTxBuf + 1, wantLen); - if(len <= 8){ /* valid data packet */ - usbCrc16Append(&usbTxBuf[1], len); - len += 4; /* length including sync byte */ - if(len < 12) /* a partial package identifies end of message */ - usbMsgLen = USB_NO_MSG; - }else{ - len = USBPID_STALL; /* stall the endpoint */ - usbMsgLen = USB_NO_MSG; - } - usbTxLen = len; - DBG2(0x20, usbTxBuf, len-1); -} - -/* ------------------------------------------------------------------------- */ - -static inline void usbHandleResetHook(uchar notResetState) -{ -#ifdef USB_RESET_HOOK -static uchar wasReset; -uchar isReset = !notResetState; - - if(wasReset != isReset){ - USB_RESET_HOOK(isReset); - wasReset = isReset; - } -#endif -} - -/* ------------------------------------------------------------------------- */ - -USB_PUBLIC void usbPoll(void) -{ -schar len; -uchar i; - - len = usbRxLen - 3; - if(len >= 0){ -/* We could check CRC16 here -- but ACK has already been sent anyway. If you - * need data integrity checks with this driver, check the CRC in your app - * code and report errors back to the host. Since the ACK was already sent, - * retries must be handled on application level. - * unsigned crc = usbCrc16(buffer + 1, usbRxLen - 3); - */ - usbProcessRx(usbRxBuf + USB_BUFSIZE + 1 - usbInputBufOffset, len); -#if USB_CFG_HAVE_FLOWCONTROL - if(usbRxLen > 0) /* only mark as available if not inactivated */ - usbRxLen = 0; -#else - usbRxLen = 0; /* mark rx buffer as available */ -#endif - } - if(usbTxLen & 0x10){ /* transmit system idle */ - if(usbMsgLen != USB_NO_MSG){ /* transmit data pending? */ - usbBuildTxBlock(); - } - } - for(i = 20; i > 0; i--){ - uchar usbLineStatus = USBIN & USBMASK; - if(usbLineStatus != 0) /* SE0 has ended */ - goto isNotReset; - } - /* RESET condition, called multiple times during reset */ - usbNewDeviceAddr = 0; - usbDeviceAddr = 0; - usbResetStall(); - DBG1(0xff, 0, 0); -isNotReset: - usbHandleResetHook(i); -} - -/* ------------------------------------------------------------------------- */ - -USB_PUBLIC void usbInit(void) -{ -#if USB_INTR_CFG_SET != 0 - USB_INTR_CFG |= USB_INTR_CFG_SET; -#endif -#if USB_INTR_CFG_CLR != 0 - USB_INTR_CFG &= ~(USB_INTR_CFG_CLR); -#endif - USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT); - usbResetDataToggling(); -#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE - usbTxLen1 = USBPID_NAK; -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 - usbTxLen3 = USBPID_NAK; -#endif -#endif -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/gnusb/bootloader/firmware/usbdrv/usbdrv.h b/tools/gnusb/bootloader/firmware/usbdrv/usbdrv.h deleted file mode 100644 index c0fb569..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/usbdrv.h +++ /dev/null @@ -1,733 +0,0 @@ -/* Name: usbdrv.h - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2004-12-29 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrv.h 748 2009-04-15 15:05:07Z cs $ - */ - -#ifndef __usbdrv_h_included__ -#define __usbdrv_h_included__ -#include "usbconfig.h" -#include "usbportability.h" - -/* -Hardware Prerequisites: -======================= -USB lines D+ and D- MUST be wired to the same I/O port. We recommend that D+ -triggers the interrupt (best achieved by using INT0 for D+), but it is also -possible to trigger the interrupt from D-. If D- is used, interrupts are also -triggered by SOF packets. D- requires a pull-up of 1.5k to +3.5V (and the -device must be powered at 3.5V) to identify as low-speed USB device. A -pull-down or pull-up of 1M SHOULD be connected from D+ to +3.5V to prevent -interference when no USB master is connected. If you use Zener diodes to limit -the voltage on D+ and D-, you MUST use a pull-down resistor, not a pull-up. -We use D+ as interrupt source and not D- because it does not trigger on -keep-alive and RESET states. If you want to count keep-alive events with -USB_COUNT_SOF, you MUST use D- as an interrupt source. - -As a compile time option, the 1.5k pull-up resistor on D- can be made -switchable to allow the device to disconnect at will. See the definition of -usbDeviceConnect() and usbDeviceDisconnect() further down in this file. - -Please adapt the values in usbconfig.h according to your hardware! - -The device MUST be clocked at exactly 12 MHz, 15 MHz, 16 MHz or 20 MHz -or at 12.8 MHz resp. 16.5 MHz +/- 1%. See usbconfig-prototype.h for details. - - -Limitations: -============ -Robustness with respect to communication errors: -The driver assumes error-free communication. It DOES check for errors in -the PID, but does NOT check bit stuffing errors, SE0 in middle of a byte, -token CRC (5 bit) and data CRC (16 bit). CRC checks can not be performed due -to timing constraints: We must start sending a reply within 7 bit times. -Bit stuffing and misplaced SE0 would have to be checked in real-time, but CPU -performance does not permit that. The driver does not check Data0/Data1 -toggling, but application software can implement the check. - -Input characteristics: -Since no differential receiver circuit is used, electrical interference -robustness may suffer. The driver samples only one of the data lines with -an ordinary I/O pin's input characteristics. However, since this is only a -low speed USB implementation and the specification allows for 8 times the -bit rate over the same hardware, we should be on the safe side. Even the spec -requires detection of asymmetric states at high bit rate for SE0 detection. - -Number of endpoints: -The driver supports the following endpoints: - -- Endpoint 0, the default control endpoint. -- Any number of interrupt- or bulk-out endpoints. The data is sent to - usbFunctionWriteOut() and USB_CFG_IMPLEMENT_FN_WRITEOUT must be defined - to 1 to activate this feature. The endpoint number can be found in the - global variable 'usbRxToken'. -- One default interrupt- or bulk-in endpoint. This endpoint is used for - interrupt- or bulk-in transfers which are not handled by any other endpoint. - You must define USB_CFG_HAVE_INTRIN_ENDPOINT in order to activate this - feature and call usbSetInterrupt() to send interrupt/bulk data. -- One additional interrupt- or bulk-in endpoint. This was endpoint 3 in - previous versions of this driver but can now be configured to any endpoint - number. You must define USB_CFG_HAVE_INTRIN_ENDPOINT3 in order to activate - this feature and call usbSetInterrupt3() to send interrupt/bulk data. The - endpoint number can be set with USB_CFG_EP3_NUMBER. - -Please note that the USB standard forbids bulk endpoints for low speed devices! -Most operating systems allow them anyway, but the AVR will spend 90% of the CPU -time in the USB interrupt polling for bulk data. - -Maximum data payload: -Data payload of control in and out transfers may be up to 254 bytes. In order -to accept payload data of out transfers, you need to implement -'usbFunctionWrite()'. - -USB Suspend Mode supply current: -The USB standard limits power consumption to 500uA when the bus is in suspend -mode. This is not a problem for self-powered devices since they don't need -bus power anyway. Bus-powered devices can achieve this only by putting the -CPU in sleep mode. The driver does not implement suspend handling by itself. -However, the application may implement activity monitoring and wakeup from -sleep. The host sends regular SE0 states on the bus to keep it active. These -SE0 states can be detected by using D- as the interrupt source. Define -USB_COUNT_SOF to 1 and use the global variable usbSofCount to check for bus -activity. - -Operation without an USB master: -The driver behaves neutral without connection to an USB master if D- reads -as 1. To avoid spurious interrupts, we recommend a high impedance (e.g. 1M) -pull-down or pull-up resistor on D+ (interrupt). If Zener diodes are used, -use a pull-down. If D- becomes statically 0, the driver may block in the -interrupt routine. - -Interrupt latency: -The application must ensure that the USB interrupt is not disabled for more -than 25 cycles (this is for 12 MHz, faster clocks allow longer latency). -This implies that all interrupt routines must either be declared as "INTERRUPT" -instead of "SIGNAL" (see "avr/signal.h") or that they are written in assembler -with "sei" as the first instruction. - -Maximum interrupt duration / CPU cycle consumption: -The driver handles all USB communication during the interrupt service -routine. The routine will not return before an entire USB message is received -and the reply is sent. This may be up to ca. 1200 cycles @ 12 MHz (= 100us) if -the host conforms to the standard. The driver will consume CPU cycles for all -USB messages, even if they address another (low-speed) device on the same bus. - -*/ - -/* ------------------------------------------------------------------------- */ -/* --------------------------- Module Interface ---------------------------- */ -/* ------------------------------------------------------------------------- */ - -#define USBDRV_VERSION 20090415 -/* This define uniquely identifies a driver version. It is a decimal number - * constructed from the driver's release date in the form YYYYMMDD. If the - * driver's behavior or interface changes, you can use this constant to - * distinguish versions. If it is not defined, the driver's release date is - * older than 2006-01-25. - */ - - -#ifndef USB_PUBLIC -#define USB_PUBLIC -#endif -/* USB_PUBLIC is used as declaration attribute for all functions exported by - * the USB driver. The default is no attribute (see above). You may define it - * to static either in usbconfig.h or from the command line if you include - * usbdrv.c instead of linking against it. Including the C module of the driver - * directly in your code saves a couple of bytes in flash memory. - */ - -#ifndef __ASSEMBLER__ -#ifndef uchar -#define uchar unsigned char -#endif -#ifndef schar -#define schar signed char -#endif -/* shortcuts for well defined 8 bit integer types */ - -#if USB_CFG_LONG_TRANSFERS /* if more than 254 bytes transfer size required */ -# define usbMsgLen_t unsigned -#else -# define usbMsgLen_t uchar -#endif -/* usbMsgLen_t is the data type used for transfer lengths. By default, it is - * defined to uchar, allowing a maximum of 254 bytes (255 is reserved for - * USB_NO_MSG below). If the usbconfig.h defines USB_CFG_LONG_TRANSFERS to 1, - * a 16 bit data type is used, allowing up to 16384 bytes (the rest is used - * for flags in the descriptor configuration). - */ -#define USB_NO_MSG ((usbMsgLen_t)-1) /* constant meaning "no message" */ - -struct usbRequest; /* forward declaration */ - -USB_PUBLIC void usbInit(void); -/* This function must be called before interrupts are enabled and the main - * loop is entered. - */ -USB_PUBLIC void usbPoll(void); -/* This function must be called at regular intervals from the main loop. - * Maximum delay between calls is somewhat less than 50ms (USB timeout for - * accepting a Setup message). Otherwise the device will not be recognized. - * Please note that debug outputs through the UART take ~ 0.5ms per byte - * at 19200 bps. - */ -extern uchar *usbMsgPtr; -/* This variable may be used to pass transmit data to the driver from the - * implementation of usbFunctionWrite(). It is also used internally by the - * driver for standard control requests. - */ -USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8]); -/* This function is called when the driver receives a SETUP transaction from - * the host which is not answered by the driver itself (in practice: class and - * vendor requests). All control transfers start with a SETUP transaction where - * the host communicates the parameters of the following (optional) data - * transfer. The SETUP data is available in the 'data' parameter which can - * (and should) be casted to 'usbRequest_t *' for a more user-friendly access - * to parameters. - * - * If the SETUP indicates a control-in transfer, you should provide the - * requested data to the driver. There are two ways to transfer this data: - * (1) Set the global pointer 'usbMsgPtr' to the base of the static RAM data - * block and return the length of the data in 'usbFunctionSetup()'. The driver - * will handle the rest. Or (2) return USB_NO_MSG in 'usbFunctionSetup()'. The - * driver will then call 'usbFunctionRead()' when data is needed. See the - * documentation for usbFunctionRead() for details. - * - * If the SETUP indicates a control-out transfer, the only way to receive the - * data from the host is through the 'usbFunctionWrite()' call. If you - * implement this function, you must return USB_NO_MSG in 'usbFunctionSetup()' - * to indicate that 'usbFunctionWrite()' should be used. See the documentation - * of this function for more information. If you just want to ignore the data - * sent by the host, return 0 in 'usbFunctionSetup()'. - * - * Note that calls to the functions usbFunctionRead() and usbFunctionWrite() - * are only done if enabled by the configuration in usbconfig.h. - */ -USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq); -/* You need to implement this function ONLY if you provide USB descriptors at - * runtime (which is an expert feature). It is very similar to - * usbFunctionSetup() above, but it is called only to request USB descriptor - * data. See the documentation of usbFunctionSetup() above for more info. - */ -#if USB_CFG_HAVE_INTRIN_ENDPOINT -USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len); -/* This function sets the message which will be sent during the next interrupt - * IN transfer. The message is copied to an internal buffer and must not exceed - * a length of 8 bytes. The message may be 0 bytes long just to indicate the - * interrupt status to the host. - * If you need to transfer more bytes, use a control read after the interrupt. - */ -#define usbInterruptIsReady() (usbTxLen1 & 0x10) -/* This macro indicates whether the last interrupt message has already been - * sent. If you set a new interrupt message before the old was sent, the - * message already buffered will be lost. - */ -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 -USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len); -#define usbInterruptIsReady3() (usbTxLen3 & 0x10) -/* Same as above for endpoint 3 */ -#endif -#endif /* USB_CFG_HAVE_INTRIN_ENDPOINT */ -#if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* simplified interface for backward compatibility */ -#define usbHidReportDescriptor usbDescriptorHidReport -/* should be declared as: PROGMEM char usbHidReportDescriptor[]; */ -/* If you implement an HID device, you need to provide a report descriptor. - * The HID report descriptor syntax is a bit complex. If you understand how - * report descriptors are constructed, we recommend that you use the HID - * Descriptor Tool from usb.org, see http://www.usb.org/developers/hidpage/. - * Otherwise you should probably start with a working example. - */ -#endif /* USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH */ -#if USB_CFG_IMPLEMENT_FN_WRITE -USB_PUBLIC uchar usbFunctionWrite(uchar *data, uchar len); -/* This function is called by the driver to provide a control transfer's - * payload data (control-out). It is called in chunks of up to 8 bytes. The - * total count provided in the current control transfer can be obtained from - * the 'length' property in the setup data. If an error occurred during - * processing, return 0xff (== -1). The driver will answer the entire transfer - * with a STALL token in this case. If you have received the entire payload - * successfully, return 1. If you expect more data, return 0. If you don't - * know whether the host will send more data (you should know, the total is - * provided in the usbFunctionSetup() call!), return 1. - * NOTE: If you return 0xff for STALL, 'usbFunctionWrite()' may still be called - * for the remaining data. You must continue to return 0xff for STALL in these - * calls. - * In order to get usbFunctionWrite() called, define USB_CFG_IMPLEMENT_FN_WRITE - * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. - */ -#endif /* USB_CFG_IMPLEMENT_FN_WRITE */ -#if USB_CFG_IMPLEMENT_FN_READ -USB_PUBLIC uchar usbFunctionRead(uchar *data, uchar len); -/* This function is called by the driver to ask the application for a control - * transfer's payload data (control-in). It is called in chunks of up to 8 - * bytes each. You should copy the data to the location given by 'data' and - * return the actual number of bytes copied. If you return less than requested, - * the control-in transfer is terminated. If you return 0xff, the driver aborts - * the transfer with a STALL token. - * In order to get usbFunctionRead() called, define USB_CFG_IMPLEMENT_FN_READ - * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. - */ -#endif /* USB_CFG_IMPLEMENT_FN_READ */ - -extern uchar usbRxToken; /* may be used in usbFunctionWriteOut() below */ -#if USB_CFG_IMPLEMENT_FN_WRITEOUT -USB_PUBLIC void usbFunctionWriteOut(uchar *data, uchar len); -/* This function is called by the driver when data is received on an interrupt- - * or bulk-out endpoint. The endpoint number can be found in the global - * variable usbRxToken. You must define USB_CFG_IMPLEMENT_FN_WRITEOUT to 1 in - * usbconfig.h to get this function called. - */ -#endif /* USB_CFG_IMPLEMENT_FN_WRITEOUT */ -#ifdef USB_CFG_PULLUP_IOPORTNAME -#define usbDeviceConnect() ((USB_PULLUP_DDR |= (1<device, 1=device->host - * t ..... type: 0=standard, 1=class, 2=vendor, 3=reserved - * r ..... recipient: 0=device, 1=interface, 2=endpoint, 3=other - */ - -/* USB setup recipient values */ -#define USBRQ_RCPT_MASK 0x1f -#define USBRQ_RCPT_DEVICE 0 -#define USBRQ_RCPT_INTERFACE 1 -#define USBRQ_RCPT_ENDPOINT 2 - -/* USB request type values */ -#define USBRQ_TYPE_MASK 0x60 -#define USBRQ_TYPE_STANDARD (0<<5) -#define USBRQ_TYPE_CLASS (1<<5) -#define USBRQ_TYPE_VENDOR (2<<5) - -/* USB direction values: */ -#define USBRQ_DIR_MASK 0x80 -#define USBRQ_DIR_HOST_TO_DEVICE (0<<7) -#define USBRQ_DIR_DEVICE_TO_HOST (1<<7) - -/* USB Standard Requests */ -#define USBRQ_GET_STATUS 0 -#define USBRQ_CLEAR_FEATURE 1 -#define USBRQ_SET_FEATURE 3 -#define USBRQ_SET_ADDRESS 5 -#define USBRQ_GET_DESCRIPTOR 6 -#define USBRQ_SET_DESCRIPTOR 7 -#define USBRQ_GET_CONFIGURATION 8 -#define USBRQ_SET_CONFIGURATION 9 -#define USBRQ_GET_INTERFACE 10 -#define USBRQ_SET_INTERFACE 11 -#define USBRQ_SYNCH_FRAME 12 - -/* USB descriptor constants */ -#define USBDESCR_DEVICE 1 -#define USBDESCR_CONFIG 2 -#define USBDESCR_STRING 3 -#define USBDESCR_INTERFACE 4 -#define USBDESCR_ENDPOINT 5 -#define USBDESCR_HID 0x21 -#define USBDESCR_HID_REPORT 0x22 -#define USBDESCR_HID_PHYS 0x23 - -#define USBATTR_BUSPOWER 0x80 -#define USBATTR_SELFPOWER 0x40 -#define USBATTR_REMOTEWAKE 0x20 - -/* USB HID Requests */ -#define USBRQ_HID_GET_REPORT 0x01 -#define USBRQ_HID_GET_IDLE 0x02 -#define USBRQ_HID_GET_PROTOCOL 0x03 -#define USBRQ_HID_SET_REPORT 0x09 -#define USBRQ_HID_SET_IDLE 0x0a -#define USBRQ_HID_SET_PROTOCOL 0x0b - -/* ------------------------------------------------------------------------- */ - -#endif /* __usbdrv_h_included__ */ diff --git a/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm.S b/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm.S deleted file mode 100644 index 84121be..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm.S +++ /dev/null @@ -1,305 +0,0 @@ -/* Name: usbdrvasm.S - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2007-06-13 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm.S 740 2009-04-13 18:23:31Z cs $ - */ - -/* -General Description: -This module is the assembler part of the USB driver. This file contains -general code (preprocessor acrobatics and CRC computation) and then includes -the file appropriate for the given clock rate. -*/ - -#define __SFR_OFFSET 0 /* used by avr-libc's register definitions */ -#include "usbportability.h" -#include "usbdrv.h" /* for common defs */ - -/* register names */ -#define x1 r16 -#define x2 r17 -#define shift r18 -#define cnt r19 -#define x3 r20 -#define x4 r21 -#define x5 r22 -#define bitcnt x5 -#define phase x4 -#define leap x4 - -/* Some assembler dependent definitions and declarations: */ - -#ifdef __IAR_SYSTEMS_ASM__ - extern usbRxBuf, usbDeviceAddr, usbNewDeviceAddr, usbInputBufOffset - extern usbCurrentTok, usbRxLen, usbRxToken, usbTxLen - extern usbTxBuf, usbTxStatus1, usbTxStatus3 -# if USB_COUNT_SOF - extern usbSofCount -# endif - public usbCrc16 - public usbCrc16Append - - COMMON INTVEC -# ifndef USB_INTR_VECTOR - ORG INT0_vect -# else /* USB_INTR_VECTOR */ - ORG USB_INTR_VECTOR -# undef USB_INTR_VECTOR -# endif /* USB_INTR_VECTOR */ -# define USB_INTR_VECTOR usbInterruptHandler - rjmp USB_INTR_VECTOR - RSEG CODE - -#else /* __IAR_SYSTEMS_ASM__ */ - -# ifndef USB_INTR_VECTOR /* default to hardware interrupt INT0 */ -# define USB_INTR_VECTOR SIG_INTERRUPT0 -# endif - .text - .global USB_INTR_VECTOR - .type USB_INTR_VECTOR, @function - .global usbCrc16 - .global usbCrc16Append -#endif /* __IAR_SYSTEMS_ASM__ */ - - -#if USB_INTR_PENDING < 0x40 /* This is an I/O address, use in and out */ -# define USB_LOAD_PENDING(reg) in reg, USB_INTR_PENDING -# define USB_STORE_PENDING(reg) out USB_INTR_PENDING, reg -#else /* It's a memory address, use lds and sts */ -# define USB_LOAD_PENDING(reg) lds reg, USB_INTR_PENDING -# define USB_STORE_PENDING(reg) sts USB_INTR_PENDING, reg -#endif - -#define usbTxLen1 usbTxStatus1 -#define usbTxBuf1 (usbTxStatus1 + 1) -#define usbTxLen3 usbTxStatus3 -#define usbTxBuf3 (usbTxStatus3 + 1) - - -;---------------------------------------------------------------------------- -; Utility functions -;---------------------------------------------------------------------------- - -#ifdef __IAR_SYSTEMS_ASM__ -/* Register assignments for usbCrc16 on IAR cc */ -/* Calling conventions on IAR: - * First parameter passed in r16/r17, second in r18/r19 and so on. - * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer) - * Result is passed in r16/r17 - * In case of the "tiny" memory model, pointers are only 8 bit with no - * padding. We therefore pass argument 1 as "16 bit unsigned". - */ -RTMODEL "__rt_version", "3" -/* The line above will generate an error if cc calling conventions change. - * The value "3" above is valid for IAR 4.10B/W32 - */ -# define argLen r18 /* argument 2 */ -# define argPtrL r16 /* argument 1 */ -# define argPtrH r17 /* argument 1 */ - -# define resCrcL r16 /* result */ -# define resCrcH r17 /* result */ - -# define ptrL ZL -# define ptrH ZH -# define ptr Z -# define byte r22 -# define bitCnt r19 -# define polyL r20 -# define polyH r21 -# define scratch r23 - -#else /* __IAR_SYSTEMS_ASM__ */ -/* Register assignments for usbCrc16 on gcc */ -/* Calling conventions on gcc: - * First parameter passed in r24/r25, second in r22/23 and so on. - * Callee must preserve r1-r17, r28/r29 - * Result is passed in r24/r25 - */ -# define argLen r22 /* argument 2 */ -# define argPtrL r24 /* argument 1 */ -# define argPtrH r25 /* argument 1 */ - -# define resCrcL r24 /* result */ -# define resCrcH r25 /* result */ - -# define ptrL XL -# define ptrH XH -# define ptr x -# define byte r18 -# define bitCnt r19 -# define polyL r20 -# define polyH r21 -# define scratch r23 - -#endif - -; extern unsigned usbCrc16(unsigned char *data, unsigned char len); -; data: r24/25 -; len: r22 -; temp variables: -; r18: data byte -; r19: bit counter -; r20/21: polynomial -; r23: scratch -; r24/25: crc-sum -; r26/27=X: ptr -usbCrc16: - mov ptrL, argPtrL - mov ptrH, argPtrH - ldi resCrcL, 0 - ldi resCrcH, 0 - ldi polyL, lo8(0xa001) - ldi polyH, hi8(0xa001) - com argLen ; argLen = -argLen - 1 -crcByteLoop: - subi argLen, -1 - brcc crcReady ; modified loop to ensure that carry is set below - ld byte, ptr+ - ldi bitCnt, -8 ; strange loop counter to ensure that carry is set where we need it - eor resCrcL, byte -crcBitLoop: - ror resCrcH ; carry is always set here - ror resCrcL - brcs crcNoXor - eor resCrcL, polyL - eor resCrcH, polyH -crcNoXor: - subi bitCnt, -1 - brcs crcBitLoop - rjmp crcByteLoop -crcReady: - ret -; Thanks to Reimar Doeffinger for optimizing this CRC routine! - -; extern unsigned usbCrc16Append(unsigned char *data, unsigned char len); -usbCrc16Append: - rcall usbCrc16 - st ptr+, resCrcL - st ptr+, resCrcH - ret - -#undef argLen -#undef argPtrL -#undef argPtrH -#undef resCrcL -#undef resCrcH -#undef ptrL -#undef ptrH -#undef ptr -#undef byte -#undef bitCnt -#undef polyL -#undef polyH -#undef scratch - - -#if USB_CFG_HAVE_MEASURE_FRAME_LENGTH -#ifdef __IAR_SYSTEMS_ASM__ -/* Register assignments for usbMeasureFrameLength on IAR cc */ -/* Calling conventions on IAR: - * First parameter passed in r16/r17, second in r18/r19 and so on. - * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer) - * Result is passed in r16/r17 - * In case of the "tiny" memory model, pointers are only 8 bit with no - * padding. We therefore pass argument 1 as "16 bit unsigned". - */ -# define resL r16 -# define resH r17 -# define cnt16L r30 -# define cnt16H r31 -# define cntH r18 - -#else /* __IAR_SYSTEMS_ASM__ */ -/* Register assignments for usbMeasureFrameLength on gcc */ -/* Calling conventions on gcc: - * First parameter passed in r24/r25, second in r22/23 and so on. - * Callee must preserve r1-r17, r28/r29 - * Result is passed in r24/r25 - */ -# define resL r24 -# define resH r25 -# define cnt16L r24 -# define cnt16H r25 -# define cntH r26 -#endif -# define cnt16 cnt16L - -; extern unsigned usbMeasurePacketLength(void); -; returns time between two idle strobes in multiples of 7 CPU clocks -.global usbMeasureFrameLength -usbMeasureFrameLength: - ldi cntH, 6 ; wait ~ 10 ms for D- == 0 - clr cnt16L - clr cnt16H -usbMFTime16: - dec cntH - breq usbMFTimeout -usbMFWaitStrobe: ; first wait for D- == 0 (idle strobe) - sbiw cnt16, 1 ;[0] [6] - breq usbMFTime16 ;[2] - sbic USBIN, USBMINUS ;[3] - rjmp usbMFWaitStrobe ;[4] -usbMFWaitIdle: ; then wait until idle again - sbis USBIN, USBMINUS ;1 wait for D- == 1 - rjmp usbMFWaitIdle ;2 - ldi cnt16L, 1 ;1 represents cycles so far - clr cnt16H ;1 -usbMFWaitLoop: - in cntH, USBIN ;[0] [7] - adiw cnt16, 1 ;[1] - breq usbMFTimeout ;[3] - andi cntH, USBMASK ;[4] - brne usbMFWaitLoop ;[5] -usbMFTimeout: -#if resL != cnt16L - mov resL, cnt16L - mov resH, cnt16H -#endif - ret - -#undef resL -#undef resH -#undef cnt16 -#undef cnt16L -#undef cnt16H -#undef cntH - -#endif /* USB_CFG_HAVE_MEASURE_FRAME_LENGTH */ - -;---------------------------------------------------------------------------- -; Now include the clock rate specific code -;---------------------------------------------------------------------------- - -#ifndef USB_CFG_CLOCK_KHZ -# define USB_CFG_CLOCK_KHZ 12000 -#endif - -#if USB_CFG_CHECK_CRC /* separate dispatcher for CRC type modules */ -# if USB_CFG_CLOCK_KHZ == 18000 -# include "usbdrvasm18-crc.inc" -# else -# error "USB_CFG_CLOCK_KHZ is not one of the supported crc-rates!" -# endif -#else /* USB_CFG_CHECK_CRC */ -# if USB_CFG_CLOCK_KHZ == 12000 -# include "usbdrvasm12.inc" -# elif USB_CFG_CLOCK_KHZ == 12800 -# include "usbdrvasm128.inc" -# elif USB_CFG_CLOCK_KHZ == 15000 -# include "usbdrvasm15.inc" -# elif USB_CFG_CLOCK_KHZ == 16000 -# include "usbdrvasm16.inc" -# elif USB_CFG_CLOCK_KHZ == 16500 -# include "usbdrvasm165.inc" -# elif USB_CFG_CLOCK_KHZ == 20000 -# include "usbdrvasm20.inc" -# else -# error "USB_CFG_CLOCK_KHZ is not one of the supported non-crc-rates!" -# endif -#endif /* USB_CFG_CHECK_CRC */ diff --git a/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm.asm b/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm.asm deleted file mode 100644 index 9cc4e4d..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm.asm +++ /dev/null @@ -1,21 +0,0 @@ -/* Name: usbdrvasm.asm - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2006-03-01 - * Tabsize: 4 - * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id$ - */ - -/* -General Description: -The IAR compiler/assembler system prefers assembler files with file extension -".asm". We simply provide this file as an alias for usbdrvasm.S. - -Thanks to Oleg Semyonov for his help with the IAR tools port! -*/ - -#include "usbdrvasm.S" - -end diff --git a/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm12.inc b/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm12.inc deleted file mode 100644 index c116758..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm12.inc +++ /dev/null @@ -1,393 +0,0 @@ -/* Name: usbdrvasm12.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2004-12-29 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrvasm12.inc 740 2009-04-13 18:23:31Z cs $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 12 MHz version of the asssembler part of the USB driver. It -requires a 12 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! - - -Timing constraints according to spec (in bit times): -timing subject min max CPUcycles ---------------------------------------------------------------------------- -EOP of OUT/SETUP to sync pattern of DATA0 (both rx) 2 16 16-128 -EOP of IN to sync pattern of DATA0 (rx, then tx) 2 7.5 16-60 -DATAx (rx) to ACK/NAK/STALL (tx) 2 7.5 16-60 -*/ - -;Software-receiver engine. Strict timing! Don't change unless you can preserve timing! -;interrupt response time: 4 cycles + insn running = 7 max if interrupts always enabled -;max allowable interrupt latency: 34 cycles -> max 25 cycles interrupt disable -;max stack usage: [ret(2), YL, SREG, YH, shift, x1, x2, x3, cnt, x4] = 11 bytes -;Numbers in brackets are maximum cycles since SOF. -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt - push YL ;2 [35] push only what is necessary to sync with edge ASAP - in YL, SREG ;1 [37] - push YL ;2 [39] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of 1/4 bit which meets the spec. - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push YH ;2 [2] - lds YL, usbInputBufOffset;2 [4] - clr YH ;1 [5] - subi YL, lo8(-(usbRxBuf));1 [6] - sbci YH, hi8(-(usbRxBuf));1 [7] - - sbis USBIN, USBMINUS ;1 [8] we want two bits K [sample 1 cycle too early] - rjmp haveTwoBitsK ;2 [10] - pop YH ;2 [11] undo the push from before - rjmp waitForK ;2 [13] this was not the end of sync, retry -haveTwoBitsK: -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- - push shift ;2 [16] - push x1 ;2 [12] - push x2 ;2 [14] - - in x1, USBIN ;1 [17] <-- sample bit 0 - ldi shift, 0xff ;1 [18] - bst x1, USBMINUS ;1 [19] - bld shift, 0 ;1 [20] - push x3 ;2 [22] - push cnt ;2 [24] - - in x2, USBIN ;1 [25] <-- sample bit 1 - ser x3 ;1 [26] [inserted init instruction] - eor x1, x2 ;1 [27] - bst x1, USBMINUS ;1 [28] - bld shift, 1 ;1 [29] - ldi cnt, USB_BUFSIZE;1 [30] [inserted init instruction] - rjmp rxbit2 ;2 [32] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- - -unstuff0: ;1 (branch taken) - andi x3, ~0x01 ;1 [15] - mov x1, x2 ;1 [16] x2 contains last sampled (stuffed) bit - in x2, USBIN ;1 [17] <-- sample bit 1 again - ori shift, 0x01 ;1 [18] - rjmp didUnstuff0 ;2 [20] - -unstuff1: ;1 (branch taken) - mov x2, x1 ;1 [21] x1 contains last sampled (stuffed) bit - andi x3, ~0x02 ;1 [22] - ori shift, 0x02 ;1 [23] - nop ;1 [24] - in x1, USBIN ;1 [25] <-- sample bit 2 again - rjmp didUnstuff1 ;2 [27] - -unstuff2: ;1 (branch taken) - andi x3, ~0x04 ;1 [29] - ori shift, 0x04 ;1 [30] - mov x1, x2 ;1 [31] x2 contains last sampled (stuffed) bit - nop ;1 [32] - in x2, USBIN ;1 [33] <-- sample bit 3 - rjmp didUnstuff2 ;2 [35] - -unstuff3: ;1 (branch taken) - in x2, USBIN ;1 [34] <-- sample stuffed bit 3 [one cycle too late] - andi x3, ~0x08 ;1 [35] - ori shift, 0x08 ;1 [36] - rjmp didUnstuff3 ;2 [38] - -unstuff4: ;1 (branch taken) - andi x3, ~0x10 ;1 [40] - in x1, USBIN ;1 [41] <-- sample stuffed bit 4 - ori shift, 0x10 ;1 [42] - rjmp didUnstuff4 ;2 [44] - -unstuff5: ;1 (branch taken) - andi x3, ~0x20 ;1 [48] - in x2, USBIN ;1 [49] <-- sample stuffed bit 5 - ori shift, 0x20 ;1 [50] - rjmp didUnstuff5 ;2 [52] - -unstuff6: ;1 (branch taken) - andi x3, ~0x40 ;1 [56] - in x1, USBIN ;1 [57] <-- sample stuffed bit 6 - ori shift, 0x40 ;1 [58] - rjmp didUnstuff6 ;2 [60] - -; extra jobs done during bit interval: -; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs] -; bit 1: se0 check -; bit 2: overflow check -; bit 3: recovery from delay [bit 0 tasks took too long] -; bit 4: none -; bit 5: none -; bit 6: none -; bit 7: jump, eor -rxLoop: - eor x3, shift ;1 [0] reconstruct: x3 is 0 at bit locations we changed, 1 at others - in x1, USBIN ;1 [1] <-- sample bit 0 - st y+, x3 ;2 [3] store data - ser x3 ;1 [4] - nop ;1 [5] - eor x2, x1 ;1 [6] - bst x2, USBMINUS;1 [7] - bld shift, 0 ;1 [8] - in x2, USBIN ;1 [9] <-- sample bit 1 (or possibly bit 0 stuffed) - andi x2, USBMASK ;1 [10] - breq se0 ;1 [11] SE0 check for bit 1 - andi shift, 0xf9 ;1 [12] -didUnstuff0: - breq unstuff0 ;1 [13] - eor x1, x2 ;1 [14] - bst x1, USBMINUS;1 [15] - bld shift, 1 ;1 [16] -rxbit2: - in x1, USBIN ;1 [17] <-- sample bit 2 (or possibly bit 1 stuffed) - andi shift, 0xf3 ;1 [18] - breq unstuff1 ;1 [19] do remaining work for bit 1 -didUnstuff1: - subi cnt, 1 ;1 [20] - brcs overflow ;1 [21] loop control - eor x2, x1 ;1 [22] - bst x2, USBMINUS;1 [23] - bld shift, 2 ;1 [24] - in x2, USBIN ;1 [25] <-- sample bit 3 (or possibly bit 2 stuffed) - andi shift, 0xe7 ;1 [26] - breq unstuff2 ;1 [27] -didUnstuff2: - eor x1, x2 ;1 [28] - bst x1, USBMINUS;1 [29] - bld shift, 3 ;1 [30] -didUnstuff3: - andi shift, 0xcf ;1 [31] - breq unstuff3 ;1 [32] - in x1, USBIN ;1 [33] <-- sample bit 4 - eor x2, x1 ;1 [34] - bst x2, USBMINUS;1 [35] - bld shift, 4 ;1 [36] -didUnstuff4: - andi shift, 0x9f ;1 [37] - breq unstuff4 ;1 [38] - nop2 ;2 [40] - in x2, USBIN ;1 [41] <-- sample bit 5 - eor x1, x2 ;1 [42] - bst x1, USBMINUS;1 [43] - bld shift, 5 ;1 [44] -didUnstuff5: - andi shift, 0x3f ;1 [45] - breq unstuff5 ;1 [46] - nop2 ;2 [48] - in x1, USBIN ;1 [49] <-- sample bit 6 - eor x2, x1 ;1 [50] - bst x2, USBMINUS;1 [51] - bld shift, 6 ;1 [52] -didUnstuff6: - cpi shift, 0x02 ;1 [53] - brlo unstuff6 ;1 [54] - nop2 ;2 [56] - in x2, USBIN ;1 [57] <-- sample bit 7 - eor x1, x2 ;1 [58] - bst x1, USBMINUS;1 [59] - bld shift, 7 ;1 [60] -didUnstuff7: - cpi shift, 0x04 ;1 [61] - brsh rxLoop ;2 [63] loop control -unstuff7: - andi x3, ~0x80 ;1 [63] - ori shift, 0x80 ;1 [64] - in x2, USBIN ;1 [65] <-- sample stuffed bit 7 - nop ;1 [66] - rjmp didUnstuff7 ;2 [68] - -macro POP_STANDARD ; 12 cycles - pop cnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;---------------------------------------------------------------------------- -; Transmitting data -;---------------------------------------------------------------------------- - -txByteLoop: -txBitloop: -stuffN1Delay: ; [03] - ror shift ;[-5] [11] [59] - brcc doExorN1 ;[-4] [60] - subi x4, 1 ;[-3] - brne commonN1 ;[-2] - lsl shift ;[-1] compensate ror after rjmp stuffDelay - nop ;[00] stuffing consists of just waiting 8 cycles - rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear - -sendNakAndReti: ;0 [-19] 19 cycles until SOP - ldi x3, USBPID_NAK ;1 [-18] - rjmp usbSendX3 ;2 [-16] -sendAckAndReti: ;0 [-19] 19 cycles until SOP - ldi x3, USBPID_ACK ;1 [-18] - rjmp usbSendX3 ;2 [-16] -sendCntAndReti: ;0 [-17] 17 cycles until SOP - mov x3, cnt ;1 [-16] -usbSendX3: ;0 [-16] - ldi YL, 20 ;1 [-15] 'x3' is R20 - ldi YH, 0 ;1 [-14] - ldi cnt, 2 ;1 [-13] -; rjmp usbSendAndReti fallthrough - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) or USBOUT = 0x01 -; K = (D+ = 1), (D- = 0) or USBOUT = 0x02 -; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles) - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte -;uses: x1...x2, x4, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x4 = bitstuff cnt] -;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction) -usbSendAndReti: - in x2, USBDDR ;[-12] 12 cycles until SOP - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS ;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - out USBDDR, x2 ;[-8] <--- acquire bus - in x1, USBOUT ;[-7] port mirror for tx loop - ldi shift, 0x40 ;[-6] sync byte is first byte sent (we enter loop after ror) - ldi x2, USBMASK ;[-5] - push x4 ;[-4] -doExorN1: - eor x1, x2 ;[-2] [06] [62] - ldi x4, 6 ;[-1] [07] [63] -commonN1: -stuffN2Delay: - out USBOUT, x1 ;[00] [08] [64] <--- set bit - ror shift ;[01] - brcc doExorN2 ;[02] - subi x4, 1 ;[03] - brne commonN2 ;[04] - lsl shift ;[05] compensate ror after rjmp stuffDelay - rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear -doExorN2: - eor x1, x2 ;[04] [12] - ldi x4, 6 ;[05] [13] -commonN2: - nop ;[06] [14] - subi cnt, 171 ;[07] [15] trick: (3 * 171) & 0xff = 1 - out USBOUT, x1 ;[08] [16] <--- set bit - brcs txBitloop ;[09] [25] [41] - -stuff6Delay: - ror shift ;[42] [50] - brcc doExor6 ;[43] - subi x4, 1 ;[44] - brne common6 ;[45] - lsl shift ;[46] compensate ror after rjmp stuffDelay - nop ;[47] stuffing consists of just waiting 8 cycles - rjmp stuff6Delay ;[48] after ror, C bit is reliably clear -doExor6: - eor x1, x2 ;[45] [53] - ldi x4, 6 ;[46] -common6: -stuff7Delay: - ror shift ;[47] [55] - out USBOUT, x1 ;[48] <--- set bit - brcc doExor7 ;[49] - subi x4, 1 ;[50] - brne common7 ;[51] - lsl shift ;[52] compensate ror after rjmp stuffDelay - rjmp stuff7Delay ;[53] after ror, C bit is reliably clear -doExor7: - eor x1, x2 ;[51] [59] - ldi x4, 6 ;[52] -common7: - ld shift, y+ ;[53] - tst cnt ;[55] - out USBOUT, x1 ;[56] <--- set bit - brne txByteLoop ;[57] - -;make SE0: - cbr x1, USBMASK ;[58] prepare SE0 [spec says EOP may be 15 to 18 cycles] - lds x2, usbNewDeviceAddr;[59] - lsl x2 ;[61] we compare with left shifted address - subi YL, 2 + 20 ;[62] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[63] - out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[01] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 12.5625 MHz -max frequency: 69.286 cycles for 8 bit -> 12.99 MHz -nominal frequency: 12.77 MHz ( = sqrt(min * max)) - -sampling positions: (next even number in range [+/- 0.5]) -cycle index range: 0 ... 66 -bits: -.5, 8.875, 17.25, 25.625, 34, 42.375, 50.75, 59.125 -[0/1], [9], [17], [25/+26], [34], [+42/43], [51], [59] - -bit number: 0 1 2 3 4 5 6 7 -spare cycles 1 2 1 2 1 1 1 0 - -operations to perform: duration cycle - ---------------- - eor fix, shift 1 -> 00 - andi phase, USBMASK 1 -> 08 - breq se0 1 -> 16 (moved to 11) - st y+, data 2 -> 24, 25 - mov data, fix 1 -> 33 - ser data 1 -> 41 - subi cnt, 1 1 -> 49 - brcs overflow 1 -> 50 - -layout of samples and operations: -[##] = sample bit -<##> = sample phase -*##* = operation - -0: *00* [01] 02 03 04 <05> 06 07 -1: *08* [09] 10 11 12 <13> 14 15 *16* -2: [17] 18 19 20 <21> 22 23 -3: *24* *25* [26] 27 28 29 <30> 31 32 -4: *33* [34] 35 36 37 <38> 39 40 -5: *41* [42] 43 44 45 <46> 47 48 -6: *49* *50* [51] 52 53 54 <55> 56 57 58 -7: [59] 60 61 62 <63> 64 65 66 -*****************************************************************************/ - -/* we prefer positive expressions (do if condition) instead of negative - * (skip if condition), therefore use defines for skip instructions: - */ -#define ifioclr sbis -#define ifioset sbic -#define ifrclr sbrs -#define ifrset sbrc - -/* The registers "fix" and "data" swap their meaning during the loop. Use - * defines to keep their name constant. - */ -#define fix x2 -#define data x1 -#undef phase /* phase has a default definition to x4 */ -#define phase x3 - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt, r0 - push YL ;2 push only what is necessary to sync with edge ASAP - in YL, SREG ;1 - push YL ;2 -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of 1/4 bit which meets the spec. - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS ;[0] - rjmp foundK ;[1] -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError - -foundK: -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push YH ;[2] - lds YL, usbInputBufOffset;[4] - clr YH ;[6] - subi YL, lo8(-(usbRxBuf));[7] - sbci YH, hi8(-(usbRxBuf));[8] - - sbis USBIN, USBMINUS ;[9] we want two bits K [we want to sample at 8 + 4 - 1.5 = 10.5] - rjmp haveTwoBitsK ;[10] - pop YH ;[11] undo the push from before - rjmp waitForK ;[13] this was not the end of sync, retry -haveTwoBitsK: -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -#define fix x2 -#define data x1 - - push shift ;[12] - push x1 ;[14] - push x2 ;[16] - ldi shift, 0x80 ;[18] prevent bit-unstuffing but init low bits to 0 - ifioset USBIN, USBMINUS ;[19] [01] <--- bit 0 [10.5 + 8 = 18.5] - ori shift, 1<<0 ;[02] - push x3 ;[03] - push cnt ;[05] - push r0 ;[07] - ifioset USBIN, USBMINUS ;[09] <--- bit 1 - ori shift, 1<<1 ;[10] - ser fix ;[11] - ldi cnt, USB_BUFSIZE ;[12] - mov data, shift ;[13] - lsl shift ;[14] - nop2 ;[15] - ifioset USBIN, USBMINUS ;[17] <--- bit 2 - ori data, 3<<2 ;[18] store in bit 2 AND bit 3 - eor shift, data ;[19] do nrzi decoding - andi data, 1<<3 ;[20] - in phase, USBIN ;[21] <- phase - brne jumpToEntryAfterSet ;[22] if USBMINS at bit 3 was 1 - nop ;[23] - rjmp entryAfterClr ;[24] -jumpToEntryAfterSet: - rjmp entryAfterSet ;[24] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -#undef fix -#define fix x1 -#undef data -#define data x2 - -bit7IsSet: - ifrclr phase, USBMINUS ;[62] check phase only if D- changed - lpm ;[63] - in phase, USBIN ;[64] <- phase (one cycle too late) - ori shift, 1 << 7 ;[65] - nop ;[66] -;;;;rjmp bit0AfterSet ; -> [00] == [67] moved block up to save jump -bit0AfterSet: - eor fix, shift ;[00] -#undef fix -#define fix x2 -#undef data -#define data x1 /* we now have result in data, fix is reset to 0xff */ - ifioclr USBIN, USBMINUS ;[01] <--- sample 0 - rjmp bit0IsClr ;[02] - andi shift, ~(7 << 0) ;[03] - breq unstuff0s ;[04] - in phase, USBIN ;[05] <- phase - rjmp bit1AfterSet ;[06] -unstuff0s: - in phase, USBIN ;[06] <- phase (one cycle too late) - andi fix, ~(1 << 0) ;[07] - ifioclr USBIN, USBMINUS ;[00] - ifioset USBIN, USBPLUS ;[01] - rjmp bit0IsClr ;[02] executed if first expr false or second true -jumpToSe0AndStore: - rjmp se0AndStore ;[03] executed only if both bits 0 -bit0IsClr: - ifrset phase, USBMINUS ;[04] check phase only if D- changed - lpm ;[05] - in phase, USBIN ;[06] <- phase (one cycle too late) - ori shift, 1 << 0 ;[07] -bit1AfterClr: - andi phase, USBMASK ;[08] - ifioset USBIN, USBMINUS ;[09] <--- sample 1 - rjmp bit1IsSet ;[10] - breq jumpToSe0AndStore ;[11] - andi shift, ~(7 << 1) ;[12] - in phase, USBIN ;[13] <- phase - breq unstuff1c ;[14] - rjmp bit2AfterClr ;[15] -unstuff1c: - andi fix, ~(1 << 1) ;[16] - nop2 ;[08] - nop2 ;[10] -bit1IsSet: - ifrclr phase, USBMINUS ;[12] check phase only if D- changed - lpm ;[13] - in phase, USBIN ;[14] <- phase (one cycle too late) - ori shift, 1 << 1 ;[15] - nop ;[16] -bit2AfterSet: - ifioclr USBIN, USBMINUS ;[17] <--- sample 2 - rjmp bit2IsClr ;[18] - andi shift, ~(7 << 2) ;[19] - breq unstuff2s ;[20] - in phase, USBIN ;[21] <- phase - rjmp bit3AfterSet ;[22] -unstuff2s: - in phase, USBIN ;[22] <- phase (one cycle too late) - andi fix, ~(1 << 2) ;[23] - nop2 ;[16] - nop2 ;[18] -bit2IsClr: - ifrset phase, USBMINUS ;[20] check phase only if D- changed - lpm ;[21] - in phase, USBIN ;[22] <- phase (one cycle too late) - ori shift, 1 << 2 ;[23] -bit3AfterClr: - st y+, data ;[24] -entryAfterClr: - ifioset USBIN, USBMINUS ;[26] <--- sample 3 - rjmp bit3IsSet ;[27] - andi shift, ~(7 << 3) ;[28] - breq unstuff3c ;[29] - in phase, USBIN ;[30] <- phase - rjmp bit4AfterClr ;[31] -unstuff3c: - in phase, USBIN ;[31] <- phase (one cycle too late) - andi fix, ~(1 << 3) ;[32] - nop2 ;[25] - nop2 ;[27] -bit3IsSet: - ifrclr phase, USBMINUS ;[29] check phase only if D- changed - lpm ;[30] - in phase, USBIN ;[31] <- phase (one cycle too late) - ori shift, 1 << 3 ;[32] -bit4AfterSet: - mov data, fix ;[33] undo this move by swapping defines -#undef fix -#define fix x1 -#undef data -#define data x2 - ifioclr USBIN, USBMINUS ;[34] <--- sample 4 - rjmp bit4IsClr ;[35] - andi shift, ~(7 << 4) ;[36] - breq unstuff4s ;[37] - in phase, USBIN ;[38] <- phase - rjmp bit5AfterSet ;[39] -unstuff4s: - in phase, USBIN ;[39] <- phase (one cycle too late) - andi fix, ~(1 << 4) ;[40] - nop2 ;[33] - nop2 ;[35] -bit4IsClr: - ifrset phase, USBMINUS ;[37] check phase only if D- changed - lpm ;[38] - in phase, USBIN ;[39] <- phase (one cycle too late) - ori shift, 1 << 4 ;[40] -bit5AfterClr: - ser data ;[41] - ifioset USBIN, USBMINUS ;[42] <--- sample 5 - rjmp bit5IsSet ;[43] - andi shift, ~(7 << 5) ;[44] - breq unstuff5c ;[45] - in phase, USBIN ;[46] <- phase - rjmp bit6AfterClr ;[47] -unstuff5c: - in phase, USBIN ;[47] <- phase (one cycle too late) - andi fix, ~(1 << 5) ;[48] - nop2 ;[41] - nop2 ;[43] -bit5IsSet: - ifrclr phase, USBMINUS ;[45] check phase only if D- changed - lpm ;[46] - in phase, USBIN ;[47] <- phase (one cycle too late) - ori shift, 1 << 5 ;[48] -bit6AfterSet: - subi cnt, 1 ;[49] - brcs jumpToOverflow ;[50] - ifioclr USBIN, USBMINUS ;[51] <--- sample 6 - rjmp bit6IsClr ;[52] - andi shift, ~(3 << 6) ;[53] - cpi shift, 2 ;[54] - in phase, USBIN ;[55] <- phase - brlt unstuff6s ;[56] - rjmp bit7AfterSet ;[57] - -jumpToOverflow: - rjmp overflow - -unstuff6s: - andi fix, ~(1 << 6) ;[50] - lpm ;[51] -bit6IsClr: - ifrset phase, USBMINUS ;[54] check phase only if D- changed - lpm ;[55] - in phase, USBIN ;[56] <- phase (one cycle too late) - ori shift, 1 << 6 ;[57] - nop ;[58] -bit7AfterClr: - ifioset USBIN, USBMINUS ;[59] <--- sample 7 - rjmp bit7IsSet ;[60] - andi shift, ~(1 << 7) ;[61] - cpi shift, 4 ;[62] - in phase, USBIN ;[63] <- phase - brlt unstuff7c ;[64] - rjmp bit0AfterClr ;[65] -> [00] == [67] -unstuff7c: - andi fix, ~(1 << 7) ;[58] - nop ;[59] - rjmp bit7IsSet ;[60] - -se0AndStore: - st y+, x1 ;[15/17] cycles after start of byte - rjmp se0 ;[17/19] - -bit7IsClr: - ifrset phase, USBMINUS ;[62] check phase only if D- changed - lpm ;[63] - in phase, USBIN ;[64] <- phase (one cycle too late) - ori shift, 1 << 7 ;[65] - nop ;[66] -;;;;rjmp bit0AfterClr ; -> [00] == [67] moved block up to save jump -bit0AfterClr: - eor fix, shift ;[00] -#undef fix -#define fix x2 -#undef data -#define data x1 /* we now have result in data, fix is reset to 0xff */ - ifioset USBIN, USBMINUS ;[01] <--- sample 0 - rjmp bit0IsSet ;[02] - andi shift, ~(7 << 0) ;[03] - breq unstuff0c ;[04] - in phase, USBIN ;[05] <- phase - rjmp bit1AfterClr ;[06] -unstuff0c: - in phase, USBIN ;[06] <- phase (one cycle too late) - andi fix, ~(1 << 0) ;[07] - ifioclr USBIN, USBMINUS ;[00] - ifioset USBIN, USBPLUS ;[01] - rjmp bit0IsSet ;[02] executed if first expr false or second true - rjmp se0AndStore ;[03] executed only if both bits 0 -bit0IsSet: - ifrclr phase, USBMINUS ;[04] check phase only if D- changed - lpm ;[05] - in phase, USBIN ;[06] <- phase (one cycle too late) - ori shift, 1 << 0 ;[07] -bit1AfterSet: - andi phase, USBMASK ;[08] - ifioclr USBIN, USBMINUS ;[09] <--- sample 1 - rjmp bit1IsClr ;[10] - andi shift, ~(7 << 1) ;[11] - breq unstuff1s ;[12] - in phase, USBIN ;[13] <- phase - nop ;[14] - rjmp bit2AfterSet ;[15] -unstuff1s: - in phase, USBIN ;[14] <- phase (one cycle too late) - andi fix, ~(1 << 1) ;[15] - nop2 ;[08] - nop2 ;[10] -bit1IsClr: - ifrset phase, USBMINUS ;[12] check phase only if D- changed - lpm ;[13] - in phase, USBIN ;[14] <- phase (one cycle too late) - breq se0AndStore ;[15] if we come from unstuff1s, Z bit is never set - ori shift, 1 << 1 ;[16] -bit2AfterClr: - ifioset USBIN, USBMINUS ;[17] <--- sample 2 - rjmp bit2IsSet ;[18] - andi shift, ~(7 << 2) ;[19] - breq unstuff2c ;[20] - in phase, USBIN ;[21] <- phase - rjmp bit3AfterClr ;[22] -unstuff2c: - in phase, USBIN ;[22] <- phase (one cycle too late) - andi fix, ~(1 << 2) ;[23] - nop2 ;[16] - nop2 ;[18] -bit2IsSet: - ifrclr phase, USBMINUS ;[20] check phase only if D- changed - lpm ;[21] - in phase, USBIN ;[22] <- phase (one cycle too late) - ori shift, 1 << 2 ;[23] -bit3AfterSet: - st y+, data ;[24] -entryAfterSet: - ifioclr USBIN, USBMINUS ;[26] <--- sample 3 - rjmp bit3IsClr ;[27] - andi shift, ~(7 << 3) ;[28] - breq unstuff3s ;[29] - in phase, USBIN ;[30] <- phase - rjmp bit4AfterSet ;[31] -unstuff3s: - in phase, USBIN ;[31] <- phase (one cycle too late) - andi fix, ~(1 << 3) ;[32] - nop2 ;[25] - nop2 ;[27] -bit3IsClr: - ifrset phase, USBMINUS ;[29] check phase only if D- changed - lpm ;[30] - in phase, USBIN ;[31] <- phase (one cycle too late) - ori shift, 1 << 3 ;[32] -bit4AfterClr: - mov data, fix ;[33] undo this move by swapping defines -#undef fix -#define fix x1 -#undef data -#define data x2 - ifioset USBIN, USBMINUS ;[34] <--- sample 4 - rjmp bit4IsSet ;[35] - andi shift, ~(7 << 4) ;[36] - breq unstuff4c ;[37] - in phase, USBIN ;[38] <- phase - rjmp bit5AfterClr ;[39] -unstuff4c: - in phase, USBIN ;[39] <- phase (one cycle too late) - andi fix, ~(1 << 4) ;[40] - nop2 ;[33] - nop2 ;[35] -bit4IsSet: - ifrclr phase, USBMINUS ;[37] check phase only if D- changed - lpm ;[38] - in phase, USBIN ;[39] <- phase (one cycle too late) - ori shift, 1 << 4 ;[40] -bit5AfterSet: - ser data ;[41] - ifioclr USBIN, USBMINUS ;[42] <--- sample 5 - rjmp bit5IsClr ;[43] - andi shift, ~(7 << 5) ;[44] - breq unstuff5s ;[45] - in phase, USBIN ;[46] <- phase - rjmp bit6AfterSet ;[47] -unstuff5s: - in phase, USBIN ;[47] <- phase (one cycle too late) - andi fix, ~(1 << 5) ;[48] - nop2 ;[41] - nop2 ;[43] -bit5IsClr: - ifrset phase, USBMINUS ;[45] check phase only if D- changed - lpm ;[46] - in phase, USBIN ;[47] <- phase (one cycle too late) - ori shift, 1 << 5 ;[48] -bit6AfterClr: - subi cnt, 1 ;[49] - brcs overflow ;[50] - ifioset USBIN, USBMINUS ;[51] <--- sample 6 - rjmp bit6IsSet ;[52] - andi shift, ~(3 << 6) ;[53] - cpi shift, 2 ;[54] - in phase, USBIN ;[55] <- phase - brlt unstuff6c ;[56] - rjmp bit7AfterClr ;[57] -unstuff6c: - andi fix, ~(1 << 6) ;[50] - lpm ;[51] -bit6IsSet: - ifrclr phase, USBMINUS ;[54] check phase only if D- changed - lpm ;[55] - in phase, USBIN ;[56] <- phase (one cycle too late) - ori shift, 1 << 6 ;[57] -bit7AfterSet: - ifioclr USBIN, USBMINUS ;[59] <--- sample 7 - rjmp bit7IsClr ;[60] - andi shift, ~(1 << 7) ;[61] - cpi shift, 4 ;[62] - in phase, USBIN ;[63] <- phase - brlt unstuff7s ;[64] - rjmp bit0AfterSet ;[65] -> [00] == [67] -unstuff7s: - andi fix, ~(1 << 7) ;[58] - nop ;[59] - rjmp bit7IsClr ;[60] - -macro POP_STANDARD ; 14 cycles - pop r0 - pop cnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;---------------------------------------------------------------------------- -; Transmitting data -;---------------------------------------------------------------------------- - -txByteLoop: -txBitloop: -stuffN1Delay: ; [03] - ror shift ;[-5] [11] [63] - brcc doExorN1 ;[-4] [64] - subi x3, 1 ;[-3] - brne commonN1 ;[-2] - lsl shift ;[-1] compensate ror after rjmp stuffDelay - nop ;[00] stuffing consists of just waiting 8 cycles - rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear - -sendNakAndReti: - ldi cnt, USBPID_NAK ;[-19] - rjmp sendCntAndReti ;[-18] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov r0, cnt ;[-16] - ldi YL, 0 ;[-15] R0 address is 0 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) or USBOUT = 0x01 -; K = (D+ = 1), (D- = 0) or USBOUT = 0x02 -; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles) - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte -;uses: x1...x3, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x3 = bitstuff cnt] -;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction) -usbSendAndReti: - in x2, USBDDR ;[-10] 10 cycles until SOP - ori x2, USBMASK ;[-9] - sbi USBOUT, USBMINUS ;[-8] prepare idle state; D+ and D- must have been 0 (no pullups) - out USBDDR, x2 ;[-6] <--- acquire bus - in x1, USBOUT ;[-5] port mirror for tx loop - ldi shift, 0x40 ;[-4] sync byte is first byte sent (we enter loop after ror) - ldi x2, USBMASK ;[-3] -doExorN1: - eor x1, x2 ;[-2] [06] [62] - ldi x3, 6 ;[-1] [07] [63] -commonN1: -stuffN2Delay: - out USBOUT, x1 ;[00] [08] [64] <--- set bit - ror shift ;[01] - brcc doExorN2 ;[02] - subi x3, 1 ;[03] - brne commonN2 ;[04] - lsl shift ;[05] compensate ror after rjmp stuffDelay - rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear -doExorN2: - eor x1, x2 ;[04] [12] - ldi x3, 6 ;[05] [13] -commonN2: - nop2 ;[06] [14] - subi cnt, 171 ;[08] [16] trick: (3 * 171) & 0xff = 1 - out USBOUT, x1 ;[09] [17] <--- set bit - brcs txBitloop ;[10] [27] [44] - -stuff6Delay: - ror shift ;[45] [53] - brcc doExor6 ;[46] - subi x3, 1 ;[47] - brne common6 ;[48] - lsl shift ;[49] compensate ror after rjmp stuffDelay - nop ;[50] stuffing consists of just waiting 8 cycles - rjmp stuff6Delay ;[51] after ror, C bit is reliably clear -doExor6: - eor x1, x2 ;[48] [56] - ldi x3, 6 ;[49] -common6: -stuff7Delay: - ror shift ;[50] [58] - out USBOUT, x1 ;[51] <--- set bit - brcc doExor7 ;[52] - subi x3, 1 ;[53] - brne common7 ;[54] - lsl shift ;[55] compensate ror after rjmp stuffDelay - rjmp stuff7Delay ;[56] after ror, C bit is reliably clear -doExor7: - eor x1, x2 ;[54] [62] - ldi x3, 6 ;[55] -common7: - ld shift, y+ ;[56] - nop ;[58] - tst cnt ;[59] - out USBOUT, x1 ;[60] [00]<--- set bit - brne txByteLoop ;[61] [01] -;make SE0: - cbr x1, USBMASK ;[02] prepare SE0 [spec says EOP may be 15 to 18 cycles] - lds x2, usbNewDeviceAddr;[03] - lsl x2 ;[05] we compare with left shifted address - subi YL, 2 + 0 ;[06] Only assign address on data packets, not ACK/NAK in r0 - sbci YH, 0 ;[07] - out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[01] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 0) - echo "$s\n"; - } -} - -function printBit($isAfterSet, $bitNum) -{ - ob_start(); - if($isAfterSet){ -?> - ifioclr USBIN, USBMINUS ;[00] <--- sample - rjmp bit#IsClr ;[01] - andi shift, ~(7 << #) ;[02] - breq unstuff#s ;[03] - in phase, USBIN ;[04] <- phase - rjmp bit@AfterSet ;[05] -unstuff#s: - in phase, USBIN ;[05] <- phase (one cycle too late) - andi fix, ~(1 << #) ;[06] - nop2 ;[-1] - nop2 ;[01] -bit#IsClr: - ifrset phase, USBMINUS ;[03] check phase only if D- changed - lpm ;[04] - in phase, USBIN ;[05] <- phase (one cycle too late) - ori shift, 1 << # ;[06] - - ifioset USBIN, USBMINUS ;[00] <--- sample - rjmp bit#IsSet ;[01] - andi shift, ~(7 << #) ;[02] - breq unstuff#c ;[03] - in phase, USBIN ;[04] <- phase - rjmp bit@AfterClr ;[05] -unstuff#c: - in phase, USBIN ;[05] <- phase (one cycle too late) - andi fix, ~(1 << #) ;[06] - nop2 ;[-1] - nop2 ;[01] -bit#IsSet: - ifrclr phase, USBMINUS ;[03] check phase only if D- changed - lpm ;[04] - in phase, USBIN ;[05] <- phase (one cycle too late) - ori shift, 1 << # ;[06] - -*****************************************************************************/ diff --git a/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm15.inc b/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm15.inc deleted file mode 100644 index 401b7f8..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm15.inc +++ /dev/null @@ -1,423 +0,0 @@ -/* Name: usbdrvasm15.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: contributed by V. Bosch - * Creation Date: 2007-08-06 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm15.inc 740 2009-04-13 18:23:31Z cs $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 15 MHz version of the asssembler part of the USB driver. It -requires a 15 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! -*/ - -;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 15 MHz -> 10.0 cycles per bit, 80.0 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - -;---------------------------------------------------------------------------- -; order of registers pushed: -; YL, SREG [sofError] YH, shift, x1, x2, x3, bitcnt, cnt, x4 -;---------------------------------------------------------------------------- -USB_INTR_VECTOR: - push YL ;2 push only what is necessary to sync with edge ASAP - in YL, SREG ;1 - push YL ;2 -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -; -; sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -; sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -;------------------------------------------------------------------------------- -; The following code results in a sampling window of < 1/4 bit -; which meets the spec. -;------------------------------------------------------------------------------- -waitForK: ;- - sbis USBIN, USBMINUS ;1 [00] <-- sample - rjmp foundK ;2 [01] - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -;------------------------------------------------------------------------------ -; {3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for -; center sampling] -; we have 1 bit time for setup purposes, then sample again. -; Numbers in brackets are cycles from center of first sync (double K) -; bit after the instruction -;------------------------------------------------------------------------------ -foundK: ;- [02] - lds YL, usbInputBufOffset;2 [03+04] tx loop - push YH ;2 [05+06] - clr YH ;1 [07] - subi YL, lo8(-(usbRxBuf)) ;1 [08] [rx loop init] - sbci YH, hi8(-(usbRxBuf)) ;1 [09] [rx loop init] - push shift ;2 [10+11] - ser shift ;1 [12] - sbis USBIN, USBMINUS ;1 [-1] [13] <--sample:we want two bits K (sample 1 cycle too early) - rjmp haveTwoBitsK ;2 [00] [14] - pop shift ;2 [15+16] undo the push from before - pop YH ;2 [17+18] undo the push from before - rjmp waitForK ;2 [19+20] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 20 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: ;- [01] - push x1 ;2 [02+03] - push x2 ;2 [04+05] - push x3 ;2 [06+07] - push bitcnt ;2 [08+09] - in x1, USBIN ;1 [00] [10] <-- sample bit 0 - bst x1, USBMINUS ;1 [01] - bld shift, 0 ;1 [02] - push cnt ;2 [03+04] - ldi cnt, USB_BUFSIZE ;1 [05] - push x4 ;2 [06+07] tx loop - rjmp rxLoop ;2 [08] -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -unstuff0: ;- [07] (branch taken) - andi x3, ~0x01 ;1 [08] - mov x1, x2 ;1 [09] x2 contains last sampled (stuffed) bit - in x2, USBIN ;1 [00] [10] <-- sample bit 1 again - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 1 - ori shift, 0x01 ;1 [03] 0b00000001 - nop ;1 [04] - rjmp didUnstuff0 ;2 [05] -;----------------------------------------------------- -unstuff1: ;- [05] (branch taken) - mov x2, x1 ;1 [06] x1 contains last sampled (stuffed) bit - andi x3, ~0x02 ;1 [07] - ori shift, 0x02 ;1 [08] 0b00000010 - nop ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 2 again - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 2 - rjmp didUnstuff1 ;2 [03] -;----------------------------------------------------- -unstuff2: ;- [05] (branch taken) - andi x3, ~0x04 ;1 [06] - ori shift, 0x04 ;1 [07] 0b00000100 - mov x1, x2 ;1 [08] x2 contains last sampled (stuffed) bit - nop ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample bit 3 - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 3 - rjmp didUnstuff2 ;2 [03] -;----------------------------------------------------- -unstuff3: ;- [00] [10] (branch taken) - in x2, USBIN ;1 [01] [11] <-- sample stuffed bit 3 one cycle too late - andi x2, USBMASK ;1 [02] - breq se0Hop ;1 [03] SE0 check for stuffed bit 3 - andi x3, ~0x08 ;1 [04] - ori shift, 0x08 ;1 [05] 0b00001000 - rjmp didUnstuff3 ;2 [06] -;---------------------------------------------------------------------------- -; extra jobs done during bit interval: -; -; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs], -; overflow check, jump to the head of rxLoop -; bit 1: SE0 check -; bit 2: SE0 check, recovery from delay [bit 0 tasks took too long] -; bit 3: SE0 check, recovery from delay [bit 0 tasks took too long] -; bit 4: SE0 check, none -; bit 5: SE0 check, none -; bit 6: SE0 check, none -; bit 7: SE0 check, reconstruct: x3 is 0 at bit locations we changed, 1 at others -;---------------------------------------------------------------------------- -rxLoop: ;- [09] - in x2, USBIN ;1 [00] [10] <-- sample bit 1 (or possibly bit 0 stuffed) - andi x2, USBMASK ;1 [01] - brne SkipSe0Hop ;1 [02] -se0Hop: ;- [02] - rjmp se0 ;2 [03] SE0 check for bit 1 -SkipSe0Hop: ;- [03] - ser x3 ;1 [04] - andi shift, 0xf9 ;1 [05] 0b11111001 - breq unstuff0 ;1 [06] -didUnstuff0: ;- [06] - eor x1, x2 ;1 [07] - bst x1, USBMINUS ;1 [08] - bld shift, 1 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 2 (or possibly bit 1 stuffed) - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 2 - andi shift, 0xf3 ;1 [03] 0b11110011 - breq unstuff1 ;1 [04] do remaining work for bit 1 -didUnstuff1: ;- [04] - eor x2, x1 ;1 [05] - bst x2, USBMINUS ;1 [06] - bld shift, 2 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 3 (or possibly bit 2 stuffed) - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 3 - andi shift, 0xe7 ;1 [03] 0b11100111 - breq unstuff2 ;1 [04] -didUnstuff2: ;- [04] - eor x1, x2 ;1 [05] - bst x1, USBMINUS ;1 [06] - bld shift, 3 ;1 [07] -didUnstuff3: ;- [07] - andi shift, 0xcf ;1 [08] 0b11001111 - breq unstuff3 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 4 - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 4 - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 4 ;1 [05] -didUnstuff4: ;- [05] - andi shift, 0x9f ;1 [06] 0b10011111 - breq unstuff4 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 5 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 5 - eor x1, x2 ;1 [03] - bst x1, USBMINUS ;1 [04] - bld shift, 5 ;1 [05] -didUnstuff5: ;- [05] - andi shift, 0x3f ;1 [06] 0b00111111 - breq unstuff5 ;1 [07] - nop2 ;2 [08+09] - in x1, USBIN ;1 [00] [10] <-- sample bit 6 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 6 - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 6 ;1 [05] -didUnstuff6: ;- [05] - cpi shift, 0x02 ;1 [06] 0b00000010 - brlo unstuff6 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 7 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 7 - eor x1, x2 ;1 [03] - bst x1, USBMINUS ;1 [04] - bld shift, 7 ;1 [05] -didUnstuff7: ;- [05] - cpi shift, 0x04 ;1 [06] 0b00000100 - brlo unstuff7 ;1 [07] - eor x3, shift ;1 [08] reconstruct: x3 is 0 at bit locations we changed, 1 at others - nop ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 0 - st y+, x3 ;2 [01+02] store data - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 0 ;1 [05] - subi cnt, 1 ;1 [06] - brcs overflow ;1 [07] - rjmp rxLoop ;2 [08] -;----------------------------------------------------- -unstuff4: ;- [08] - andi x3, ~0x10 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 4 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 4 - ori shift, 0x10 ;1 [03] - rjmp didUnstuff4 ;2 [04] -;----------------------------------------------------- -unstuff5: ;- [08] - ori shift, 0x20 ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 5 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 5 - andi x3, ~0x20 ;1 [03] - rjmp didUnstuff5 ;2 [04] -;----------------------------------------------------- -unstuff6: ;- [08] - andi x3, ~0x40 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 6 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 6 - ori shift, 0x40 ;1 [03] - rjmp didUnstuff6 ;2 [04] -;----------------------------------------------------- -unstuff7: ;- [08] - andi x3, ~0x80 ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 7 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 7 - ori shift, 0x80 ;1 [03] - rjmp didUnstuff7 ;2 [04] - -macro POP_STANDARD ; 16 cycles - pop x4 - pop cnt - pop bitcnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;--------------------------------------------------------------------------- -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies -;--------------------------------------------------------------------------- -bitstuffN: ;- [04] - eor x1, x4 ;1 [05] - clr x2 ;1 [06] - nop ;1 [07] - rjmp didStuffN ;1 [08] -;--------------------------------------------------------------------------- -bitstuff6: ;- [04] - eor x1, x4 ;1 [05] - clr x2 ;1 [06] - rjmp didStuff6 ;1 [07] -;--------------------------------------------------------------------------- -bitstuff7: ;- [02] - eor x1, x4 ;1 [03] - clr x2 ;1 [06] - nop ;1 [05] - rjmp didStuff7 ;1 [06] -;--------------------------------------------------------------------------- -sendNakAndReti: ;- [-19] - ldi x3, USBPID_NAK ;1 [-18] - rjmp sendX3AndReti ;1 [-17] -;--------------------------------------------------------------------------- -sendAckAndReti: ;- [-17] - ldi cnt, USBPID_ACK ;1 [-16] -sendCntAndReti: ;- [-16] - mov x3, cnt ;1 [-15] -sendX3AndReti: ;- [-15] - ldi YL, 20 ;1 [-14] x3==r20 address is 20 - ldi YH, 0 ;1 [-13] - ldi cnt, 2 ;1 [-12] -; rjmp usbSendAndReti fallthrough -;--------------------------------------------------------------------------- -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -;We need not to match the transfer rate exactly because the spec demands -;only 1.5% precision anyway. -usbSendAndReti: ;- [-13] 13 cycles until SOP - in x2, USBDDR ;1 [-12] - ori x2, USBMASK ;1 [-11] - sbi USBOUT, USBMINUS ;2 [-09-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;1 [-08] port mirror for tx loop - out USBDDR, x2 ;1 [-07] <- acquire bus - ; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;1 [-06] exor mask - ldi shift, 0x80 ;1 [-05] sync byte is first byte sent - ldi bitcnt, 6 ;1 [-04] -txBitLoop: ;- [-04] [06] - sbrs shift, 0 ;1 [-03] [07] - eor x1, x4 ;1 [-02] [08] - ror shift ;1 [-01] [09] -didStuffN: ;- [09] - out USBOUT, x1 ;1 [00] [10] <-- out N - ror x2 ;1 [01] - cpi x2, 0xfc ;1 [02] - brcc bitstuffN ;1 [03] - dec bitcnt ;1 [04] - brne txBitLoop ;1 [05] - sbrs shift, 0 ;1 [06] - eor x1, x4 ;1 [07] - ror shift ;1 [08] -didStuff6: ;- [08] - nop ;1 [09] - out USBOUT, x1 ;1 [00] [10] <-- out 6 - ror x2 ;1 [01] - cpi x2, 0xfc ;1 [02] - brcc bitstuff6 ;1 [03] - sbrs shift, 0 ;1 [04] - eor x1, x4 ;1 [05] - ror shift ;1 [06] - ror x2 ;1 [07] -didStuff7: ;- [07] - ldi bitcnt, 6 ;1 [08] - cpi x2, 0xfc ;1 [09] - out USBOUT, x1 ;1 [00] [10] <-- out 7 - brcc bitstuff7 ;1 [01] - ld shift, y+ ;2 [02+03] - dec cnt ;1 [04] - brne txBitLoop ;1 [05] -makeSE0: - cbr x1, USBMASK ;1 [06] prepare SE0 [spec says EOP may be 19 to 23 cycles] - lds x2, usbNewDeviceAddr;2 [07+08] - lsl x2 ;1 [09] we compare with left shifted address -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - out USBOUT, x1 ;1 [00] [10] <-- out SE0-- from now 2 bits==20 cycl. until bus idle - subi YL, 20 + 2 ;1 [01] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;1 [02] - breq skipAddrAssign ;1 [03] - sts usbDeviceAddr, x2 ;2 [04+05] if not skipped: SE0 is one cycle longer -;---------------------------------------------------------------------------- -;end of usbDeviceAddress transfer -skipAddrAssign: ;- [03/04] - ldi x2, 1< 10.6666666 cycles per bit, 85.333333333 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt - push YL ;[-25] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-23] - push YL ;[-22] - push YH ;[-20] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-15] - rjmp foundK ;[-14] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-12] -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push bitcnt ;[-12] -; [---] ;[-11] - lds YL, usbInputBufOffset;[-10] -; [---] ;[-9] - clr YH ;[-8] - subi YL, lo8(-(usbRxBuf));[-7] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-6] [rx loop init] - push shift ;[-5] -; [---] ;[-4] - ldi bitcnt, 0x55 ;[-3] [rx loop init] - sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) - rjmp haveTwoBitsK ;[-1] - pop shift ;[0] undo the push from before - pop bitcnt ;[2] undo the push from before - rjmp waitForK ;[4] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 21 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[1] - push x2 ;[3] - push x3 ;[5] - ldi shift, 0 ;[7] - ldi x3, 1<<4 ;[8] [rx loop init] first sample is inverse bit, compensate that - push x4 ;[9] == leap - - in x1, USBIN ;[11] <-- sample bit 0 - andi x1, USBMASK ;[12] - bst x1, USBMINUS ;[13] - bld shift, 7 ;[14] - push cnt ;[15] - ldi leap, 0 ;[17] [rx loop init] - ldi cnt, USB_BUFSIZE;[18] [rx loop init] - rjmp rxbit1 ;[19] arrives at [21] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- - -unstuff6: - andi x2, USBMASK ;[03] - ori x3, 1<<6 ;[04] will not be shifted any more - andi shift, ~0x80;[05] - mov x1, x2 ;[06] sampled bit 7 is actually re-sampled bit 6 - subi leap, 3 ;[07] since this is a short (10 cycle) bit, enforce leap bit - rjmp didUnstuff6 ;[08] - -unstuff7: - ori x3, 1<<7 ;[09] will not be shifted any more - in x2, USBIN ;[00] [10] re-sample bit 7 - andi x2, USBMASK ;[01] - andi shift, ~0x80;[02] - subi leap, 3 ;[03] since this is a short (10 cycle) bit, enforce leap bit - rjmp didUnstuff7 ;[04] - -unstuffEven: - ori x3, 1<<6 ;[09] will be shifted right 6 times for bit 0 - in x1, USBIN ;[00] [10] - andi shift, ~0x80;[01] - andi x1, USBMASK ;[02] - breq se0 ;[03] - subi leap, 3 ;[04] since this is a short (10 cycle) bit, enforce leap bit - nop ;[05] - rjmp didUnstuffE ;[06] - -unstuffOdd: - ori x3, 1<<5 ;[09] will be shifted right 4 times for bit 1 - in x2, USBIN ;[00] [10] - andi shift, ~0x80;[01] - andi x2, USBMASK ;[02] - breq se0 ;[03] - subi leap, 3 ;[04] since this is a short (10 cycle) bit, enforce leap bit - nop ;[05] - rjmp didUnstuffO ;[06] - -rxByteLoop: - andi x1, USBMASK ;[03] - eor x2, x1 ;[04] - subi leap, 1 ;[05] - brpl skipLeap ;[06] - subi leap, -3 ;1 one leap cycle every 3rd byte -> 85 + 1/3 cycles per byte - nop ;1 -skipLeap: - subi x2, 1 ;[08] - ror shift ;[09] -didUnstuff6: - cpi shift, 0xfc ;[10] - in x2, USBIN ;[00] [11] <-- sample bit 7 - brcc unstuff6 ;[01] - andi x2, USBMASK ;[02] - eor x1, x2 ;[03] - subi x1, 1 ;[04] - ror shift ;[05] -didUnstuff7: - cpi shift, 0xfc ;[06] - brcc unstuff7 ;[07] - eor x3, shift ;[08] reconstruct: x3 is 1 at bit locations we changed, 0 at others - st y+, x3 ;[09] store data -rxBitLoop: - in x1, USBIN ;[00] [11] <-- sample bit 0/2/4 - andi x1, USBMASK ;[01] - eor x2, x1 ;[02] - andi x3, 0x3f ;[03] topmost two bits reserved for 6 and 7 - subi x2, 1 ;[04] - ror shift ;[05] - cpi shift, 0xfc ;[06] - brcc unstuffEven ;[07] -didUnstuffE: - lsr x3 ;[08] - lsr x3 ;[09] -rxbit1: - in x2, USBIN ;[00] [10] <-- sample bit 1/3/5 - andi x2, USBMASK ;[01] - breq se0 ;[02] - eor x1, x2 ;[03] - subi x1, 1 ;[04] - ror shift ;[05] - cpi shift, 0xfc ;[06] - brcc unstuffOdd ;[07] -didUnstuffO: - subi bitcnt, 0xab;[08] == addi 0x55, 0x55 = 0x100/3 - brcs rxBitLoop ;[09] - - subi cnt, 1 ;[10] - in x1, USBIN ;[00] [11] <-- sample bit 6 - brcc rxByteLoop ;[01] - rjmp overflow - -macro POP_STANDARD ; 14 cycles - pop cnt - pop x4 - pop x3 - pop x2 - pop x1 - pop shift - pop bitcnt - endm -macro POP_RETI ; 7 cycles - pop YH - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies - -bitstuffN: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] - nop2 ;[7] - nop ;[9] - out USBOUT, x1 ;[10] <-- out - rjmp didStuffN ;[0] - -bitstuff6: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] Carry is zero due to brcc - rol shift ;[7] compensate for ror shift at branch destination - rjmp didStuff6 ;[8] - -bitstuff7: - ldi x2, 0 ;[2] Carry is zero due to brcc - rjmp didStuff7 ;[3] - - -sendNakAndReti: - ldi x3, USBPID_NAK ;[-18] - rjmp sendX3AndReti ;[-17] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov x3, cnt ;[-16] -sendX3AndReti: - ldi YL, 20 ;[-15] x3==r20 address is 20 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -;We don't match the transfer rate exactly (don't insert leap cycles every third -;byte) because the spec demands only 1.5% precision anyway. -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-7] <- acquire bus -; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-6] exor mask - ldi shift, 0x80 ;[-5] sync byte is first byte sent -txByteLoop: - ldi bitcnt, 0x35 ;[-4] [6] binary 0011 0101 -txBitLoop: - sbrs shift, 0 ;[-3] [7] - eor x1, x4 ;[-2] [8] - out USBOUT, x1 ;[-1] [9] <-- out N - ror shift ;[0] [10] - ror x2 ;[1] -didStuffN: - cpi x2, 0xfc ;[2] - brcc bitstuffN ;[3] - lsr bitcnt ;[4] - brcc txBitLoop ;[5] - brne txBitLoop ;[6] - - sbrs shift, 0 ;[7] - eor x1, x4 ;[8] -didStuff6: - out USBOUT, x1 ;[-1] [9] <-- out 6 - ror shift ;[0] [10] - ror x2 ;[1] - cpi x2, 0xfc ;[2] - brcc bitstuff6 ;[3] - ror shift ;[4] -didStuff7: - ror x2 ;[5] - sbrs x2, 7 ;[6] - eor x1, x4 ;[7] - nop ;[8] - cpi x2, 0xfc ;[9] - out USBOUT, x1 ;[-1][10] <-- out 7 - brcc bitstuff7 ;[0] [11] - ld shift, y+ ;[1] - dec cnt ;[3] - brne txByteLoop ;[4] -;make SE0: - cbr x1, USBMASK ;[5] prepare SE0 [spec says EOP may be 21 to 25 cycles] - lds x2, usbNewDeviceAddr;[6] - lsl x2 ;[8] we compare with left shifted address - subi YL, 20 + 2 ;[9] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[10] - out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[0] - sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< max 52 cycles interrupt disable -;max stack usage: [ret(2), r0, SREG, YL, YH, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 16.5 MHz -> 11 cycles per bit -; 16.3125 MHz < F_CPU < 16.6875 MHz (+/- 1.1%) -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], r0, YH, shift, x1, x2, x3, x4, cnt - push YL ;[-23] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-21] - push YL ;[-20] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-15] - rjmp foundK ;[-14] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-12] -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push r0 ;[-12] -; [---] ;[-11] - push YH ;[-10] -; [---] ;[-9] - lds YL, usbInputBufOffset;[-8] -; [---] ;[-7] - clr YH ;[-6] - subi YL, lo8(-(usbRxBuf));[-5] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-4] [rx loop init] - mov r0, x2 ;[-3] [rx loop init] - sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) - rjmp haveTwoBitsK ;[-1] - pop YH ;[0] undo the pushes from before - pop r0 ;[2] - rjmp waitForK ;[4] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 22 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: ;[1] - push shift ;[1] - push x1 ;[3] - push x2 ;[5] - push x3 ;[7] - ldi shift, 0xff ;[9] [rx loop init] - ori x3, 0xff ;[10] [rx loop init] == ser x3, clear zero flag - - in x1, USBIN ;[11] <-- sample bit 0 - bst x1, USBMINUS ;[12] - bld shift, 0 ;[13] - push x4 ;[14] == phase -; [---] ;[15] - push cnt ;[16] -; [---] ;[17] - ldi phase, 0 ;[18] [rx loop init] - ldi cnt, USB_BUFSIZE;[19] [rx loop init] - rjmp rxbit1 ;[20] -; [---] ;[21] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -/* -byte oriented operations done during loop: -bit 0: store data -bit 1: SE0 check -bit 2: overflow check -bit 3: catch up -bit 4: rjmp to achieve conditional jump range -bit 5: PLL -bit 6: catch up -bit 7: jump, fixup bitstuff -; 87 [+ 2] cycles ------------------------------------------------------------------- -*/ -continueWithBit5: - in x2, USBIN ;[055] <-- bit 5 - eor r0, x2 ;[056] - or phase, r0 ;[057] - sbrc phase, USBMINUS ;[058] - lpm ;[059] optional nop3; modifies r0 - in phase, USBIN ;[060] <-- phase - eor x1, x2 ;[061] - bst x1, USBMINUS ;[062] - bld shift, 5 ;[063] - andi shift, 0x3f ;[064] - in x1, USBIN ;[065] <-- bit 6 - breq unstuff5 ;[066] *** unstuff escape - eor phase, x1 ;[067] - eor x2, x1 ;[068] - bst x2, USBMINUS ;[069] - bld shift, 6 ;[070] -didUnstuff6: ;[ ] - in r0, USBIN ;[071] <-- phase - cpi shift, 0x02 ;[072] - brlo unstuff6 ;[073] *** unstuff escape -didUnstuff5: ;[ ] - nop2 ;[074] -; [---] ;[075] - in x2, USBIN ;[076] <-- bit 7 - eor x1, x2 ;[077] - bst x1, USBMINUS ;[078] - bld shift, 7 ;[079] -didUnstuff7: ;[ ] - eor r0, x2 ;[080] - or phase, r0 ;[081] - in r0, USBIN ;[082] <-- phase - cpi shift, 0x04 ;[083] - brsh rxLoop ;[084] -; [---] ;[085] -unstuff7: ;[ ] - andi x3, ~0x80 ;[085] - ori shift, 0x80 ;[086] - in x2, USBIN ;[087] <-- sample stuffed bit 7 - nop ;[088] - rjmp didUnstuff7 ;[089] -; [---] ;[090] - ;[080] - -unstuff5: ;[067] - eor phase, x1 ;[068] - andi x3, ~0x20 ;[069] - ori shift, 0x20 ;[070] - in r0, USBIN ;[071] <-- phase - mov x2, x1 ;[072] - nop ;[073] - nop2 ;[074] -; [---] ;[075] - in x1, USBIN ;[076] <-- bit 6 - eor r0, x1 ;[077] - or phase, r0 ;[078] - eor x2, x1 ;[079] - bst x2, USBMINUS ;[080] - bld shift, 6 ;[081] no need to check bitstuffing, we just had one - in r0, USBIN ;[082] <-- phase - rjmp didUnstuff5 ;[083] -; [---] ;[084] - ;[074] - -unstuff6: ;[074] - andi x3, ~0x40 ;[075] - in x1, USBIN ;[076] <-- bit 6 again - ori shift, 0x40 ;[077] - nop2 ;[078] -; [---] ;[079] - rjmp didUnstuff6 ;[080] -; [---] ;[081] - ;[071] - -unstuff0: ;[013] - eor r0, x2 ;[014] - or phase, r0 ;[015] - andi x2, USBMASK ;[016] check for SE0 - in r0, USBIN ;[017] <-- phase - breq didUnstuff0 ;[018] direct jump to se0 would be too long - andi x3, ~0x01 ;[019] - ori shift, 0x01 ;[020] - mov x1, x2 ;[021] mov existing sample - in x2, USBIN ;[022] <-- bit 1 again - rjmp didUnstuff0 ;[023] -; [---] ;[024] - ;[014] - -unstuff1: ;[024] - eor r0, x1 ;[025] - or phase, r0 ;[026] - andi x3, ~0x02 ;[027] - in r0, USBIN ;[028] <-- phase - ori shift, 0x02 ;[029] - mov x2, x1 ;[030] - rjmp didUnstuff1 ;[031] -; [---] ;[032] - ;[022] - -unstuff2: ;[035] - eor r0, x2 ;[036] - or phase, r0 ;[037] - andi x3, ~0x04 ;[038] - in r0, USBIN ;[039] <-- phase - ori shift, 0x04 ;[040] - mov x1, x2 ;[041] - rjmp didUnstuff2 ;[042] -; [---] ;[043] - ;[033] - -unstuff3: ;[043] - in x2, USBIN ;[044] <-- bit 3 again - eor r0, x2 ;[045] - or phase, r0 ;[046] - andi x3, ~0x08 ;[047] - ori shift, 0x08 ;[048] - nop ;[049] - in r0, USBIN ;[050] <-- phase - rjmp didUnstuff3 ;[051] -; [---] ;[052] - ;[042] - -unstuff4: ;[053] - andi x3, ~0x10 ;[054] - in x1, USBIN ;[055] <-- bit 4 again - ori shift, 0x10 ;[056] - rjmp didUnstuff4 ;[057] -; [---] ;[058] - ;[048] - -rxLoop: ;[085] - eor x3, shift ;[086] reconstruct: x3 is 0 at bit locations we changed, 1 at others - in x1, USBIN ;[000] <-- bit 0 - st y+, x3 ;[001] -; [---] ;[002] - eor r0, x1 ;[003] - or phase, r0 ;[004] - eor x2, x1 ;[005] - in r0, USBIN ;[006] <-- phase - ser x3 ;[007] - bst x2, USBMINUS ;[008] - bld shift, 0 ;[009] - andi shift, 0xf9 ;[010] -rxbit1: ;[ ] - in x2, USBIN ;[011] <-- bit 1 - breq unstuff0 ;[012] *** unstuff escape - andi x2, USBMASK ;[013] SE0 check for bit 1 -didUnstuff0: ;[ ] Z only set if we detected SE0 in bitstuff - breq se0 ;[014] - eor r0, x2 ;[015] - or phase, r0 ;[016] - in r0, USBIN ;[017] <-- phase - eor x1, x2 ;[018] - bst x1, USBMINUS ;[019] - bld shift, 1 ;[020] - andi shift, 0xf3 ;[021] -didUnstuff1: ;[ ] - in x1, USBIN ;[022] <-- bit 2 - breq unstuff1 ;[023] *** unstuff escape - eor r0, x1 ;[024] - or phase, r0 ;[025] - subi cnt, 1 ;[026] overflow check - brcs overflow ;[027] - in r0, USBIN ;[028] <-- phase - eor x2, x1 ;[029] - bst x2, USBMINUS ;[030] - bld shift, 2 ;[031] - andi shift, 0xe7 ;[032] -didUnstuff2: ;[ ] - in x2, USBIN ;[033] <-- bit 3 - breq unstuff2 ;[034] *** unstuff escape - eor r0, x2 ;[035] - or phase, r0 ;[036] - eor x1, x2 ;[037] - bst x1, USBMINUS ;[038] - in r0, USBIN ;[039] <-- phase - bld shift, 3 ;[040] - andi shift, 0xcf ;[041] -didUnstuff3: ;[ ] - breq unstuff3 ;[042] *** unstuff escape - nop ;[043] - in x1, USBIN ;[044] <-- bit 4 - eor x2, x1 ;[045] - bst x2, USBMINUS ;[046] - bld shift, 4 ;[047] -didUnstuff4: ;[ ] - eor r0, x1 ;[048] - or phase, r0 ;[049] - in r0, USBIN ;[050] <-- phase - andi shift, 0x9f ;[051] - breq unstuff4 ;[052] *** unstuff escape - rjmp continueWithBit5;[053] -; [---] ;[054] - -macro POP_STANDARD ; 16 cycles - pop cnt - pop x4 - pop x3 - pop x2 - pop x1 - pop shift - pop YH - pop r0 - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies - -bitstuff7: - eor x1, x4 ;[4] - ldi x2, 0 ;[5] - nop2 ;[6] C is zero (brcc) - rjmp didStuff7 ;[8] - -bitstuffN: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] - lpm ;[7] 3 cycle NOP, modifies r0 - out USBOUT, x1 ;[10] <-- out - rjmp didStuffN ;[0] - -#define bitStatus x3 - -sendNakAndReti: - ldi cnt, USBPID_NAK ;[-19] - rjmp sendCntAndReti ;[-18] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov r0, cnt ;[-16] - ldi YL, 0 ;[-15] R0 address is 0 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-7] <- acquire bus -; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-6] exor mask - ldi shift, 0x80 ;[-5] sync byte is first byte sent - ldi bitStatus, 0xff ;[-4] init bit loop counter, works for up to 12 bytes -byteloop: -bitloop: - sbrs shift, 0 ;[8] [-3] - eor x1, x4 ;[9] [-2] - out USBOUT, x1 ;[10] [-1] <-- out - ror shift ;[0] - ror x2 ;[1] -didStuffN: - cpi x2, 0xfc ;[2] - brcc bitstuffN ;[3] - nop ;[4] - subi bitStatus, 37 ;[5] 256 / 7 ~=~ 37 - brcc bitloop ;[6] when we leave the loop, bitStatus has almost the initial value - sbrs shift, 0 ;[7] - eor x1, x4 ;[8] - ror shift ;[9] -didStuff7: - out USBOUT, x1 ;[10] <-- out - ror x2 ;[0] - cpi x2, 0xfc ;[1] - brcc bitstuff7 ;[2] - ld shift, y+ ;[3] - dec cnt ;[5] - brne byteloop ;[6] -;make SE0: - cbr x1, USBMASK ;[7] prepare SE0 [spec says EOP may be 21 to 25 cycles] - lds x2, usbNewDeviceAddr;[8] - lsl x2 ;[10] we compare with left shifted address - out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - subi YL, 2 ;[0] Only assign address on data packets, not ACK/NAK in r0 - sbci YH, 0 ;[1] - breq skipAddrAssign ;[2] - sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 12 cycles per bit -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts -;register use in receive loop to receive the data bytes: -; shift assembles the byte currently being received -; x1 holds the D+ and D- line state -; x2 holds the previous line state -; cnt holds the number of bytes left in the receive buffer -; x3 holds the higher crc byte (see algorithm below) -; x4 is used as temporary register for the crc algorithm -; x5 is used for unstuffing: when unstuffing the last received bit is inverted in shift (to prevent further -; unstuffing calls. In the same time the corresponding bit in x5 is cleared to mark the bit as beening iverted -; zl lower crc value and crc table index -; zh used for crc table accesses - -;-------------------------------------------------------------------------------------------------------------- -; CRC mods: -; table driven crc checker, Z points to table in prog space -; ZL is the lower crc byte, x3 is the higher crc byte -; x4 is used as temp register to store different results -; the initialization of the crc register is not 0xFFFF but 0xFE54. This is because during the receipt of the -; first data byte an virtual zero data byte is added to the crc register, this results in the correct initial -; value of 0xFFFF at beginning of the second data byte before the first data byte is added to the crc. -; The magic number 0xFE54 results form the crc table: At tabH[0x54] = 0xFF = crcH (required) and -; tabL[0x54] = 0x01 -> crcL = 0x01 xor 0xFE = 0xFF -; bitcnt is renamed to x5 and is used for unstuffing purposes, the unstuffing works like in the 12MHz version -;-------------------------------------------------------------------------------------------------------------- -; CRC algorithm: -; The crc register is formed by x3 (higher byte) and ZL (lower byte). The algorithm uses a 'reversed' form -; i.e. that it takes the least significant bit first and shifts to the right. So in fact the highest order -; bit seen from the polynomial devision point of view is the lsb of ZL. (If this sounds strange to you i -; propose a research on CRC :-) ) -; Each data byte received is xored to ZL, the lower crc byte. This byte now builds the crc -; table index. Next the new high byte is loaded from the table and stored in x4 until we have space in x3 -; (its destination). -; Afterwards the lower table is loaded from the table and stored in ZL (the old index is overwritten as -; we don't need it anymore. In fact this is a right shift by 8 bits.) Now the old crc high value is xored -; to ZL, this is the second shift of the old crc value. Now x4 (the temp reg) is moved to x3 and the crc -; calculation is done. -; Prior to the first byte the two CRC register have to be initialized to 0xFFFF (as defined in usb spec) -; however the crc engine also runs during the receipt of the first byte, therefore x3 and zl are initialized -; to a magic number which results in a crc value of 0xFFFF after the first complete byte. -; -; This algorithm is split into the extra cycles of the different bits: -; bit7: XOR the received byte to ZL -; bit5: load the new high byte to x4 -; bit6: load the lower xor byte from the table, xor zl and x3, store result in zl (=the new crc low value) -; move x4 (the new high byte) to x3, the crc value is ready -; - - -macro POP_STANDARD ; 18 cycles - pop ZH - pop ZL - pop cnt - pop x5 - pop x3 - pop x2 - pop x1 - pop shift - pop x4 - endm -macro POP_RETI ; 7 cycles - pop YH - pop YL - out SREG, YL - pop YL - endm - -macro CRC_CLEANUP_AND_CHECK - ; the last byte has already been xored with the lower crc byte, we have to do the table lookup and xor - ; x3 is the higher crc byte, zl the lower one - ldi ZH, hi8(usbCrcTableHigh);[+1] get the new high byte from the table - lpm x2, Z ;[+2][+3][+4] - ldi ZH, hi8(usbCrcTableLow);[+5] get the new low xor byte from the table - lpm ZL, Z ;[+6][+7][+8] - eor ZL, x3 ;[+7] xor the old high byte with the value from the table, x2:ZL now holds the crc value - cpi ZL, 0x01 ;[+8] if the crc is ok we have a fixed remainder value of 0xb001 in x2:ZL (see usb spec) - brne ignorePacket ;[+9] detected a crc fault -> paket is ignored and retransmitted by the host - cpi x2, 0xb0 ;[+10] - brne ignorePacket ;[+11] detected a crc fault -> paket is ignored and retransmitted by the host - endm - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG, YH, [sofError], x4, shift, x1, x2, x3, x5, cnt, ZL, ZH - push YL ;[-28] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-26] - push YL ;[-25] - push YH ;[-23] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-17] - rjmp foundK ;[-16] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-15] -;{3, 5} after falling D- edge, average delay: 4 cycles -;bit0 should be at 30 (2.5 bits) for center sampling. Currently at 4 so 26 cylces till bit 0 sample -;use 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push x4 ;[-14] -; [---] ;[-13] - lds YL, usbInputBufOffset;[-12] used to toggle the two usb receive buffers -; [---] ;[-11] - clr YH ;[-10] - subi YL, lo8(-(usbRxBuf));[-9] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-8] [rx loop init] - push shift ;[-7] -; [---] ;[-6] - ldi shift, 0x80 ;[-5] the last bit is the end of byte marker for the pid receiver loop - clc ;[-4] the carry has to be clear for receipt of pid bit 0 - sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early) - rjmp haveTwoBitsK ;[-2] - pop shift ;[-1] undo the push from before - pop x4 ;[1] - rjmp waitForK ;[3] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 24 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[0] - push x2 ;[2] - push x3 ;[4] crc high byte - ldi x2, 1< jump back and store the byte - ori shift, 0x01 ;[11] invert the last received bit to prevent furhter unstuffing - in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - andi x5, 0xFE ;[1] mark this bit as inverted (will be corrected before storing shift) - eor x1, x2 ;[2] x1 and x2 have to be different because the stuff bit is always a zero - andi x1, USBMASK ;[3] mask the interesting bits - breq stuffErr ;[4] if the stuff bit is a 1-bit something went wrong - mov x1, x2 ;[5] the next bit expects the last state to be in x1 - rjmp didunstuff0 ;[6] - ;[7] jump delay of rjmp didunstuffX - -unstuff1: ;[11] this is the jump delay of breq unstuffX - in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - ori shift, 0x02 ;[1] invert the last received bit to prevent furhter unstuffing - andi x5, 0xFD ;[2] mark this bit as inverted (will be corrected before storing shift) - eor x2, x1 ;[3] x1 and x2 have to be different because the stuff bit is always a zero - andi x2, USBMASK ;[4] mask the interesting bits - breq stuffErr ;[5] if the stuff bit is a 1-bit something went wrong - mov x2, x1 ;[6] the next bit expects the last state to be in x2 - nop2 ;[7] - ;[8] - rjmp didunstuff1 ;[9] - ;[10] jump delay of rjmp didunstuffX - -unstuff2: ;[9] this is the jump delay of breq unstuffX - ori shift, 0x04 ;[10] invert the last received bit to prevent furhter unstuffing - andi x5, 0xFB ;[11] mark this bit as inverted (will be corrected before storing shift) - in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - eor x1, x2 ;[1] x1 and x2 have to be different because the stuff bit is always a zero - andi x1, USBMASK ;[2] mask the interesting bits - breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong - mov x1, x2 ;[4] the next bit expects the last state to be in x1 - nop2 ;[5] - ;[6] - rjmp didunstuff2 ;[7] - ;[8] jump delay of rjmp didunstuffX - -unstuff3: ;[9] this is the jump delay of breq unstuffX - ori shift, 0x08 ;[10] invert the last received bit to prevent furhter unstuffing - andi x5, 0xF7 ;[11] mark this bit as inverted (will be corrected before storing shift) - in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - eor x2, x1 ;[1] x1 and x2 have to be different because the stuff bit is always a zero - andi x2, USBMASK ;[2] mask the interesting bits - breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong - mov x2, x1 ;[4] the next bit expects the last state to be in x2 - nop2 ;[5] - ;[6] - rjmp didunstuff3 ;[7] - ;[8] jump delay of rjmp didunstuffX - - - -; the include has to be here due to branch distance restirctions -#define __USE_CRC__ -#include "asmcommon.inc" - - - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies -; 7.5 bit times is 90 cycles. ...there is plenty of time - - -sendNakAndReti: - ldi x3, USBPID_NAK ;[-18] - rjmp sendX3AndReti ;[-17] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov x3, cnt ;[-16] -sendX3AndReti: - ldi YL, 20 ;[-15] x3==r20 address is 20 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent - -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-6] <- acquire bus - ldi x2, 0 ;[-6] init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-5] exor mask - ldi shift, 0x80 ;[-4] sync byte is first byte sent -txByteLoop: - ldi bitcnt, 0x40 ;[-3]=[9] binary 01000000 -txBitLoop: ; the loop sends the first 7 bits of the byte - sbrs shift, 0 ;[-2]=[10] if we have to send a 1 don't change the line state - eor x1, x4 ;[-1]=[11] - out USBOUT, x1 ;[0] - ror shift ;[1] - ror x2 ;[2] transfers the last sent bit to the stuffing history -didStuffN: - nop ;[3] - nop ;[4] - cpi x2, 0xfc ;[5] if we sent six consecutive ones - brcc bitstuffN ;[6] - lsr bitcnt ;[7] - brne txBitLoop ;[8] restart the loop while the 1 is still in the bitcount - -; transmit bit 7 - sbrs shift, 0 ;[9] - eor x1, x4 ;[10] -didStuff7: - ror shift ;[11] - out USBOUT, x1 ;[0] transfer bit 7 to the pins - ror x2 ;[1] move the bit into the stuffing history - cpi x2, 0xfc ;[2] - brcc bitstuff7 ;[3] - ld shift, y+ ;[4] get next byte to transmit - dec cnt ;[5] decrement byte counter - brne txByteLoop ;[7] if we have more bytes start next one - ;[8] branch delay - -;make SE0: - cbr x1, USBMASK ;[8] prepare SE0 [spec says EOP may be 25 to 30 cycles] - lds x2, usbNewDeviceAddr;[9] - lsl x2 ;[11] we compare with left shifted address - out USBOUT, x1 ;[0] <-- out SE0 -- from now 2 bits = 24 cycles until bus idle - subi YL, 20 + 2 ;[1] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[2] -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[3] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< -int main (int argc, char **argv) -{ - int i, j; - for (i=0; i<512; i++){ - unsigned short crc = i & 0xff; - for(j=0; j<8; j++) crc = (crc >> 1) ^ ((crc & 1) ? 0xa001 : 0); - if((i & 7) == 0) printf("\n.byte "); - printf("0x%02x, ", (i > 0xff ? (crc >> 8) : crc) & 0xff); - if(i == 255) printf("\n"); - } - return 0; -} - -// Use the following algorithm to compute CRC values: -ushort computeCrc(uchar *msg, uchar msgLen) -{ - uchar i; - ushort crc = 0xffff; - for(i = 0; i < msgLen; i++) - crc = usbCrcTable16[lo8(crc) ^ msg[i]] ^ hi8(crc); - return crc; -} -*/ - -.balign 256 -usbCrcTableLow: -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 - -; .balign 256 -usbCrcTableHigh: -.byte 0x00, 0xC0, 0xC1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7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C -.byte 0xB4, 0x74, 0x75, 0xB5, 0x77, 0xB7, 0xB6, 0x76 -.byte 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0 -.byte 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92 -.byte 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54 -.byte 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E -.byte 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98 -.byte 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A -.byte 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C -.byte 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86 -.byte 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40 - diff --git a/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm20.inc b/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm20.inc deleted file mode 100644 index 303abaf..0000000 --- a/tools/gnusb/bootloader/firmware/usbdrv/usbdrvasm20.inc +++ /dev/null @@ -1,360 +0,0 @@ -/* Name: usbdrvasm20.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Jeroen Benschop - * Based on usbdrvasm16.inc from Christian Starkjohann - * Creation Date: 2008-03-05 - * Tabsize: 4 - * Copyright: (c) 2008 by Jeroen Benschop and OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm20.inc 740 2009-04-13 18:23:31Z cs $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 20 MHz version of the asssembler part of the USB driver. It -requires a 20 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! -*/ - -#define leap2 x3 -#ifdef __IAR_SYSTEMS_ASM__ -#define nextInst $+2 -#else -#define nextInst .+0 -#endif - -;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 20 MHz -> 13.333333 cycles per bit, 106.666667 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts -;register use in receive loop: -; shift assembles the byte currently being received -; x1 holds the D+ and D- line state -; x2 holds the previous line state -; x4 (leap) is used to add a leap cycle once every three bytes received -; X3 (leap2) is used to add a leap cycle once every three stuff bits received -; bitcnt is used to determine when a stuff bit is due -; cnt holds the number of bytes left in the receive buffer - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt - push YL ;[-28] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-26] - push YL ;[-25] - push YH ;[-23] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-19] - rjmp foundK ;[-18] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-16] -;{3, 5} after falling D- edge, average delay: 4 cycles -;bit0 should be at 34 for center sampling. Currently at 4 so 30 cylces till bit 0 sample -;use 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push bitcnt ;[-16] -; [---] ;[-15] - lds YL, usbInputBufOffset;[-14] -; [---] ;[-13] - clr YH ;[-12] - subi YL, lo8(-(usbRxBuf));[-11] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-10] [rx loop init] - push shift ;[-9] -; [---] ;[-8] - ldi shift,0x40 ;[-7] set msb to "1" so processing bit7 can be detected - nop2 ;[-6] -; [---] ;[-5] - ldi bitcnt, 5 ;[-4] [rx loop init] - sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early) - rjmp haveTwoBitsK ;[-2] - pop shift ;[-1] undo the push from before - pop bitcnt ;[1] - rjmp waitForK ;[3] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 27 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[0] - push x2 ;[2] - push x3 ;[4] (leap2) - ldi leap2, 0x55 ;[6] add leap cycle on 2nd,5th,8th,... stuff bit - push x4 ;[7] == leap - ldi leap, 0x55 ;[9] skip leap cycle on 2nd,5th,8th,... byte received - push cnt ;[10] - ldi cnt, USB_BUFSIZE ;[12] [rx loop init] - ldi x2, 1< -#ifndef __IAR_SYSTEMS_ASM__ -# include -#endif - -#define __attribute__(arg) /* not supported on IAR */ - -#ifdef __IAR_SYSTEMS_ASM__ -# define __ASSEMBLER__ /* IAR does not define standard macro for asm */ -#endif - -#ifdef __HAS_ELPM__ -# define PROGMEM __farflash -#else -# define PROGMEM __flash -#endif - -#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) - -/* The following definitions are not needed by the driver, but may be of some - * help if you port a gcc based project to IAR. - */ -#define cli() __disable_interrupt() -#define sei() __enable_interrupt() -#define wdt_reset() __watchdog_reset() -#define _BV(x) (1 << (x)) - -/* assembler compatibility macros */ -#define nop2 rjmp $+2 /* jump to next instruction */ -#define XL r26 -#define XH r27 -#define YL r28 -#define YH r29 -#define ZL r30 -#define ZH r31 -#define lo8(x) LOW(x) -#define hi8(x) (((x)>>8) & 0xff) /* not HIGH to allow XLINK to make a proper range check */ - -/* Depending on the device you use, you may get problems with the way usbdrv.h - * handles the differences between devices. Since IAR does not use #defines - * for MCU registers, we can't check for the existence of a particular - * register with an #ifdef. If the autodetection mechanism fails, include - * definitions for the required USB_INTR_* macros in your usbconfig.h. See - * usbconfig-prototype.h and usbdrv.h for details. - */ - -/* ------------------------------------------------------------------------- */ -#elif __CODEVISIONAVR__ /* check for CodeVision AVR */ -/* ------------------------------------------------------------------------- */ -/* This port is not working (yet) */ - -/* #define F_CPU _MCU_CLOCK_FREQUENCY_ seems to be defined automatically */ - -#include -#include - -#define __attribute__(arg) /* not supported on IAR */ - -#define PROGMEM __flash -#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) - -#ifndef __ASSEMBLER__ -static inline void cli(void) -{ - #asm("cli"); -} -static inline void sei(void) -{ - #asm("sei"); -} -#endif -#define _delay_ms(t) delay_ms(t) -#define _BV(x) (1 << (x)) -#define USB_CFG_USE_SWITCH_STATEMENT 1 /* macro for if() cascase fails for unknown reason */ - -#define macro .macro -#define endm .endmacro -#define nop2 rjmp .+0 /* jump to next instruction */ - -/* ------------------------------------------------------------------------- */ -#else /* default development environment is avr-gcc/avr-libc */ -/* ------------------------------------------------------------------------- */ - -#include -#ifdef __ASSEMBLER__ -# define _VECTOR(N) __vector_ ## N /* io.h does not define this for asm */ -#else -# include -#endif - -#define USB_READ_FLASH(addr) pgm_read_byte(addr) - -#define macro .macro -#define endm .endm -#define nop2 rjmp .+0 /* jump to next instruction */ - -#endif /* development environment */ - -/* for conveniecne, ensure that PRG_RDB exists */ -#ifndef PRG_RDB -# define PRG_RDB(addr) USB_READ_FLASH(addr) -#endif -#endif /* __usbportability_h_INCLUDED__ */ diff --git a/tools/gnusb/bootloader/software/Makefile b/tools/gnusb/bootloader/software/Makefile deleted file mode 100644 index 8e85f68..0000000 --- a/tools/gnusb/bootloader/software/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# Inspired by the PowerSwitch makefile ba Christian Starkjohann, 2005 by OBJECTIVE DEVELOPMENT Software GmbH - -# Use the following 3 lines on Unix (uncomment the framework on Mac OS X): -USBFLAGS = `libusb-config --cflags` -USBLIBS = `libusb-config --libs` #-framework CoreFoundation -EXE_SUFFIX = - -# Use the following 3 lines on Windows and comment out the 3 above. You may -# have to change the include paths to where you installed libusb-win32 -#USBFLAGS = -I/usr/local/include -#USBLIBS = -L/usr/local/lib -lusb -#EXE_SUFFIX = .exe - -CC = gcc -CFLAGS = $(USBFLAGS) -O -Wall -LIBS = $(USBLIBS) - -PROGRAM = snesram_bootuploader$(EXE_SUFFIX) - - -all: $(PROGRAM) - -.c.o: - $(CC) $(CFLAGS) -c $< - -$(PROGRAM): snesram_bootuploader.o - $(CC) -o $(PROGRAM) snesram_bootuploader.o $(LIBS) - -strip: $(PROGRAM) - strip $(PROGRAM) - -clean: - rm -f *.o $(PROGRAM) diff --git a/tools/gnusb/bootloader/software/Makefile.win b/tools/gnusb/bootloader/software/Makefile.win deleted file mode 100644 index 88c4864..0000000 --- a/tools/gnusb/bootloader/software/Makefile.win +++ /dev/null @@ -1,37 +0,0 @@ -# MAKEFILE for the gnusb-bootloader command line tool -# Author: Michael Egger , meATanyma.ch -# Inspired by the PowerSwitch makefile ba Christian Starkjohann, 2005 by OBJECTIVE DEVELOPMENT Software GmbH - - -# Use the following 3 lines on Unix (uncomment the framework on Mac OS X): -#USBFLAGS = `libusb-config --cflags` -#USBLIBS = `libusb-config --libs` #-framework CoreFoundation -#EXE_SUFFIX = - -# Use the following 3 lines on Windows and comment out the 3 above. You may -# have to change the include paths to where you installed libusb-win32 -USBFLAGS = -I/usr/local/include -USBLIBS = -L/usr/local/lib -lusb -EXE_SUFFIX = .exe - -CC = gcc -CFLAGS = $(USBFLAGS) -O -Wall -LIBS = $(USBLIBS) - -PROGRAM = snesrambootloader$(EXE_SUFFIX) - - -all: $(PROGRAM) - mv snesrambootloader ../../firmware/gnusb/snesrambootloader - -.c.o: - $(CC) $(CFLAGS) -c $< - -$(PROGRAM): snesrambootloader.o - $(CC) -o $(PROGRAM) snesrambootloader.o $(LIBS) - -strip: $(PROGRAM) - strip $(PROGRAM) - -clean: - rm -f *.o $(PROGRAM) diff --git a/tools/gnusb/bootloader/software/snesram_bootuploader.c b/tools/gnusb/bootloader/software/snesram_bootuploader.c deleted file mode 100644 index be4d5c1..0000000 --- a/tools/gnusb/bootloader/software/snesram_bootuploader.c +++ /dev/null @@ -1,315 +0,0 @@ -/* - * ===================================================================================== - * - * Filename: snesram_bootuploader.c - * - * Description: - * - * Version: 1.0 - * Created: 05/06/2009 03:06:26 PM - * Revision: none - * Compiler: gcc - * - * Author: David Voswinkel (DV), david@optixx.org - * Company: Optixx - * - * ===================================================================================== - */ - -#include -#include -#include -#include -#include -#include - -#include "../usb_cmds.h" - -#define USBDEV_SHARED_VENDOR 0x16C0 /* VOTI */ -#define USBDEV_SHARED_PRODUCT 0x05DC /* Obdev's free shared PID */ -#define USB_VENDORSTRING "www.optixx.org" -#define USB_BOOTLOADERNAME "gnusboot" -#define USB_PRODUCTNAME "gnusb" -#define RETRIES 6 - -usb_dev_handle *handle = NULL; -unsigned char buffer[8]; -int nBytes; -int tries; - -static int usbGetStringAscii(usb_dev_handle * dev, int index, int langid, char *buf, int buflen) -{ - char buffer[256]; - int rval, i; - - if ((rval = - usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, - (USB_DT_STRING << 8) + index, langid, buffer, sizeof(buffer), 1000)) < 0) - return rval; - if (buffer[1] != USB_DT_STRING) - return 0; - if ((unsigned char)buffer[0] < rval) - rval = (unsigned char)buffer[0]; - rval /= 2; - /* - * lossy conversion to ISO Latin1 - */ - for (i = 1; i < rval; i++) { - if (i > buflen) /* destination buffer overflow */ - break; - buf[i - 1] = buffer[2 * i]; - if (buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */ - buf[i - 1] = '?'; - } - buf[i - 1] = 0; - return i - 1; -} - -static usb_dev_handle *findDevice(char *thedevice) -{ - struct usb_bus *bus; - struct usb_device *dev; - usb_dev_handle *handle = 0; - tries++; - usb_find_busses(); - usb_find_devices(); - for (bus = usb_busses; bus; bus = bus->next) { - for (dev = bus->devices; dev; dev = dev->next) { - if (dev->descriptor.idVendor == USBDEV_SHARED_VENDOR && dev->descriptor.idProduct == USBDEV_SHARED_PRODUCT) { - char string[256]; - int len; - handle = usb_open(dev); /* we need to open the device in - * order to query strings */ - if (!handle) { - fprintf(stderr, "Warning: cannot open USB device: %s\n", usb_strerror()); - continue; - } - /* - * now find out whether the device actually is obdev's - * Remote Sensor: - */ - len = usbGetStringAscii(handle, dev->descriptor.iManufacturer, 0x0409, string, sizeof(string)); - if (len < 0) { - fprintf(stderr, "warning: cannot query manufacturer for device: %s\n", usb_strerror()); - goto skipDevice; - } - /* - * fprintf(stderr, "seen device from vendor ->%s<-\n", - * string); - */ - if (strcmp(string, USB_VENDORSTRING) != 0) - goto skipDevice; - len = usbGetStringAscii(handle, dev->descriptor.iProduct, 0x0409, string, sizeof(string)); - if (len < 0) { - fprintf(stderr, "warning: cannot query product for device: %s\n", usb_strerror()); - goto skipDevice; - } - /* - * fprintf(stderr, "seen product ->%s<-\n", string); - */ - if (strcmp(string, thedevice) == 0) - break; - skipDevice: - usb_close(handle); - handle = NULL; - } - } - if (handle) - break; - } - if (!handle) { - if (tries < RETRIES) { - handle = findDevice(thedevice); - } else { - fprintf(stderr, "Could not find USB device %s/%s\n", USB_VENDORSTRING, thedevice); - } - } - return handle; -} - -static int hextobin(unsigned char c) -{ - /* - * http://www.scit.wlv.ac.uk/~jphb/sst/c/cgisd.html Function to - * convert hex character to binary. Returns value or -1 if there is - * any error. - */ - if (isdigit(c)) - return c - '0'; - else if (isxdigit(c)) - return tolower(c) - 'a' + 10; - else - return -1; -} - -static void usage(char *name) -{ - fprintf(stderr, "\nusage:\n"); - fprintf(stderr, " %s -upload file_to_upload.hex upload hex file\n", name); - fprintf(stderr, - " %s -version print version number of both the bootloader and the command line tool\n", name); - fprintf(stderr, " %s -leave leave bootloader and start application\n", name); - fprintf(stderr, " %s -clear_flag clear softjumper\n", name); - fprintf(stderr, "\n"); - -} - -static void save_send_word(unsigned int to_send) -{ - unsigned int result; - unsigned int ok; - - ok = 0; - - while (!ok) { - nBytes = - usb_control_msg(handle, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | - USB_ENDPOINT_IN, SNESRAM_BOOT_CMD_STATUS, 0, 0, (char *)buffer, sizeof(buffer), 100); - if (nBytes == 1) - ok = buffer[0]; - printf("."); - } - buffer[0] = 0; - buffer[1] = 0; - ok = 0; - - // while(!ok) { - nBytes = - usb_control_msg(handle, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | - USB_ENDPOINT_IN, SNESRAM_BOOT_CMD_WRITE, to_send, 0, (char *)buffer, sizeof(buffer), 5000); - if (nBytes == 2) { - result = buffer[0] | (buffer[1] << 8); - if (result != to_send) - printf("COMMUNICATION ERROR: Sent %i but received %i\n", to_send, result); - } else - printf("COMMUNICATION ERROR: Only %i bytes received\n", nBytes); - // } - return; -} - -static void send_file(char *filepath) -{ - int char_count, i, send_bytes = 0; - int c; // Character read from the file. - unsigned int sendWord = 0; // word to send to uDMX - FILE *fp; // Pointer to the file. - - // Open the file - if ((fp = fopen(filepath, "rb")) == NULL) { - printf("File %s open failed!\n", filepath); - exit(1); - }; - - nBytes = - usb_control_msg(handle, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | - USB_ENDPOINT_OUT, SNESRAM_BOOT_CMD_START, 0, 0, (char *)buffer, sizeof(buffer), 100); - - i = 0; - // Read one character at a time - while ((c = fgetc(fp)) != EOF) { - // hex file lines start with ':' - if (c == ':') { - - char_count = 0; - send_bytes = 0; - - } else { - char_count++; - printf("%c", c); - - // first two characters hold length of data - if (char_count < 3) { - send_bytes += hextobin(c) << ((2 - char_count) * 4); - } - // check if line holds data (record type = 00) - if (char_count == 8) { - if (c != '0') - send_bytes = 0; - printf(" "); - } - // ignore adress part of every line in hex file - if (char_count > 8) { - if (send_bytes) { - sendWord += hextobin(c) << ((3 - i) * 4); - - if (i == 3) { - - i = -1; - send_bytes -= 2; - printf(" "); - save_send_word(sendWord); // send word over - // USB - sendWord = 0; - } - - i++; - } - } - } - } - - // write last page to flash if there is anything left over - nBytes = - usb_control_msg(handle, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | - USB_ENDPOINT_OUT, SNESRAM_BOOT_CMD_FINISH, 0, 0, (char *)buffer, sizeof(buffer), 100); - - fclose(fp); /* Close the file. */ -} - -int main(int argc, char **argv) -{ - - if (argc < 2) { - usage(argv[0]); - exit(1); - } - - char *productName; - - // usb_set_debug(1); - - usb_init(); - productName = USB_PRODUCTNAME; - if (argc > 2) { - if (strcmp(argv[2], "-device") == 0) - productName = argv[3]; - } - - if (strcmp(argv[1], "-upload") == 0) { - - if ((handle = findDevice(USB_BOOTLOADERNAME)) != NULL) - send_file(argv[2]); - - } else if (strcmp(argv[1], "-version") == 0) { - printf("Not implemented\n"); - - } else if (strcmp(argv[1], "-leave") == 0) { - if ((handle = findDevice(USB_BOOTLOADERNAME)) != NULL) { - nBytes = - usb_control_msg(handle, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | - USB_ENDPOINT_OUT, SNESRAM_BOOT_CMD_LEAVE, 0, 0, (char *)buffer, sizeof(buffer), 100); - } - } else if (strcmp(argv[1], "-enter") == 0) { - if ((handle = findDevice(productName)) != NULL) - nBytes = - usb_control_msg(handle, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | - USB_ENDPOINT_OUT, SNESRAM_BOOT_CMD_ENTER, 0, 0, (char *)buffer, sizeof(buffer), 100); - } else if (strcmp(argv[1], "-clear_flag") == 0) { - if ((handle = findDevice(USB_BOOTLOADERNAME)) != NULL) - nBytes = - usb_control_msg(handle, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | - USB_ENDPOINT_OUT, - SNESRAM_BOOT_CMD_CLEAR_FLAG, 0, 0, (char *)buffer, sizeof(buffer), 100); - } else - usage(argv[0]); - - usb_close(handle); - return 0; -} diff --git a/tools/gnusb/bootloader/software/windows-driver/libusb0.dll b/tools/gnusb/bootloader/software/windows-driver/libusb0.dll deleted file mode 100644 index 8f0d9f71964e5957b6d7c40226f3ff041e6f59ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 46592 zcmeIb3w%`7wLg9mMhO_0ph2TX9c@rhz?r-!GkFmPum(XPVwD&J86Y(z={$H?z~E$* z>2Z+yXtmV}K3c4{rIx}ZyaJ?zDB6g$r9y40*n7rFd$~f9D%bqKYwdGp&P)>Y_Wu5# z&;QZUojLop_ImBL*Is+iVdmW%q+yaI8Ibz>B`Jh&`jqkC^Z#i<_2_HbM@w5rymf6T zsq(FB=Ps#to0?rsi(R!#O$%!q8=E|)1x}O8+i0q9G)#4$b)Zcu(vwKKPZ`0h7wwpbJ*Xs}ZbZ_3${0VlYaz;*$GvzUdVY$e z`;>7zXG0SjGS5$$s)>i=` zuqw+SSEtD{Qv&m|QUa-2%DBr=dH~I+&6E2q9sV=MCp-N6Jom_Bp+;%`!yboxRT`cm zqc-S2zKFs4uIqAnn7_kws=r6H=0bNQ=(%1Bq-QB9_e+xHaDV}I8M253<-|87$=~ly z)4+SDSpYZkl{rwvR zlEGzCaOVxw=quo7=~os3n?Nyv*YKN)l5i6sDtF_li>HUBBV2=$;5GuR!mny4ECL_- z`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wf-MCd1-~u$V?kfRKMKAmNGlv$cz@xy3jKwT6~0jTYT?$x z1BGuEHrc$kpzUefUfV|d&+Yr{Z`sR>rxnjBb{2oLcy;kZ#g7$lD*kct?&8j3@SqH5 zRN%p4v&+2J{FM25^E+mvY%nqTtzrmkYKR>?{ZudTRusNo zxTCPM@b`ts3Qrb(R@h&7sr4FbmUV))!aBoxkM%xlz13x1XMNn7T69HGc9Fg4<)WV# zZ7=FBdb{X9ivCfQVjE?<)^?Mv#8zROVXLy;4?Qy2GwnCn%j^#O9rikVy?u?{XaBx^ zlYOhb4Sagj{ug_F@$zCBdi84Ymf~H-zb!se{P*Hh#mOb3O0FpxUt%e#D49{RproZl zE_uARoSn1xyRsIY4YYQGNc&%Vp!SRC8g;y6g7d`^a z{#tmG)nTo&uChL3ea9NMrT{l*k+bdJPg@~q=IP;yYkPU9bj^7r#*adhx#E!^IyIe*#Uvxa7K$?2;)ZcRt diff --git a/tools/gnusb/bootloader/software/windows-driver/libusb0.sys b/tools/gnusb/bootloader/software/windows-driver/libusb0.sys deleted file mode 100644 index 3d369667a13573450e265d7aa75590487db61b23..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33792 zcmeHw3w%`7wf9aKWW>mf8cLKXqXdf@ab9^(k|D|P&_p6h5FZ#qGC(vWaWa8Kfq;{# zIUWb7#nx+Sivy9kbN1eAt-W4*?X@2hN^af2Mlr^8cm@X<>%=GhIQj20|5}6Qag(->V=tWh#^s%H z#cy0*zO=T<)aYqg;;C9@s;;W9Z}6HHxlNwtdQ)w^sc24_X<0*!d)oQuk4;fXm%11$ zjvK>T%dRU>dppX;O+GI!K9d!p#(^iEu?<(?)2Kq=jowjDe8=ITPyTZhzfpMS0ON8o zW>WBgpy2b5&5WfG(zAdVjn6K|YDf{$Kl>Ov(108WVPZ$th0oOIn)8whfJJ($oUPy)(JYhdh4(G0G03g>TbjtL2R)zuL z)yY^vWX=DU{%>obLVAB~|0C$dmkYNs#!1a591>KJkcmA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Jwt2C=J zs{vMQ&w4KFWytagS%=9c7E=ho&n26pUM3-bo5s4(cHg5Q}KEF zyzIP(^ET)GJg+-%Z{AyZ@8*2~ZJo~3=a0*ulz&zJb@|Tx>+_$>@6LZC|5MVP6Kfgh zF3vpBJj48-=HHklOS|>E)=k#Ot@nKndVK~n6@Kr zciMrpKc)RO?fmrQ^sCb|)9*>&pZ-qzU(zqhFl9{5D9)IlaYx3Ij0ZEeWPFlwDkDBK zE%T;KcV=Ve^31iF>!IhK%-1syV#Iuw`98w>)pziGR!KJ^i&No?zdS^JLD`InU<2kkbkO>&n@Mk@$MfzMKO&2XhYR z9L+hF)0@+uGk~~qGUpWhQs>Y+5*$WHq9e(X3=d6lOm(C>%nrLF)8TM99Yu~=j$%it zqa2#P9V5ENvD8uLXmofTEsm9rHI8;ihvPxV2FFInBaTgu&5kXOCml~ao^`z7=ybg7 z=yL3G>~XyA*ylLlIOsU+IO;g&=ymiv1{}v7Cmp98ELWEcVWD7JBTluXTFe%^CDY=t tI4wn%S(ai;siho|{dUVjOO0izrOwi5@mg9C>DO4=EkOC-pMP-;{5Q0qWy$~m diff --git a/tools/gnusb/bootloader/software/windows-driver/snesboot.cat b/tools/gnusb/bootloader/software/windows-driver/snesboot.cat deleted file mode 100644 index 2ef39c5..0000000 --- a/tools/gnusb/bootloader/software/windows-driver/snesboot.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. diff --git a/tools/gnusb/bootloader/software/windows-driver/snesboot.inf b/tools/gnusb/bootloader/software/windows-driver/snesboot.inf deleted file mode 100644 index 8d88dcb..0000000 --- a/tools/gnusb/bootloader/software/windows-driver/snesboot.inf +++ /dev/null @@ -1,136 +0,0 @@ -[Version] -Signature = "$Chicago$" -provider = %manufacturer% -DriverVer = 03/20/2007,0.1.12.1 -CatalogFile = snesboot.cat -CatalogFile.NT = snesboot.cat -CatalogFile.NTAMD64 = snesboot_x64.cat - -Class = LibUsbDevices -ClassGUID = {EB781AAF-9C70-4523-A5DF-642A87ECA567} - -[ClassInstall] -AddReg=libusb_class_install_add_reg - -[ClassInstall32] -AddReg=libusb_class_install_add_reg - -[libusb_class_install_add_reg] -HKR,,,,"LibUSB-Win32 Devices" -HKR,,Icon,,"-20" - -[Manufacturer] -%manufacturer%=Devices,NT,NTAMD64 - -;-------------------------------------------------------------------------- -; Files -;-------------------------------------------------------------------------- - -[SourceDisksNames] -1 = "Libusb-Win32 Driver Installation Disk",, - -[SourceDisksFiles] -libusb0.sys = 1,, -libusb0.dll = 1,, -libusb0_x64.sys = 1,, -libusb0_x64.dll = 1,, - -[DestinationDirs] -libusb_files_sys = 10,system32\drivers -libusb_files_sys_x64 = 10,system32\drivers -libusb_files_dll = 10,system32 -libusb_files_dll_wow64 = 10,syswow64 -libusb_files_dll_x64 = 10,system32 - -[libusb_files_sys] -libusb0.sys - -[libusb_files_sys_x64] -libusb0.sys,libusb0_x64.sys - -[libusb_files_dll] -libusb0.dll - -[libusb_files_dll_wow64] -libusb0.dll - -[libusb_files_dll_x64] -libusb0.dll,libusb0_x64.dll - -;-------------------------------------------------------------------------- -; Device driver -;-------------------------------------------------------------------------- - -[LIBUSB_DEV] -CopyFiles = libusb_files_sys, libusb_files_dll -AddReg = libusb_add_reg - -[LIBUSB_DEV.NT] -CopyFiles = libusb_files_sys, libusb_files_dll - -[LIBUSB_DEV.NTAMD64] -CopyFiles = libusb_files_sys_x64, libusb_files_dll_wow64, libusb_files_dll_x64 - -[LIBUSB_DEV.HW] -DelReg = libusb_del_reg_hw -AddReg = libusb_add_reg_hw - -[LIBUSB_DEV.NT.HW] -DelReg = libusb_del_reg_hw -AddReg = libusb_add_reg_hw - -[LIBUSB_DEV.NTAMD64.HW] -DelReg = libusb_del_reg_hw -AddReg = libusb_add_reg_hw - -[LIBUSB_DEV.NT.Services] -AddService = libusb0, 0x00000002, libusb_add_service - -[LIBUSB_DEV.NTAMD64.Services] -AddService = libusb0, 0x00000002, libusb_add_service - -[libusb_add_reg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,libusb0.sys - -; Older versions of this .inf file installed filter drivers. They are not -; needed any more and must be removed -[libusb_del_reg_hw] -HKR,,LowerFilters -HKR,,UpperFilters - -; Device properties -[libusb_add_reg_hw] -HKR,,SurpriseRemovalOK, 0x00010001, 1 - -;-------------------------------------------------------------------------- -; Services -;-------------------------------------------------------------------------- - -[libusb_add_service] -DisplayName = "LibUsb-Win32 - Kernel Driver 03/20/2007, 0.1.12.1" -ServiceType = 1 -StartType = 3 -ErrorControl = 0 -ServiceBinary = %12%\libusb0.sys - -;-------------------------------------------------------------------------- -; Devices -;-------------------------------------------------------------------------- - -[Devices] -"snesboot"=LIBUSB_DEV, USB\VID_05dc&PID_16c0 - -[Devices.NT] -"snesboot"=LIBUSB_DEV, USB\VID_05dc&PID_16c0 - -[Devices.NTAMD64] -"snesboot"=LIBUSB_DEV, USB\VID_05dc&PID_16c0 - - -;-------------------------------------------------------------------------- -; Strings -;-------------------------------------------------------------------------- - -[Strings] -manufacturer = "www.anyma.ch" diff --git a/tools/gnusb/bootloader/software/windows-driver/snesboot_x64.cat b/tools/gnusb/bootloader/software/windows-driver/snesboot_x64.cat deleted file mode 100644 index 2ef39c5..0000000 --- a/tools/gnusb/bootloader/software/windows-driver/snesboot_x64.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. diff --git a/tools/gnusb/bootloader/usb_cmds.h b/tools/gnusb/bootloader/usb_cmds.h deleted file mode 100644 index 6c9ccde..0000000 --- a/tools/gnusb/bootloader/usb_cmds.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * ===================================================================================== - * - * Filename: usb_cmds.h - * - * Description: - * - * Version: 1.0 - * Created: 05/06/2009 03:06:26 PM - * Revision: none - * Compiler: gcc - * - * Author: David Voswinkel (DV), david@optixx.org - * Company: Optixx - * - * ===================================================================================== - */ -// start firmware upload (sets page adress to 0) -#define SNESRAM_BOOT_CMD_START 0xf1 - -// write one word to flash buffer, write page if filled up -#define SNESRAM_BOOT_CMD_WRITE 0xf2 - -// write last page if there's anything left to write tpo flash -#define SNESRAM_BOOT_CMD_FINISH 0xf3 - -// leave bootloader and start main application -#define SNESRAM_BOOT_CMD_LEAVE 0xf4 - -// clear software jumper in EEPROM to prevent bootloader from starting -#define SNESRAM_BOOT_CMD_CLEAR_FLAG 0xf5 - -// get bootloader version -#define SNESRAM_BOOT_CMD_GET_VERSION 0xf6 - -#define SNESRAM_BOOT_CMD_STATUS 0xf7 - -#define SNESRAM_BOOT_CMD_ENTER 0xf8 diff --git a/tools/gnusb/common/gnusb_cmds.h b/tools/gnusb/common/gnusb_cmds.h deleted file mode 100644 index da1e0e4..0000000 --- a/tools/gnusb/common/gnusb_cmds.h +++ /dev/null @@ -1,35 +0,0 @@ -// ============================================================================== -// gnusb_commands.h -// -// Commands shared between the gnusb firmware and host software -// -// License: -// The project is built with AVR USB driver by Objective Development, which is -// published under an own licence based on the GNU General Public License (GPL). -// gnusb is also distributed under this enhanced licence. See Documentation. -// -// created 2007-01-28 Michael Egger me@anyma.ch -// mdified 2007-11-13 " -// -// ============================================================================== - - - -// get values of sensors connected to the gnusb -#define GNUSB_CMD_POLL 2 - -// Set state of Leds connected to PORTC (8 bit) -#define GNUSB_CMD_SET_PORTC 3 - -// Set state of Leds connected to PORTB (8 bit) -#define GNUSB_CMD_SET_PORTB 4 - -#define GNUSB_CMD_INPUT_PORTB 5 -#define GNUSB_CMD_INPUT_PORTC 6 -#define GNUSB_CMD_SET_SMOOTHING 7 - -// Start Bootloader for Software updates -#define GNUSB_CMD_START_BOOTLOADER 0xf8 - - - diff --git a/tools/gnusb/firmware/Makefile b/tools/gnusb/firmware/Makefile deleted file mode 100644 index 22c8478..0000000 --- a/tools/gnusb/firmware/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -# Name: Makefile -# Project: gnusb -# Author: Michael Egger me@anyma.ch -# -# Based on Makefile for Powerswitch -# Author: Christian Starkjohann -# Creation Date: 2004-12-29 -# Tabsize: 4 -# Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH -# License: Proprietary, free under certain conditions. See Documentation. -# This Revision: $Id: Makefile 147 2006-03-01 17:33:03Z cs $ -# Target MCU: Atmel Atmega16-16 - -#change DEVICE o the name of your gnusb (as defined in usbconfig.h) -DEVICE = gnusb - -COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega16 #-DDEBUG_LEVEL=2 -# NEVER compile the final product with debugging! Any debug output will -# distort timing so that the specs can't be met. - -OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o gnusb.o main.o -# Note that we link usbdrv.o first! This is required for correct alignment of -# driver-internal global variables! - - -# symbolic targets: -all: main.hex - -.c.o: - $(COMPILE) -c $< -o $@ - -.S.o: - $(COMPILE) -x assembler-with-cpp -c $< -o $@ -# "-x assembler-with-cpp" should not be necessary since this is the default -# file type for the .S (with capital S) extension. However, upper case -# characters are not always preserved on Windows. To ensure WinAVR -# compatibility define the file type manually. - -.c.s: - $(COMPILE) -S $< -o $@ - -clean: - rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.bin *.o usbdrv/*.o gnusb.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s - -# file targets: -main.bin: $(OBJECTS) - $(COMPILE) -o main.bin $(OBJECTS) - -main.hex: main.bin - rm -f main.hex main.eep.hex - avr-objcopy -j .text -j .data -O ihex main.bin main.hex - - -disasm: main.bin - avr-objdump -d main.bin - -cpp: - $(COMPILE) -E main.c - -## --------------------------------------------------- -## wrapper for gnusboot bootloader functions -boot: all - ../../binaries/./gnusboot -enter -device $(DEVICE) - ../../binaries/./gnusboot -upload main.hex - -run: - ../../binaries/./gnusboot -clear_flag - ../../binaries/./gnusboot -leave diff --git a/tools/gnusb/firmware/gnusb.c b/tools/gnusb/firmware/gnusb.c deleted file mode 100644 index 3cae05b..0000000 --- a/tools/gnusb/firmware/gnusb.c +++ /dev/null @@ -1,251 +0,0 @@ -// ============================================================================== -// gnusbcore.c -// globals and utilities for gnusbCore - OPEN SOURCE USB SENSOR BOX -// -// License: -// The project is built with AVR USB driver by Objective Development, which is -// published under an own licence based on the GNU General Public License (GPL). -// usb2dmx is also distributed under this enhanced licence. See Documentation. -// -// target-cpu: ATMega16 @ 12MHz -// created 2007-01-28 Michael Egger me@anyma.ch -// - -// ============================================================================== -// includes -// ------------------------------------------------------------------------------ -// AVR Libc (see http://www.nongnu.org/avr-libc/) -#include // include I/O definitions (port names, pin names, etc) -#include // include interrupt support -#include -#include // include watchdog timer support -#include // include cpu sleep support - -// USB driver by Objective Development (see http://www.obdev.at/products/avrusb/index.html) -#include "usbdrv.h" - -// local includes -#include "gnusb.h" // gnusb setup and utility functions - - -// ============================================================================== -// - sleepIfIdle -// ------------------------------------------------------------------------------ -void sleepIfIdle() -{ - if(TIFR & BV(TOV1)) { - cli(); - if(!(GIFR & BV(INTF1))) { - // no activity on INT1 pin for >3ms => suspend: - - // - reconfigure INT1 to level-triggered and enable for wake-up - cbi(MCUCR, ISC10); - sbi(GICR, INT1); - // -------------- go to sleep - - //cbi(ADCSRA, ADIE); // disable ADC interrupts -// cbi(ADCSRA, ADEN); // disable ADC (turn off ADC power) - - PORTA = 0; // pull all pins low - PORTB = 0; - PORTC = 0; - PORTD = 0x60; // except LEDs - they light if pin is low... - - wdt_disable(); - sleep_enable(); - sei(); - sleep_cpu(); - - // -------------- wake up - sleep_disable(); - // - reconfigure INT1 to any edge for SE0-detection - cbi(GICR, INT1); - sbi(MCUCR, ISC10); - // - re-enable watchdog - wdt_reset(); - wdt_enable(WDTO_1S); - - // sbi(ADCSRA, ADIE); // enable ADC interrupts - // sbi(ADCSRA, ADEN); // enable ADC - - PORTD = 0x70; // set Pullup for Bootloader Jumper, no pullups on USB pins -> 0111 0000 - ledOn(STATUS_LED_GREEN); - - - } - sei(); - // clear INT1 flag - sbi(GIFR, INTF1); - // reload timer and clear overflow - TCCR1B = 1; - TCNT1 = 25000; // max ca. 3ms between SE0 - sbi(TIFR, TOV1); - } -} - - -// ------------------------------------------------------------------------------ -// - INT1_vec (dummy for wake-up) -// ------------------------------------------------------------------------------ -ISR(INT1_vect) {} - - - -// ------------------------------------------------------------------------------ -// - Write to EEPROM -// ------------------------------------------------------------------------------ -// from PowerSwitch by Objective Development - void eepromWrite(unsigned char addr, unsigned char val) -{ - while(EECR & (1 << EEWE)); - EEARL = addr; - EEDR = val; - cli(); - EECR |= 1 << EEMWE; - EECR |= 1 << EEWE; /* must follow within a couple of cycles -- therefore cli() */ - sei(); -} - - -// ------------------------------------------------------------------------------ -// - Read EEPROM -// ------------------------------------------------------------------------------ -// from PowerSwitch by Objective Development -uchar eepromRead(uchar addr) -{ - while(EECR & (1 << EEWE)); - EEARL = addr; - EECR |= 1 << EERE; - return EEDR; -} - -// ------------------------------------------------------------------------------ -// - Status Leds -// ------------------------------------------------------------------------------ -// (on means set to 0 as we sink the LEDs ) -void ledOff(uchar led) { - PORTD |= 1 << led; -} - -void ledOn(uchar led){ - PORTD &= ~(1 << led); -} - -void ledToggle(uchar led){ - PORTD ^= 1 << led; -} - -// ------------------------------------------------------------------------------ -// - ADC Utilities -// ------------------------------------------------------------------------------ -int ad_ConversionComplete (void) { - return (!(ADCSRA & (1 << ADSC))); -} - - int ad_Read10bit (void) { - return (ADCL | ADCH << 8); - } - - int ad_Read8bit (void) { - return ad_Read10bit() >> 2; - } - - void ad_SetChannel (uchar mux) { - ADMUX = (ADMUX & ~ADC_MUX_MASK) | (mux & ADC_MUX_MASK); // set channel - } - - void ad_StartConversion () { - ADCSRA |= (1 << ADIF); // clear hardware "conversion complete" flag - ADCSRA |= (1 << ADSC); // start conversion -} - -// ------------------------------------------------------------------------------ -// - USB Reset -// ------------------------------------------------------------------------------ -// Set USB- and USB+ Pins to output and pull them low for more than 10ms - - void usbReset(void) { - u08 i, j; - - USBOUT &= ~USBMASK; // make sure USB pins are pulled low - USBDDR |= USBMASK; // set USB pins to output -> SE0 - - j = 0; - while(--j) { - i = 0; - while(--i); // delay >10ms for USB reset - } - - USBDDR &= ~USBMASK; // set USB pins to input -} - -// ============================================================================== -// - Init hardware -// ------------------------------------------------------------------------------ -void initCoreHardware(void) -{ - // --------------------- Init AD Converter - - sbi(ADCSRA, ADEN); // enable ADC (turn on ADC power) - cbi(ADCSRA, ADATE); // default to single sample convert mode - // Set ADC-Prescaler (-> precision vs. speed) - ADCSRA = ((ADCSRA & ~ADC_PRESCALE_MASK) | ADC_PRESCALE_DIV64); - sbi(ADMUX,REFS0);cbi(ADMUX,REFS1); // Set ADC Reference Voltage to AVCC - - cbi(ADCSRA, ADLAR); // set to right-adjusted result -// sbi(ADCSRA, ADIE); // enable ADC interrupts - cbi(ADCSRA, ADIE); // disable ADC interrupts - - // --------------------- Init USB - - // set PORT D Directions -> 1110 0000, output 0 on unconnected PD7 - DDRD = 0xe0; // 1110 0000 -> set PD0..PD4 to inputs -> USB pins - PORTD = 0x70; // set Pullup for Bootloader Jumper, no pullups on USB pins -> 0111 0000 - - usbDeviceConnect(); - wdt_enable(WDTO_1S); // enable watchdog timer - usbReset(); - usbInit(); - - // --------------------- Init Sleep - - // init Timer 1 and Interrupt 1 for usb activity detection: - // - set INT1 to any edge (polled by sleepIfIdle()) - cbi(MCUCR, ISC11); - sbi(MCUCR, ISC10); - - // set sleep mode to full power-down for minimal consumption - set_sleep_mode(SLEEP_MODE_PWR_DOWN); - - // - set Timer 1 prescaler to 64 and restart timer - TCCR1B = 3; - TCNT1 = 0; - sbi(TIFR, TOV1); - - sei(); // turn on interrupts -} - -// ------------------------------------------------------------------------------ -// - Start Bootloader -// ------------------------------------------------------------------------------ -// dummy function doing the jump to bootloader section (Adress 1C00 on Atmega16) -void (*jump_to_bootloader)(void) = 0x1C00; __attribute__ ((unused)) - -void startBootloader(void) { - - eepromWrite(UBOOT_SOFTJUMPER_ADDRESS,UBOOT_SOFTJUMPER); // set software jumper - - cli(); // turn off interrupts - wdt_disable(); // disable watchdog timer - usbDeviceDisconnect(); // disconnect gnusb from USB bus - - cbi(ADCSRA, ADIE); // disable ADC interrupts - cbi(ADCSRA, ADEN); // disable ADC (turn off ADC power) - - PORTA = 0; // pull all pins low - PORTB = 0; - PORTC = 0; - - jump_to_bootloader(); -} - diff --git a/tools/gnusb/firmware/gnusb.h b/tools/gnusb/firmware/gnusb.h deleted file mode 100644 index c25a479..0000000 --- a/tools/gnusb/firmware/gnusb.h +++ /dev/null @@ -1,151 +0,0 @@ -// ============================================================================== -// gnusb.h -// globals and utilities for gnusb - OPEN SOURCE USB SENSOR BOX -// -// License: -// The project is built with AVR USB driver by Objective Development, which is -// published under an own licence based on the GNU General Public License (GPL). -// gnusb is also distributed under this enhanced licence. See Documentation. -// -// target-cpu: ATMega16 @ 12MHz -// created 2007-01-28 Michael Egger me@anyma.ch -// -// ============================================================================== - - - - -// ============================================================================== -// includes -// ------------------------------------------------------------------------------ -// AVR Libc (see http://www.nongnu.org/avr-libc/) -#include // include I/O definitions (port names, pin names, etc) -#include // include interrupt support -#include -#include // include watchdog timer support -#include // include cpu sleep support - -// USB driver by Objective Development (see http://www.obdev.at/products/avrusb/index.html) -#include "usbdrv.h" - -// local includes -#include "../common/gnusb_cmds.h" // USB command and error constants - // common between client and host software - -// ============================================================================== -// Constants -// ------------------------------------------------------------------------------ - -// Software jumper to initiate firmware updates via built in bootloader -#define UBOOT_SOFTJUMPER_ADDRESS 0x05 -#define UBOOT_SOFTJUMPER 0xd9 - -#define STATUS_LED_YELLOW 5 -#define STATUS_LED_GREEN 6 - -#define F_CPU 12000000 // 12MHz processor - -// ============================================================================== -// UTILITY FUNCTIONS - -// ------------------------------------------------------------------------------ -// - Write to EEPROM -// ------------------------------------------------------------------------------ -extern void eepromWrite(unsigned char addr, unsigned char val); - -// ------------------------------------------------------------------------------ -// - Read EEPROM -// ------------------------------------------------------------------------------ -extern uchar eepromRead(uchar addr); - -// ------------------------------------------------------------------------------ -// - Status Leds -// ------------------------------------------------------------------------------ -extern void ledOn(uchar led); -extern void ledOff(uchar led); -extern void ledToggle(uchar led); - -// ------------------------------------------------------------------------------ -// - ADC Utilities -// ------------------------------------------------------------------------------ - -extern int ad_ConversionComplete (void); -extern int ad_Read10bit (void); -extern int ad_Read8bit (void); -extern void ad_SetChannel (uchar mux); -extern void ad_StartConversion (); - -// ============================================================================== -// CORE FUNCTIONS - -// ------------------------------------------------------------------------------ -// - Init core hardware -// ------------------------------------------------------------------------------ -// Sets DDR for USB, Led and jumper pins (PORTD on gnusbCore hardware) -// Starts Interrupts for Sleep mode and initializes USB port -extern void initCoreHardware(void); - -// ------------------------------------------------------------------------------ -// - Start Bootloader -// ------------------------------------------------------------------------------ -extern void startBootloader(void); - -// ------------------------------------------------------------------------------ -// - sleepIfIdle -// ------------------------------------------------------------------------------ -// call this function regularly to check if there is still activity on the USB bus -// puts the device to sleep if necessary. -extern void sleepIfIdle(); - -// ------------------------------------------------------------------------------ -// - USB Reset -// ------------------------------------------------------------------------------ -// Set USB- and USB+ Pins to output and pull them low for more than 10ms -// Will force host to reevaluate the device - extern void usbReset(void); - - -// ============================================================================== -// Additional types -// ------------------------------------------------------------------------------ -typedef unsigned char u08; -typedef signed char s08; -typedef unsigned short u16; -typedef signed short s16; - - -// convenience macros (from Pascal Stangs avrlib) -#ifndef BV - #define BV(bit) (1<<(bit)) -#endif -#ifndef cbi - #define cbi(reg,bit) reg &= ~(BV(bit)) -#endif -#ifndef sbi - #define sbi(reg,bit) reg |= (BV(bit)) -#endif - -// ============================================================================== -// From AVRLIB by Pascal Stang -// ------------------------------------------------------------------------------ - -// A2D clock prescaler select -// *selects how much the CPU clock frequency is divided -// to create the A2D clock frequency -// *lower division ratios make conversion go faster -// *higher division ratios make conversions more accurate -#define ADC_PRESCALE_DIV2 0x00 ///< 0x01,0x00 -> CPU clk/2 -#define ADC_PRESCALE_DIV4 0x02 ///< 0x02 -> CPU clk/4 -#define ADC_PRESCALE_DIV8 0x03 ///< 0x03 -> CPU clk/8 -#define ADC_PRESCALE_DIV16 0x04 ///< 0x04 -> CPU clk/16 -#define ADC_PRESCALE_DIV32 0x05 ///< 0x05 -> CPU clk/32 -#define ADC_PRESCALE_DIV64 0x06 ///< 0x06 -> CPU clk/64 -#define ADC_PRESCALE_DIV128 0x07 ///< 0x07 -> CPU clk/128 -// default value -#define ADC_PRESCALE ADC_PRESCALE_DIV64 -// do not change the mask value -#define ADC_PRESCALE_MASK 0x07 - - -// bit mask for A2D channel multiplexer -#define ADC_MUX_MASK 0x1F diff --git a/tools/gnusb/firmware/main.c b/tools/gnusb/firmware/main.c deleted file mode 100644 index 4adbb78..0000000 --- a/tools/gnusb/firmware/main.c +++ /dev/null @@ -1,200 +0,0 @@ -// ============================================================================== -// main.c -// firmware for a device based on the gnusb - OPEN SOURCE USB SENSOR BOX -// -// License: -// The project is built with AVR USB driver by Objective Development, which is -// published under an own licence based on the GNU General Public License (GPL). -// gnusb is also distributed under this enhanced licence. See Documentation. -// -// target-cpu: ATMega16 @ 12MHz -// created 2007-01-28 Michael Egger me@anyma.ch -// -// ============================================================================== - -#include "gnusb.h" // the gnusb library: setup and utility functions - -// ============================================================================== -// Constants -// ------------------------------------------------------------------------------ -#define ADC_PAUSE 10 // number of passes before we sample the next AD channel -#define LED_KEEP_ALIVE 100 // number of passes before usb status led turns off -#define USB_REPLY_PORTB 8 // Values of portb gets stored into 9th byte of usb_reply (counting from 0) -#define USB_REPLY_PORTC 9 - - -// ============================================================================== -// Globals -// ------------------------------------------------------------------------------ - -static u08 ad_mux; // current ad input channel -static u16 ad_values[8]; // sampled ad input values -static u08 ad_smoothing; // smoothing level of ad samples (0 - 15) -static u08 ad_samplepause; // counts up to ADC_PAUSE between samples - - -static u08 usb_reply[12]; // 8 bytes AD Values (8 most significant bits) - // 1 byte PORTB - // 1 byte PORTC - // 2 bytes least significant bits of AD values - - - -// ------------------------------------------------------------------------------ -// - usbFunctionSetup -// ------------------------------------------------------------------------------ -// this function gets called when the usb driver receives a non standard request -// that is: our own requests defined in ../common/gnusb_cmds.h -// here's where the magic happens... - -uchar usbFunctionSetup(uchar data[8]) -{ - - switch (data[1]) { - // ---------------------------- get all values - case GNUSB_CMD_POLL: - - usbMsgPtr = usb_reply; - return sizeof(usb_reply); - break; - - // ---------------------------- set smoothing - case GNUSB_CMD_SET_SMOOTHING: - - if (data[2] > 15) ad_smoothing = 15; - else ad_smoothing = data[2]; - break; - // ---------------------------- output one byte on PORTB - case GNUSB_CMD_SET_PORTB: - - DDRB = 0xff; // set PORTB to output - PORTB = data[2]; // output values - usb_reply[USB_REPLY_PORTB] = data[2]; // mirror data in next poll - break; - - // ---------------------------- output one byte on PORTC - case GNUSB_CMD_SET_PORTC: - - DDRC = 0xff; // set PORTC to output - PORTC = data[2]; // output values - usb_reply[USB_REPLY_PORTC] = data[2]; // mirror data in next poll - break; - - // ---------------------------- set PORTB to input - case GNUSB_CMD_INPUT_PORTB: - - DDRB = 0x00; - break; - // ---------------------------- set PORTC to input - case GNUSB_CMD_INPUT_PORTC: - - DDRC = 0x00; - break; - - - // ---------------------------- Start Bootloader for reprogramming the gnusb - case GNUSB_CMD_START_BOOTLOADER: - - startBootloader(); - break; - - default: - break; - - } - - return 0; -} - - - -// ------------------------------------------------------------------------------ -// - Check ADC and update ad_values -// ------------------------------------------------------------------------------ - -void checkAnlogPorts (void) { - unsigned int temp,replymask,replyshift,replybyte; - - if (ad_samplepause != 0xff) { - if (ad_samplepause < ADC_PAUSE) { - ad_samplepause++; // advance pause counter - } else { - ad_StartConversion(); // start a new conversion - ad_samplepause = 0xff; // indicate we're waiting for a result now - } - - } else { - - if ( ad_ConversionComplete() ) { // see if AD-Conversion is complete - - temp = ad_Read10bit(); // read ADC (10 bits); - - // basic low pass filter - ad_values[ad_mux] = (ad_values[ad_mux] * ad_smoothing + temp) / (ad_smoothing + 1); - - usb_reply[ad_mux] = ad_values[ad_mux] >> 2; // copy 8 most significant bits to usb reply - - // if you don't need 10bit precision you can leave out the following stuff - replybyte = 10 + (ad_mux / 4); // are we writing to byte 10 or 11? - replyshift = ((ad_mux % 4) * 2); // how much to shift the bits - replymask = (3 << replyshift); // create bitmask - // write bits to the right place - usb_reply[replybyte] = - (usb_reply[replybyte] & ~replymask) | (replymask & (ad_values[ad_mux] << replyshift)); - - ad_mux = (ad_mux + 1) % 8; // advance multiplexer index - ad_SetChannel(ad_mux); // set mutliplexer channel - ad_samplepause = 0; // start counting up to ADC_PAUSE in order to let the input settle a bit - } - } -} - -// ------------------------------------------------------------------------------ -// - Check PORT B and PORT C -// ------------------------------------------------------------------------------ - -void checkDigitalPorts(void) { - // copy state of pins to usb reply, only if the port is configured as an input - if (DDRB == 0x00) usb_reply[USB_REPLY_PORTB] = PINB; - if (DDRC == 0x00) usb_reply[USB_REPLY_PORTC] = PINC; -} - - - - -// ============================================================================== -// - main -// ------------------------------------------------------------------------------ -int main(void) -{ - // ------------------------- Initialize Hardware - - // PORTA: AD Converter - DDRA = 0x00; // set all pins to input - PORTA = 0x00; // make sure pull-up resistors are turned off - - // PORTB: Default Input - DDRB = 0x00; // set all pins to input - PORTB = 0xff; // make sure pull-up resistors are turned ON - - // PORTC: Default output - DDRC = 0xff; // set all pins to output - PORTC = 0xff; // turn off all leds - - // PORTD: gnusbCore stuff: USB, status leds, jumper - initCoreHardware(); - ledOn(STATUS_LED_GREEN); - - // ------------------------- Main Loop - while(1) { - wdt_reset(); // reset Watchdog timer - otherwise Watchdog will reset gnusb - sleepIfIdle(); // go to low power mode if host computer is sleeping - usbPoll(); // see if there's something going on on the usb bus - - checkAnlogPorts(); // see if we've finished an analog-digital conversion - checkDigitalPorts(); // have a look at PORTB and PORTC - - } - return 0; -} - diff --git a/tools/gnusb/firmware/usbconfig.h b/tools/gnusb/firmware/usbconfig.h deleted file mode 100644 index 49b21c3..0000000 --- a/tools/gnusb/firmware/usbconfig.h +++ /dev/null @@ -1,252 +0,0 @@ -/* Name: usbconfig.h - * Project: AVR USB driver - * Author: Christian Starkjohann - * Creation Date: 2005-04-01 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbconfig.h 43 2005-04-10 21:04:36Z cs $ - */ - -#ifndef __usbconfig_h_included__ -#define __usbconfig_h_included__ - -/* -General Description: -This file contains parts of the USB driver which can be configured and can or -must be adapted to your hardware. - -Please note that the usbdrv contains a usbconfig-prototype.h file now. We -recommend that you use that file as a template because it will always list -the newest features and options. -*/ - -/* ---------------------------- Hardware Config ---------------------------- */ - -#define USB_CFG_IOPORTNAME D -/* This is the port where the USB bus is connected. When you configure it to - * "B", the registers PORTB, PINB and DDRB will be used. - */ -#define USB_CFG_DMINUS_BIT 0 -/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. - * This may be any bit in the port. - */ -#define USB_CFG_DPLUS_BIT 1 -/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. - * This may be any bit in the port. Please note that D+ must also be connected - * to interrupt pin INT0! - */ -/* #define USB_CFG_CLOCK_KHZ (F_CPU/1000) */ -/* Clock rate of the AVR in MHz. Legal values are 12000, 16000 or 16500. - * The 16.5 MHz version of the code requires no crystal, it tolerates +/- 1% - * deviation from the nominal frequency. All other rates require a precision - * of 2000 ppm and thus a crystal! - * Default if not specified: 12 MHz - */ - -/* ----------------------- Optional Hardware Config ------------------------ */ - - #define USB_CFG_PULLUP_IOPORTNAME D -/* If you connect the 1.5k pullup resistor from D- to a port pin instead of - * V+, you can connect and disconnect the device from firmware by calling - * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h). - * This constant defines the port on which the pullup resistor is connected. - */ -#define USB_CFG_PULLUP_BIT 7 -/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined - * above) where the 1.5k pullup resistor is connected. See description - * above for details. - */ - -/* --------------------------- Functional Range ---------------------------- */ - -#define USB_CFG_HAVE_INTRIN_ENDPOINT 0 -/* Define this to 1 if you want to compile a version with two endpoints: The - * default control endpoint 0 and an interrupt-in endpoint 1. - */ -#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0 -/* Define this to 1 if you want to compile a version with three endpoints: The - * default control endpoint 0, an interrupt-in endpoint 1 and an interrupt-in - * endpoint 3. You must also enable endpoint 1 above. - */ -#define USB_CFG_IMPLEMENT_HALT 0 -/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature - * for endpoint 1 (interrupt endpoint). Although you may not need this feature, - * it is required by the standard. We have made it a config option because it - * bloats the code considerably. - */ -#define USB_CFG_INTR_POLL_INTERVAL 10 -/* If you compile a version with endpoint 1 (interrupt-in), this is the poll - * interval. The value is in milliseconds and must not be less than 10 ms for - * low speed devices. - */ -#define USB_CFG_IS_SELF_POWERED 0 -/* Define this to 1 if the device has its own power supply. Set it to 0 if the - * device is powered from the USB bus. - */ -#define USB_CFG_MAX_BUS_POWER 300 -/* Set this variable to the maximum USB bus power consumption of your device. - * The value is in milliamperes. [It will be divided by two since USB - * communicates power requirements in units of 2 mA.] - */ -#define USB_CFG_IMPLEMENT_FN_WRITE 0 -/* Set this to 1 if you want usbFunctionWrite() to be called for control-out - * transfers. Set it to 0 if you don't need it and want to save a couple of - * bytes. - */ -#define USB_CFG_IMPLEMENT_FN_READ 0 -/* Set this to 1 if you need to send control replies which are generated - * "on the fly" when usbFunctionRead() is called. If you only want to send - * data from a static buffer, set it to 0 and return the data from - * usbFunctionSetup(). This saves a couple of bytes. - */ -#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 -/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoint 1. - * You must implement the function usbFunctionWriteOut() which receives all - * interrupt/bulk data sent to endpoint 1. - */ -#define USB_CFG_HAVE_FLOWCONTROL 0 -/* Define this to 1 if you want flowcontrol over USB data. See the definition - * of the macros usbDisableAllRequests() and usbEnableAllRequests() in - * usbdrv.h. - */ -/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */ -/* This macro is a hook if you want to do unconventional things. If it is - * defined, it's inserted at the beginning of received message processing. - * If you eat the received message and don't want default processing to - * proceed, do a return after doing your things. One possible application - * (besides debugging) is to flash a status LED on each packet. - */ -#define USB_COUNT_SOF 0 -/* define this macro to 1 if you need the global variable "usbSofCount" which - * counts SOF packets. - */ - -/* -------------------------- Device Description --------------------------- */ - -#define USB_CFG_VENDOR_ID 0xc0, 0x16 /* 5824 in dec, stands for VOTI */ -/* USB vendor ID for the device, low byte first. If you have registered your - * own Vendor ID, define it here. Otherwise you use obdev's free shared - * VID/PID pair. Be sure to read USBID-License.txt for rules! - */ -#define USB_CFG_DEVICE_ID 0xdc, 0x05 /* 1500 in dec, obdev's free PID */ -/* This is the ID of the product, low byte first. It is interpreted in the - * scope of the vendor ID. If you have registered your own VID with usb.org - * or if you have licensed a PID from somebody else, define it here. Otherwise - * you use obdev's free shared VID/PID pair. Be sure to read the rules in - * USBID-License.txt! - */ -#define USB_CFG_DEVICE_VERSION 0x00, 0x01 -/* Version number of the device: Minor number first, then major number. - */ -#define USB_CFG_VENDOR_NAME 'w', 'w', 'w', '.', 'a', 'n', 'y', 'm', 'a', '.', 'c', 'h' -#define USB_CFG_VENDOR_NAME_LEN 12 -/* These two values define the vendor name returned by the USB device. The name - * must be given as a list of characters under single quotes. The characters - * are interpreted as Unicode (UTF-16) entities. - * If you don't want a vendor name string, undefine these macros. - * ALWAYS define a vendor name containing your Internet domain name if you use - * obdev's free shared VID/PID pair. See the file USBID-License.txt for - * details. - */ -#define USB_CFG_DEVICE_NAME 'g', 'n', 'u', 's', 'b' -#define USB_CFG_DEVICE_NAME_LEN 5 -/* Same as above for the device name. If you don't want a device name, undefine - * the macros. See the file USBID-License.txt before you assign a name. - */ -/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ -/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */ -/* Same as above for the serial number. If you don't want a serial number, - * undefine the macros. - * It may be useful to provide the serial number through other means than at - * compile time. See the section about descriptor properties below for how - * to fine tune control over USB descriptors such as the string descriptor - * for the serial number. - */ -#define USB_CFG_DEVICE_CLASS 0xff -#define USB_CFG_DEVICE_SUBCLASS 0 -/* See USB specification if you want to conform to an existing device class. - */ -#define USB_CFG_INTERFACE_CLASS 0 -#define USB_CFG_INTERFACE_SUBCLASS 0 -#define USB_CFG_INTERFACE_PROTOCOL 0 -/* See USB specification if you want to conform to an existing device class or - * protocol. - */ -#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0 /* total length of report descriptor */ -/* Define this to the length of the HID report descriptor, if you implement - * an HID device. Otherwise don't define it or define it to 0. - */ - -/* ------------------- Fine Control over USB Descriptors ------------------- */ -/* If you don't want to use the driver's default USB descriptors, you can - * provide our own. These can be provided as (1) fixed length static data in - * flash memory, (2) fixed length static data in RAM or (3) dynamically at - * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more - * information about this function. - * Descriptor handling is configured through the descriptor's properties. If - * no properties are defined or if they are 0, the default descriptor is used. - * Possible properties are: - * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched - * at runtime via usbFunctionDescriptor(). - * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found - * in static memory is in RAM, not in flash memory. - * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash), - * the driver must know the descriptor's length. The descriptor itself is - * found at the address of a well known identifier (see below). - * List of static descriptor names (must be declared PROGMEM if in flash): - * char usbDescriptorDevice[]; - * char usbDescriptorConfiguration[]; - * char usbDescriptorHidReport[]; - * char usbDescriptorString0[]; - * int usbDescriptorStringVendor[]; - * int usbDescriptorStringDevice[]; - * int usbDescriptorStringSerialNumber[]; - * Other descriptors can't be provided statically, they must be provided - * dynamically at runtime. - * - * Descriptor properties are or-ed or added together, e.g.: - * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18)) - * - * The following descriptors are defined: - * USB_CFG_DESCR_PROPS_DEVICE - * USB_CFG_DESCR_PROPS_CONFIGURATION - * USB_CFG_DESCR_PROPS_STRINGS - * USB_CFG_DESCR_PROPS_STRING_0 - * USB_CFG_DESCR_PROPS_STRING_VENDOR - * USB_CFG_DESCR_PROPS_STRING_PRODUCT - * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER - * USB_CFG_DESCR_PROPS_HID - * USB_CFG_DESCR_PROPS_HID_REPORT - * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver) - * - */ - -#define USB_CFG_DESCR_PROPS_DEVICE 0 -#define USB_CFG_DESCR_PROPS_CONFIGURATION 0 -#define USB_CFG_DESCR_PROPS_STRINGS 0 -#define USB_CFG_DESCR_PROPS_STRING_0 0 -#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 -#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 -#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 -#define USB_CFG_DESCR_PROPS_HID 0 -#define USB_CFG_DESCR_PROPS_HID_REPORT 0 -#define USB_CFG_DESCR_PROPS_UNKNOWN 0 - -/* ----------------------- Optional MCU Description ------------------------ */ - -/* The following configurations have working defaults in usbdrv.h. You - * usually don't need to set them explicitly. Only if you want to run - * the driver on a device which is not yet supported or with a compiler - * which is not fully supported (such as IAR C) or if you use a differnt - * interrupt than INT0, you may have to define some of these. - */ -/* #define USB_INTR_CFG MCUCR */ -/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ -/* #define USB_INTR_CFG_CLR 0 */ -/* #define USB_INTR_ENABLE GIMSK */ -/* #define USB_INTR_ENABLE_BIT INT0 */ -/* #define USB_INTR_PENDING GIFR */ -/* #define USB_INTR_PENDING_BIT INTF0 */ - -#endif /* __usbconfig_h_included__ */ diff --git a/tools/gnusb/firmware/usbdrv/Changelog.txt b/tools/gnusb/firmware/usbdrv/Changelog.txt deleted file mode 100644 index 2cb5da2..0000000 --- a/tools/gnusb/firmware/usbdrv/Changelog.txt +++ /dev/null @@ -1,168 +0,0 @@ -This file documents changes in the firmware-only USB driver for atmel's AVR -microcontrollers. New entries are always appended to the end of the file. -Scroll down to the bottom to see the most recent changes. - -2005-04-01: - - Implemented endpoint 1 as interrupt-in endpoint. - - Moved all configuration options to usbconfig.h which is not part of the - driver. - - Changed interface for usbVendorSetup(). - - Fixed compatibility with ATMega8 device. - - Various minor optimizations. - -2005-04-11: - - Changed interface to application: Use usbFunctionSetup(), usbFunctionRead() - and usbFunctionWrite() now. Added configuration options to choose which - of these functions to compile in. - - Assembler module delivers receive data non-inverted now. - - Made register and bit names compatible with more AVR devices. - -2005-05-03: - - Allow address of usbRxBuf on any memory page as long as the buffer does - not cross 256 byte page boundaries. - - Better device compatibility: works with Mega88 now. - - Code optimization in debugging module. - - Documentation updates. - -2006-01-02: - - Added (free) default Vendor- and Product-IDs bought from voti.nl. - - Added USBID-License.txt file which defines the rules for using the free - shared VID/PID pair. - - Added Readme.txt to the usbdrv directory which clarifies administrative - issues. - -2006-01-25: - - Added "configured state" to become more standards compliant. - - Added "HALT" state for interrupt endpoint. - - Driver passes the "USB Command Verifier" test from usb.org now. - - Made "serial number" a configuration option. - - Minor optimizations, we now recommend compiler option "-Os" for best - results. - - Added a version number to usbdrv.h - -2006-02-03: - - New configuration variable USB_BUFFER_SECTION for the memory section where - the USB rx buffer will go. This defaults to ".bss" if not defined. Since - this buffer MUST NOT cross 256 byte pages (not even touch a page at the - end), the user may want to pass a linker option similar to - "-Wl,--section-start=.mybuffer=0x800060". - - Provide structure for usbRequest_t. - - New defines for USB constants. - - Prepared for HID implementations. - - Increased data size limit for interrupt transfers to 8 bytes. - - New macro usbInterruptIsReady() to query interrupt buffer state. - -2006-02-18: - - Ensure that the data token which is sent as an ack to an OUT transfer is - always zero sized. This fixes a bug where the host reports an error after - sending an out transfer to the device, although all data arrived at the - device. - - Updated docs in usbdrv.h to reflect changed API in usbFunctionWrite(). - -* Release 2006-02-20 - - - Give a compiler warning when compiling with debugging turned on. - - Added Oleg Semyonov's changes for IAR-cc compatibility. - - Added new (optional) functions usbDeviceConnect() and usbDeviceDisconnect() - (also thanks to Oleg!). - - Rearranged tests in usbPoll() to save a couple of instructions in the most - likely case that no actions are pending. - - We need a delay between the SET ADDRESS request until the new address - becomes active. This delay was handled in usbPoll() until now. Since the - spec says that the delay must not exceed 2ms, previous versions required - aggressive polling during the enumeration phase. We have now moved the - handling of the delay into the interrupt routine. - - We must not reply with NAK to a SETUP transaction. We can only achieve this - by making sure that the rx buffer is empty when SETUP tokens are expected. - We therefore don't pass zero sized data packets from the status phase of - a transfer to usbPoll(). This change MAY cause troubles if you rely on - receiving a less than 8 bytes long packet in usbFunctionWrite() to - identify the end of a transfer. usbFunctionWrite() will NEVER be called - with a zero length. - -* Release 2006-03-14 - - - Improved IAR C support: tiny memory model, more devices - - Added template usbconfig.h file under the name usbconfig-prototype.h - -* Release 2006-03-26 - - - Added provision for one more interrupt-in endpoint (endpoint 3). - - Added provision for one interrupt-out endpoint (endpoint 1). - - Added flowcontrol macros for USB. - - Added provision for custom configuration descriptor. - - Allow ANY two port bits for D+ and D-. - - Merged (optional) receive endpoint number into global usbRxToken variable. - - Use USB_CFG_IOPORTNAME instead of USB_CFG_IOPORT. We now construct the - variable name from the single port letter instead of computing the address - of related ports from the output-port address. - -* Release 2006-06-26 - - - Updated documentation in usbdrv.h and usbconfig-prototype.h to reflect the - new features. - - Removed "#warning" directives because IAR does not understand them. Use - unused static variables instead to generate a warning. - - Do not include when compiling with IAR. - - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each - USB descriptor should be handled. It is now possible to provide descriptor - data in Flash, RAM or dynamically at runtime. - - STALL is now a status in usbTxLen* instead of a message. We can now conform - to the spec and leave the stall status pending until it is cleared. - - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the - application code to reset data toggling on interrupt pipes. - -* Release 2006-07-18 - - - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes - an assembler error. - - usbDeviceDisconnect() takes pull-up resistor to high impedance now. - -* Release 2007-02-01 - - - Merged in some code size improvements from usbtiny (thanks to Dick - Streefland for these optimizations!) - - Special alignment requirement for usbRxBuf not required any more. Thanks - again to Dick Streefland for this hint! - - Reverted to "#warning" instead of unused static variables -- new versions - of IAR CC should handle this directive. - - Changed Open Source license to GNU GPL v2 in order to make linking against - other free libraries easier. We no longer require publication of the - circuit diagrams, but we STRONGLY encourage it. If you improve the driver - itself, PLEASE grant us a royalty free license to your changes for our - commercial license. - -* Release 2007-03-29 - - - New configuration option "USB_PUBLIC" in usbconfig.h. - - Set USB version number to 1.10 instead of 1.01. - - Code used USB_CFG_DESCR_PROPS_STRING_DEVICE and - USB_CFG_DESCR_PROPS_STRING_PRODUCT inconsistently. Changed all occurrences - to USB_CFG_DESCR_PROPS_STRING_PRODUCT. - - New assembler module for 16.5 MHz RC oscillator clock with PLL in receiver - code. - - New assembler module for 16 MHz crystal. - - usbdrvasm.S contains common code only, clock-specific parts have been moved - to usbdrvasm12.S, usbdrvasm16.S and usbdrvasm165.S respectively. - -* Release 2007-06-25 - - - 16 MHz module: Do SE0 check in stuffed bits as well. - -* Release 2007-07-07 - - - Define hi8(x) for IAR compiler to limit result to 8 bits. This is necessary - for negative values. - - Added 15 MHz module contributed by V. Bosch. - - Interrupt vector name can now be configured. This is useful if somebody - wants to use a different hardware interrupt than INT0. - -* Release 2007-08-07 - - - Moved handleIn3 routine in usbdrvasm16.S so that relative jump range is - not exceeded. - - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN, - USB_COUNT_SOF - - USB_INTR_PENDING can now be a memory address - -* Release 2007-09-19 diff --git a/tools/gnusb/firmware/usbdrv/CommercialLicense.txt b/tools/gnusb/firmware/usbdrv/CommercialLicense.txt deleted file mode 100644 index 240e45f..0000000 --- a/tools/gnusb/firmware/usbdrv/CommercialLicense.txt +++ /dev/null @@ -1,155 +0,0 @@ -AVR-USB Driver Software License Agreement -Version 2006-07-24 - -THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN -ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING -THE AMOUNT ACCORDING TO SECTION 4 ("PAYMENT") TO OBJECTIVE DEVELOPMENT. - - -1 DEFINITIONS - -1.1 "OBJECTIVE DEVELOPMENT" shall mean OBJECTIVE DEVELOPMENT Software GmbH, -Grosse Schiffgasse 1A/7, 1020 Wien, AUSTRIA. - -1.2 "You" shall mean the Licensee. - -1.3 "AVR-USB" shall mean the firmware-only USB device implementation for -Atmel AVR microcontrollers distributed by OBJECTIVE DEVELOPMENT and -consisting of the files usbdrv.c, usbdrv.h, usbdrvasm.S, oddebug.c, -oddebug.h, usbdrvasm.asm, iarcompat.h and usbconfig-prototype.h. - - -2 LICENSE GRANTS - -2.1 Source Code. OBJECTIVE DEVELOPMENT shall furnish you with the source -code of AVR-USB. - -2.2 Distribution and Use. OBJECTIVE DEVELOPMENT grants you the -non-exclusive right to use and distribute AVR-USB with your hardware -product(s), restricted by the limitations in section 3 below. - -2.3 Modifications. OBJECTIVE DEVELOPMENT grants you the right to modify -your copy of AVR-USB according to your needs. - -2.4 USB IDs. OBJECTIVE DEVELOPMENT grants you the exclusive rights to use -USB Product ID(s) sent to you in e-mail after receiving your payment in -conjunction with USB Vendor ID 5824. OBJECTIVE DEVELOPMENT has acquired an -exclusive license for this pair of USB identifiers from Wouter van Ooijen -(www.voti.nl), who has licensed the VID from the USB Implementers Forum, -Inc. (www.usb.org). - - -3 LICENSE RESTRICTIONS - -3.1 Number of Units. Only one of the following three definitions is -applicable. Which one is determined by the amount you pay to OBJECTIVE -DEVELOPMENT, see section 4 ("Payment") below. - -Hobby License: You may use AVR-USB according to section 2 above in no more -than 5 hardware units. These units must not be sold for profit. - -Entry Level License: You may use AVR-USB according to section 2 above in no -more than 150 hardware units. - -Professional License: You may use AVR-USB according to section 2 above in -any number of hardware units, except for large scale production ("unlimited -fair use"). Quantities below 10,000 units are not considered large scale -production. If your reach quantities which are obviously large scale -production, you must pay a license fee of 0.10 EUR per unit for all units -above 10,000. - -3.2 Rental. You may not rent, lease, or lend AVR-USB or otherwise encumber -any copy of AVR-USB, or any of the rights granted herein. - -3.3 Transfer. You may not transfer your rights under this Agreement to -another party without OBJECTIVE DEVELOPMENT's prior written consent. If -such consent is obtained, you may permanently transfer this License to -another party. The recipient of such transfer must agree to all terms and -conditions of this Agreement. - -3.4 Reservation of Rights. OBJECTIVE DEVELOPMENT retains all rights not -expressly granted. - -3.5 Non-Exclusive Rights. Your license rights under this Agreement are -non-exclusive. - -3.6 Third Party Rights. This Agreement cannot grant you rights controlled -by third parties. In particular, you are not allowed to use the USB logo or -other trademarks owned by the USB Implementers Forum, Inc. without their -consent. Since such consent depends on USB certification, it should be -noted that AVR-USB will not pass certification because it does not -implement checksum verification and the microcontroller ports do not meet -the electrical specifications. - - -4 PAYMENT - -The payment amount depends on the variation of this agreement (according to -section 3.1) into which you want to enter. Concrete prices are listed on -OBJECTIVE DEVELOPMENT's web site, usually at -http://www.obdev.at/avrusb/license.html. You agree to pay the amount listed -there to OBJECTIVE DEVELOPMENT or OBJECTIVE DEVELOPMENT's payment processor -or reseller. - - -5 COPYRIGHT AND OWNERSHIP - -AVR-USB is protected by copyright laws and international copyright -treaties, as well as other intellectual property laws and treaties. AVR-USB -is licensed, not sold. - - -6 TERM AND TERMINATION - -6.1 Term. This Agreement shall continue indefinitely. However, OBJECTIVE -DEVELOPMENT may terminate this Agreement and revoke the granted license and -USB-IDs if you fail to comply with any of its terms and conditions. - -6.2 Survival of Terms. All provisions regarding secrecy, confidentiality -and limitation of liability shall survive termination of this agreement. - - -7 DISCLAIMER OF WARRANTY AND LIABILITY - -LIMITED WARRANTY. AVR-USB IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, OBJECTIVE -DEVELOPMENT AND ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND -NON-INFRINGEMENT, WITH REGARD TO AVR-USB, AND THE PROVISION OF OR FAILURE -TO PROVIDE SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL -RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO -STATE/JURISDICTION. - -LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, -IN NO EVENT SHALL OBJECTIVE DEVELOPMENT OR ITS SUPPLIERS BE LIABLE FOR ANY -SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER -(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, -BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY -LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE AVR-USB OR THE -PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIVE -DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY -CASE, OBJECTIVE DEVELOPMENT'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS -AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR AVR-USB. - - -8 MISCELLANEOUS TERMS - -8.1 Marketing. OBJECTIVE DEVELOPMENT has the right to mention for marketing -purposes that you entered into this agreement. - -8.2 Entire Agreement. This document represents the entire agreement between -OBJECTIVE DEVELOPMENT and you. It may only be modified in writing signed by -an authorized representative of both, OBJECTIVE DEVELOPMENT and you. - -8.3 Severability. In case a provision of these terms and conditions should -be or become partly or entirely invalid, ineffective, or not executable, -the validity of all other provisions shall not be affected. - -8.4 Applicable Law. This agreement is governed by the laws of the Republic -of Austria. - -8.5 Responsible Courts. The responsible courts in Vienna/Austria will have -exclusive jurisdiction regarding all disputes in connection with this -agreement. - diff --git a/tools/gnusb/firmware/usbdrv/License.txt b/tools/gnusb/firmware/usbdrv/License.txt deleted file mode 100644 index f6a232e..0000000 --- a/tools/gnusb/firmware/usbdrv/License.txt +++ /dev/null @@ -1,359 +0,0 @@ -OBJECTIVE DEVELOPMENT GmbH's AVR-USB driver software is distributed under the -terms and conditions of the GNU GPL version 2, see the text below. In addition -to the requirements in the GPL, we STRONGLY ENCOURAGE you to do the following: - -(1) Publish your entire project on a web site and drop us a note with the URL. -Use the form at http://www.obdev.at/avrusb/feedback.html for your submission. - -(2) Adhere to minimum publication standards. Please include AT LEAST: - - a circuit diagram in PDF, PNG or GIF format - - full source code for the host software - - a Readme.txt file in ASCII format which describes the purpose of the - project and what can be found in which directories and which files - - a reference to http://www.obdev.at/avrusb/ - -(3) If you improve the driver firmware itself, please give us a free license -to your modifications for our commercial license offerings. - - - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/tools/gnusb/firmware/usbdrv/Readme.txt b/tools/gnusb/firmware/usbdrv/Readme.txt deleted file mode 100644 index 514379b..0000000 --- a/tools/gnusb/firmware/usbdrv/Readme.txt +++ /dev/null @@ -1,152 +0,0 @@ -This is the Readme file to Objective Development's firmware-only USB driver -for Atmel AVR microcontrollers. For more information please visit -http://www.obdev.at/avrusb/ - -This directory contains the USB firmware only. Copy it as-is to your own -project and add your own version of "usbconfig.h". A template for your own -"usbconfig.h" can be found in "usbconfig-prototype.h" in this directory. - - -TECHNICAL DOCUMENTATION -======================= -The technical documentation (API) for the firmware driver is contained in the -file "usbdrv.h". Please read all of it carefully! Configuration options are -documented in "usbconfig-prototype.h". - -The driver consists of the following files: - Readme.txt ............. The file you are currently reading. - Changelog.txt .......... Release notes for all versions of the driver. - usbdrv.h ............... Driver interface definitions and technical docs. -* usbdrv.c ............... High level language part of the driver. Link this - module to your code! -* usbdrvasm.S ............ Assembler part of the driver. This module is mostly - a stub and includes one of the usbdrvasm*.S files - depending on processor clock. Link this module to - your code! - usbdrvasm12.S .......... 12 MHz version of the assembler routines. Included - by usbdrvasm.S, don't link it directly! - usbdrvasm16.S .......... 16 MHz version of the assembler routines. Included - by usbdrvasm.S, don't link it directly! - usbdrvasm165.S ......... 16.5 MHz version of the assembler routines including - a PLL so that an 1% accurate RC oscillator can be - used. Included by usbdrvasm.S, don't link directly! - usbconfig-prototype.h .. Prototype for your own usbdrv.h file. -* oddebug.c .............. Debug functions. Only used when DEBUG_LEVEL is - defined to a value greater than 0. Link this module - to your code! - oddebug.h .............. Interface definitions of the debug module. - iarcompat.h ............ Compatibility definitions for IAR C-compiler. - usbdrvasm.asm .......... Compatibility stub for IAR-C-compiler. Use this - module instead of usbdrvasm.S when you assembler - with IAR's tools. - License.txt ............ Open Source license for this driver. - CommercialLicense.txt .. Optional commercial license for this driver. - USBID-License.txt ...... Terms and conditions for using particular USB ID - values for particular purposes. - -(*) ... These files should be linked to your project. - - -CPU CORE CLOCK FREQUENCY -======================== -We supply assembler modules for clock frequencies of 12 MHz, 16 MHz and -16.5 MHz. Other clock rates are not supported. The actual clock rate must be -configured in usbdrv.h unless you use the default 12 MHz. - -12 MHz Clock -This is the traditional clock rate of AVR-USB because it's the lowest clock -rate where the timing constraints of the USB spec can be met. - -16 MHz Clock -This clock rate has been added for users of the Arduino board and other -ready-made boards which come with a fixed 16 MHz crystal. It's also an option -if you need the slightly higher clock rate for performance reasons. Since -16 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code -is somewhat tricky and has to insert a leap cycle every third byte. - -16.5 MHz Clock -The assembler module for this clock rate differs from the other modules because -it has been built for an RC oscillator with only 1% precision. The receiver -code inserts leap cycles to compensate for clock deviations. 1% is also the -precision which can be achieved by calibrating the internal RC oscillator of -the AVR. Please note that only AVRs with internal 64 MHz PLL oscillator can be -used since the 8 MHz RC oscillator cannot be trimmed up to 16.5 MHz. This -includes the very popular ATTiny25, ATTiny45, ATTiny85 series as well as the -ATTiny26. - -We recommend that you obtain appropriate calibration values for 16.5 MHz core -clock at programming time and store it in flash or EEPROM or compute the value -from a reference clock at run time. However, since Atmel's 8 MHz calibration -is much more precise than the guaranteed 10%, it's usually possible to add a -fixed offset to this value. - - -USB IDENTIFIERS -=============== -Every USB device needs a vendor- and a product-identifier (VID and PID). VIDs -are obtained from usb.org for a price of 1,500 USD. Once you have a VID, you -can assign PIDs at will. - -Since an entry level cost of 1,500 USD is too high for most small companies -and hobbyists, we provide a single VID/PID pair for free. If you want to use -your own VID and PID instead of our's, define the macros "USB_CFG_VENDOR_ID" -and "USB_CFG_DEVICE_ID" accordingly in "usbconfig.h". - -To use our predefined VID/PID pair, you MUST conform to a couple of -requirements. See the file "USBID-License.txt" for details. - -Objective Development also has some offerings which include product IDs. See -http://www.obdev.at/avrusb/ for details. - - -HOST DRIVER -=========== -You have received this driver together with an example device implementation -and an example host driver. The host driver is based on libusb and compiles -on various Unix flavors (Linux, BSD, Mac OS X). It also compiles natively on -Windows using MinGW (see www.mingw.org) and libusb-win32 (see -libusb-win32.sourceforge.net). The "Automator" project contains a native -Windows host driver (not based on libusb) for Human Interface Devices. - - -DEVELOPMENT SYSTEM -================== -This driver has been developed and optimized for the GNU compiler version 3 -(gcc 3). It does work well with gcc 4 and future versions will probably be -optimized for gcc 4. We recommend that you use the GNU compiler suite because -it is freely available. AVR-USB has also been ported to the IAR compiler and -assembler. It has been tested with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 -with the "small" and "tiny" memory model. Please note that gcc is more -efficient for usbdrv.c because this module has been deliberately optimized -for gcc. - - -USING AVR-USB FOR FREE -====================== -The AVR firmware driver is published under the GNU General Public License -Version 2 (GPL2). See the file "License.txt" for details. - -If you decide for the free GPL2, we STRONGLY ENCOURAGE you to do the following -things IN ADDITION to the obligations from the GPL2: - -(1) Publish your entire project on a web site and drop us a note with the URL. -Use the form at http://www.obdev.at/avrusb/feedback.html for your submission. - -(2) Adhere to minimum publication standards. Please include AT LEAST: - - a circuit diagram in PDF, PNG or GIF format - - full source code for the host software - - a Readme.txt file in ASCII format which describes the purpose of the - project and what can be found in which directories and which files - - a reference to http://www.obdev.at/avrusb/ - -(3) If you improve the driver firmware itself, please give us a free license -to your modifications for our commercial license offerings. - - -COMMERCIAL LICENSES FOR AVR-USB -=============================== -If you don't want to publish your source code under the terms of the GPL2, -you can simply pay money for AVR-USB. As an additional benefit you get -USB PIDs for free, licensed exclusively to you. See the file -"CommercialLicense.txt" for details. - diff --git a/tools/gnusb/firmware/usbdrv/USBID-License.txt b/tools/gnusb/firmware/usbdrv/USBID-License.txt deleted file mode 100644 index 4739a57..0000000 --- a/tools/gnusb/firmware/usbdrv/USBID-License.txt +++ /dev/null @@ -1,143 +0,0 @@ -Royalty-Free Non-Exclusive License USB Product-ID -================================================= - -Version 2006-06-19 - -OBJECTIVE DEVELOPMENT Software GmbH hereby grants you the non-exclusive -right to use three USB.org vendor-ID (VID) / product-ID (PID) pairs with -products based on Objective Development's firmware-only USB driver for -Atmel AVR microcontrollers: - - * VID = 5824 (=0x16c0) / PID = 1500 (=0x5dc) for devices implementing no - USB device class (vendor-class devices with USB class = 0xff). Devices - using this pair will be referred to as "VENDOR CLASS" devices. - - * VID = 5824 (=0x16c0) / PID = 1503 (=0x5df) for HID class devices - (excluding mice and keyboards). Devices using this pair will be referred - to as "HID CLASS" devices. - - * VID = 5824 (=0x16c0) / PID = 1505 (=0x5e1) for CDC class modem devices - Devices using this pair will be referred to as "CDC-ACM CLASS" devices. - -Since the granted right is non-exclusive, the same VID/PID pairs may be -used by many companies and individuals for different products. To avoid -conflicts, your device and host driver software MUST adhere to the rules -outlined below. - -OBJECTIVE DEVELOPMENT Software GmbH has licensed these VID/PID pairs from -Wouter van Ooijen (see www.voti.nl), who has licensed the VID from the USB -Implementers Forum, Inc. (see www.usb.org). The VID is registered for the -company name "Van Ooijen Technische Informatica". - - -RULES AND RESTRICTIONS -====================== - -(1) The USB device MUST provide a textual representation of the -manufacturer and product identification. The manufacturer identification -MUST be available at least in USB language 0x0409 (English/US). - -(2) The textual manufacturer identification MUST contain either an Internet -domain name (e.g. "mycompany.com") registered and owned by you, or an -e-mail address under your control (e.g. "myname@gmx.net"). You can embed -the domain name or e-mail address in any string you like, e.g. "Objective -Development http://www.obdev.at/avrusb/". - -(3) You are responsible for retaining ownership of the domain or e-mail -address for as long as any of your products are in use. - -(4) You may choose any string for the textual product identification, as -long as this string is unique within the scope of your textual manufacturer -identification. - -(5) Matching of device-specific drivers MUST be based on the textual -manufacturer and product identification in addition to the usual VID/PID -matching. This means that operating system features which are based on -VID/PID matching only (e.g. Windows kernel level drivers, automatic actions -when the device is plugged in etc) MUST NOT be used. The driver matching -MUST be a comparison of the entire strings, NOT a sub-string match. For -CDC-ACM CLASS devices, a generic class driver should be used and the -matching is based on the USB device class. - -(6) The extent to which VID/PID matching is allowed for non device-specific -drivers or features depends on the operating system and particular VID/PID -pair used: - - * Mac OS X, Linux, FreeBSD and other Unixes: No VID/PID matching is - required and hence no VID/PID-only matching is allowed at all. - - * Windows: The operating system performs VID/PID matching for the kernel - level driver. You are REQUIRED to use libusb-win32 (see - http://libusb-win32.sourceforge.net/) as the kernel level driver for - VENDOR CLASS devices. HID CLASS devices all use the generic HID class - driver shipped with Windows, except mice and keyboards. You therefore - MUST NOT use any of the shared VID/PID pairs for mice or keyboards. - CDC-ACM CLASS devices require a ".inf" file which matches on the VID/PID - pair. This ".inf" file MUST load the "usbser" driver to configure the - device as modem (COM-port). - -(7) OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any -problems which are caused by the shared use of these VID/PID pairs. You -have been warned that the sharing of VID/PID pairs may cause problems. If -you want to avoid them, get your own VID/PID pair for exclusive use. - - -HOW TO IMPLEMENT THESE RULES -============================ - -The following rules are for VENDOR CLASS and HID CLASS devices. CDC-ACM -CLASS devices use the operating system's class driver and don't need a -custom driver. - -The host driver MUST iterate over all devices with the given VID/PID -numbers in their device descriptors and query the string representation for -the manufacturer name in USB language 0x0409 (English/US). It MUST compare -the ENTIRE string with your textual manufacturer identification chosen in -(2) above. A substring search for your domain or e-mail address is NOT -acceptable. The driver MUST NOT touch the device (other than querying the -descriptors) unless the strings match. - -For all USB devices with matching VID/PID and textual manufacturer -identification, the host driver must query the textual product -identification and string-compare it with the name of the product it can -control. It may only initialize the device if the product matches exactly. - -Objective Development provides examples for these matching rules with the -"PowerSwitch" project (using libusb) and with the "Automator" project -(using Windows calls on Windows and libusb on Unix). - - -Technical Notes: -================ - -Sharing the same VID/PID pair among devices is possible as long as ALL -drivers which match the VID/PID also perform matching on the textual -identification strings. This is easy on all operating systems except -Windows, since Windows establishes a static connection between the VID/PID -pair and a kernel level driver. All devices with the same VID/PID pair must -therefore use THE SAME kernel level driver. - -We therefore demand that you use libusb-win32 for VENDOR CLASS devices. -This is a generic kernel level driver which allows all types of USB access -for user space applications. This is only a partial solution of the -problem, though, because different device drivers may come with different -versions of libusb-win32 and they may not work with the libusb version of -the respective other driver. You are therefore encouraged to test your -driver against a broad range of libusb-win32 versions. Do not use new -features in new versions, or check for their existence before you use them. -When a new libusb-win32 becomes available, make sure that your driver is -compatible with it. - -For HID CLASS devices it is necessary that all those devices bind to the -same kernel driver: Microsoft's generic USB HID driver. This is true for -all HID devices except those with a specialized driver. Currently, the only -HIDs with specialized drivers are mice and keyboards. You therefore MUST -NOT use a shared VID/PID with mouse and keyboard devices. - -Sharing the same VID/PID among different products is unusual and probably -violates the USB specification. If you do it, you do it at your own risk. - -To avoid possible incompatibilities, we highly recommend that you get your -own VID/PID pair if you intend to sell your product. Objective -Development's commercial licenses for AVR-USB include a PID for -unrestricted exclusive use. diff --git a/tools/gnusb/firmware/usbdrv/iarcompat.h b/tools/gnusb/firmware/usbdrv/iarcompat.h deleted file mode 100644 index 1a45540..0000000 --- a/tools/gnusb/firmware/usbdrv/iarcompat.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Name: iarcompat.h - * Project: AVR USB driver - * Author: Christian Starkjohann - * Creation Date: 2006-03-01 - * Tabsize: 4 - * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt) - * This Revision: $Id: iarcompat.h 275 2007-03-20 09:58:28Z cs $ - */ - -/* -General Description: -This header is included when we compile with the IAR C-compiler and assembler. -It defines macros for cross compatibility between gcc and IAR-cc. - -Thanks to Oleg Semyonov for his help with the IAR tools port! -*/ - -#ifndef __iarcompat_h_INCLUDED__ -#define __iarcompat_h_INCLUDED__ - -#if defined __IAR_SYSTEMS_ICC__ || defined __IAR_SYSTEMS_ASM__ - -/* Enable bit definitions */ -#ifndef ENABLE_BIT_DEFINITIONS -# define ENABLE_BIT_DEFINITIONS 1 -#endif - -/* Include IAR headers */ -#include -#ifndef __IAR_SYSTEMS_ASM__ -# include -#endif - -#define __attribute__(arg) -#define IAR_SECTION(section) @ section - -#ifndef USB_BUFFER_SECTION -# define USB_BUFFER_SECTION "TINY_Z" /* if user has not selected a named section */ -#endif - -#ifdef __IAR_SYSTEMS_ASM__ -# define __ASSEMBLER__ -#endif - -#ifdef __HAS_ELPM__ -# define PROGMEM __farflash -#else -# define PROGMEM __flash -#endif - -#define PRG_RDB(addr) (*(PROGMEM char *)(addr)) - -/* The following definitions are not needed by the driver, but may be of some - * help if you port a gcc based project to IAR. - */ -#define cli() __disable_interrupt() -#define sei() __enable_interrupt() -#define wdt_reset() __watchdog_reset() - -/* Depending on the device you use, you may get problems with the way usbdrv.h - * handles the differences between devices. Since IAR does not use #defines - * for MCU registers, we can't check for the existence of a particular - * register with an #ifdef. If the autodetection mechanism fails, include - * definitions for the required USB_INTR_* macros in your usbconfig.h. See - * usbconfig-prototype.h and usbdrv.h for details. - */ - -#endif /* defined __IAR_SYSTEMS_ICC__ || defined __IAR_SYSTEMS_ASM__ */ -#endif /* __iarcompat_h_INCLUDED__ */ diff --git a/tools/gnusb/firmware/usbdrv/oddebug.c b/tools/gnusb/firmware/usbdrv/oddebug.c deleted file mode 100644 index bd528e2..0000000 --- a/tools/gnusb/firmware/usbdrv/oddebug.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Name: oddebug.c - * Project: AVR library - * Author: Christian Starkjohann - * Creation Date: 2005-01-16 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt) - * This Revision: $Id: oddebug.c 275 2007-03-20 09:58:28Z cs $ - */ - -#include "oddebug.h" - -#if DEBUG_LEVEL > 0 - -#warning "Never compile production devices with debugging enabled" - -static void uartPutc(char c) -{ - while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */ - ODDBG_UDR = c; -} - -static uchar hexAscii(uchar h) -{ - h &= 0xf; - if(h >= 10) - h += 'a' - (uchar)10 - '0'; - h += '0'; - return h; -} - -static void printHex(uchar c) -{ - uartPutc(hexAscii(c >> 4)); - uartPutc(hexAscii(c)); -} - -void odDebug(uchar prefix, uchar *data, uchar len) -{ - printHex(prefix); - uartPutc(':'); - while(len--){ - uartPutc(' '); - printHex(*data++); - } - uartPutc('\r'); - uartPutc('\n'); -} - -#endif diff --git a/tools/gnusb/firmware/usbdrv/oddebug.h b/tools/gnusb/firmware/usbdrv/oddebug.h deleted file mode 100644 index 1b11ef0..0000000 --- a/tools/gnusb/firmware/usbdrv/oddebug.h +++ /dev/null @@ -1,126 +0,0 @@ -/* Name: oddebug.h - * Project: AVR library - * Author: Christian Starkjohann - * Creation Date: 2005-01-16 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt) - * This Revision: $Id: oddebug.h 275 2007-03-20 09:58:28Z cs $ - */ - -#ifndef __oddebug_h_included__ -#define __oddebug_h_included__ - -/* -General Description: -This module implements a function for debug logs on the serial line of the -AVR microcontroller. Debugging can be configured with the define -'DEBUG_LEVEL'. If this macro is not defined or defined to 0, all debugging -calls are no-ops. If it is 1, DBG1 logs will appear, but not DBG2. If it is -2, DBG1 and DBG2 logs will be printed. - -A debug log consists of a label ('prefix') to indicate which debug log created -the output and a memory block to dump in hex ('data' and 'len'). -*/ - - -#ifndef F_CPU -# define F_CPU 12000000 /* 12 MHz */ -#endif - -/* make sure we have the UART defines: */ -#include "iarcompat.h" -#ifndef __IAR_SYSTEMS_ICC__ -# include -#endif - -#ifndef uchar -# define uchar unsigned char -#endif - -#if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */ -# warning "Debugging disabled because device has no UART" -# undef DEBUG_LEVEL -#endif - -#ifndef DEBUG_LEVEL -# define DEBUG_LEVEL 0 -#endif - -/* ------------------------------------------------------------------------- */ - -#if DEBUG_LEVEL > 0 -# define DBG1(prefix, data, len) odDebug(prefix, data, len) -#else -# define DBG1(prefix, data, len) -#endif - -#if DEBUG_LEVEL > 1 -# define DBG2(prefix, data, len) odDebug(prefix, data, len) -#else -# define DBG2(prefix, data, len) -#endif - -/* ------------------------------------------------------------------------- */ - -#if DEBUG_LEVEL > 0 -extern void odDebug(uchar prefix, uchar *data, uchar len); - -/* Try to find our control registers; ATMEL likes to rename these */ - -#if defined UBRR -# define ODDBG_UBRR UBRR -#elif defined UBRRL -# define ODDBG_UBRR UBRRL -#elif defined UBRR0 -# define ODDBG_UBRR UBRR0 -#elif defined UBRR0L -# define ODDBG_UBRR UBRR0L -#endif - -#if defined UCR -# define ODDBG_UCR UCR -#elif defined UCSRB -# define ODDBG_UCR UCSRB -#elif defined UCSR0B -# define ODDBG_UCR UCSR0B -#endif - -#if defined TXEN -# define ODDBG_TXEN TXEN -#else -# define ODDBG_TXEN TXEN0 -#endif - -#if defined USR -# define ODDBG_USR USR -#elif defined UCSRA -# define ODDBG_USR UCSRA -#elif defined UCSR0A -# define ODDBG_USR UCSR0A -#endif - -#if defined UDRE -# define ODDBG_UDRE UDRE -#else -# define ODDBG_UDRE UDRE0 -#endif - -#if defined UDR -# define ODDBG_UDR UDR -#elif defined UDR0 -# define ODDBG_UDR UDR0 -#endif - -static inline void odDebugInit(void) -{ - ODDBG_UCR |= (1< -# include -#endif -#include "usbdrv.h" -#include "oddebug.h" - -/* -General Description: -This module implements the C-part of the USB driver. See usbdrv.h for a -documentation of the entire driver. -*/ - -#ifndef IAR_SECTION -#define IAR_SECTION(arg) -#define __no_init -#endif -/* The macro IAR_SECTION is a hack to allow IAR-cc compatibility. On gcc, it - * is defined to nothing. __no_init is required on IAR. - */ - -/* ------------------------------------------------------------------------- */ - -/* raw USB registers / interface to assembler code: */ -uchar usbRxBuf[2*USB_BUFSIZE]; /* raw RX buffer: PID, 8 bytes data, 2 bytes CRC */ -uchar usbInputBufOffset; /* offset in usbRxBuf used for low level receiving */ -uchar usbDeviceAddr; /* assigned during enumeration, defaults to 0 */ -uchar usbNewDeviceAddr; /* device ID which should be set after status phase */ -uchar usbConfiguration; /* currently selected configuration. Administered by driver, but not used */ -volatile schar usbRxLen; /* = 0; number of bytes in usbRxBuf; 0 means free, -1 for flow control */ -uchar usbCurrentTok; /* last token received, if more than 1 rx endpoint: MSb=endpoint */ -uchar usbRxToken; /* token for data we received; if more than 1 rx endpoint: MSb=endpoint */ -uchar usbMsgLen = 0xff; /* remaining number of bytes, no msg to send if -1 (see usbMsgPtr) */ -volatile uchar usbTxLen = USBPID_NAK; /* number of bytes to transmit with next IN token or handshake token */ -uchar usbTxBuf[USB_BUFSIZE];/* data to transmit with next IN, free if usbTxLen contains handshake token */ -# if USB_COUNT_SOF -volatile uchar usbSofCount; /* incremented by assembler module every SOF */ -# endif -#if USB_CFG_HAVE_INTRIN_ENDPOINT -volatile uchar usbTxLen1 = USBPID_NAK; /* TX count for endpoint 1 */ -uchar usbTxBuf1[USB_BUFSIZE]; /* TX data for endpoint 1 */ -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 -volatile uchar usbTxLen3 = USBPID_NAK; /* TX count for endpoint 3 */ -uchar usbTxBuf3[USB_BUFSIZE]; /* TX data for endpoint 3 */ -#endif -#endif - -/* USB status registers / not shared with asm code */ -uchar *usbMsgPtr; /* data to transmit next -- ROM or RAM address */ -static uchar usbMsgFlags; /* flag values see below */ - -#define USB_FLG_TX_PACKET (1<<0) -/* Leave free 6 bits after TX_PACKET. This way we can increment usbMsgFlags to toggle TX_PACKET */ -#define USB_FLG_MSGPTR_IS_ROM (1<<6) -#define USB_FLG_USE_DEFAULT_RW (1<<7) - -/* -optimizing hints: -- do not post/pre inc/dec integer values in operations -- assign value of PRG_RDB() to register variables and don't use side effects in arg -- use narrow scope for variables which should be in X/Y/Z register -- assign char sized expressions to variables to force 8 bit arithmetics -*/ - -/* ------------------------------------------------------------------------- */ - -#if USB_CFG_DESCR_PROPS_STRINGS == 0 - -#if USB_CFG_DESCR_PROPS_STRING_0 == 0 -#undef USB_CFG_DESCR_PROPS_STRING_0 -#define USB_CFG_DESCR_PROPS_STRING_0 sizeof(usbDescriptorString0) -PROGMEM char usbDescriptorString0[] = { /* language descriptor */ - 4, /* sizeof(usbDescriptorString0): length of descriptor in bytes */ - 3, /* descriptor type */ - 0x09, 0x04, /* language index (0x0409 = US-English) */ -}; -#endif - -#if USB_CFG_DESCR_PROPS_STRING_VENDOR == 0 && USB_CFG_VENDOR_NAME_LEN -#undef USB_CFG_DESCR_PROPS_STRING_VENDOR -#define USB_CFG_DESCR_PROPS_STRING_VENDOR sizeof(usbDescriptorStringVendor) -PROGMEM int usbDescriptorStringVendor[] = { - USB_STRING_DESCRIPTOR_HEADER(USB_CFG_VENDOR_NAME_LEN), - USB_CFG_VENDOR_NAME -}; -#endif - -#if USB_CFG_DESCR_PROPS_STRING_PRODUCT == 0 && USB_CFG_DEVICE_NAME_LEN -#undef USB_CFG_DESCR_PROPS_STRING_PRODUCT -#define USB_CFG_DESCR_PROPS_STRING_PRODUCT sizeof(usbDescriptorStringDevice) -PROGMEM int usbDescriptorStringDevice[] = { - USB_STRING_DESCRIPTOR_HEADER(USB_CFG_DEVICE_NAME_LEN), - USB_CFG_DEVICE_NAME -}; -#endif - -#if USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER == 0 && USB_CFG_SERIAL_NUMBER_LEN -#undef USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER -#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER sizeof(usbDescriptorStringSerialNumber) -PROGMEM int usbDescriptorStringSerialNumber[] = { - USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LEN), - USB_CFG_SERIAL_NUMBER -}; -#endif - -#endif /* USB_CFG_DESCR_PROPS_STRINGS == 0 */ - -#if USB_CFG_DESCR_PROPS_DEVICE == 0 -#undef USB_CFG_DESCR_PROPS_DEVICE -#define USB_CFG_DESCR_PROPS_DEVICE sizeof(usbDescriptorDevice) -PROGMEM char usbDescriptorDevice[] = { /* USB device descriptor */ - 18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */ - USBDESCR_DEVICE, /* descriptor type */ - 0x10, 0x01, /* USB version supported */ - USB_CFG_DEVICE_CLASS, - USB_CFG_DEVICE_SUBCLASS, - 0, /* protocol */ - 8, /* max packet size */ - USB_CFG_VENDOR_ID, /* 2 bytes */ - USB_CFG_DEVICE_ID, /* 2 bytes */ - USB_CFG_DEVICE_VERSION, /* 2 bytes */ - USB_CFG_DESCR_PROPS_STRING_VENDOR != 0 ? 1 : 0, /* manufacturer string index */ - USB_CFG_DESCR_PROPS_STRING_PRODUCT != 0 ? 2 : 0, /* product string index */ - USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER != 0 ? 3 : 0, /* serial number string index */ - 1, /* number of configurations */ -}; -#endif - -#if USB_CFG_DESCR_PROPS_HID_REPORT != 0 && USB_CFG_DESCR_PROPS_HID == 0 -#undef USB_CFG_DESCR_PROPS_HID -#define USB_CFG_DESCR_PROPS_HID 9 /* length of HID descriptor in config descriptor below */ -#endif - -#if USB_CFG_DESCR_PROPS_CONFIGURATION == 0 -#undef USB_CFG_DESCR_PROPS_CONFIGURATION -#define USB_CFG_DESCR_PROPS_CONFIGURATION sizeof(usbDescriptorConfiguration) -PROGMEM char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ - 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */ - USBDESCR_CONFIG, /* descriptor type */ - 18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + (USB_CFG_DESCR_PROPS_HID & 0xff), 0, - /* total length of data returned (including inlined descriptors) */ - 1, /* number of interfaces in this configuration */ - 1, /* index of this configuration */ - 0, /* configuration name string index */ -#if USB_CFG_IS_SELF_POWERED - USBATTR_SELFPOWER, /* attributes */ -#else - USBATTR_BUSPOWER, /* attributes */ -#endif - USB_CFG_MAX_BUS_POWER/2, /* max USB current in 2mA units */ -/* interface descriptor follows inline: */ - 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */ - USBDESCR_INTERFACE, /* descriptor type */ - 0, /* index of this interface */ - 0, /* alternate setting for this interface */ - USB_CFG_HAVE_INTRIN_ENDPOINT, /* endpoints excl 0: number of endpoint descriptors to follow */ - USB_CFG_INTERFACE_CLASS, - USB_CFG_INTERFACE_SUBCLASS, - USB_CFG_INTERFACE_PROTOCOL, - 0, /* string index for interface */ -#if (USB_CFG_DESCR_PROPS_HID & 0xff) /* HID descriptor */ - 9, /* sizeof(usbDescrHID): length of descriptor in bytes */ - USBDESCR_HID, /* descriptor type: HID */ - 0x01, 0x01, /* BCD representation of HID version */ - 0x00, /* target country code */ - 0x01, /* number of HID Report (or other HID class) Descriptor infos to follow */ - 0x22, /* descriptor type: report */ - USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0, /* total length of report descriptor */ -#endif -#if USB_CFG_HAVE_INTRIN_ENDPOINT /* endpoint descriptor for endpoint 1 */ - 7, /* sizeof(usbDescrEndpoint) */ - USBDESCR_ENDPOINT, /* descriptor type = endpoint */ - 0x81, /* IN endpoint number 1 */ - 0x03, /* attrib: Interrupt endpoint */ - 8, 0, /* maximum packet size */ - USB_CFG_INTR_POLL_INTERVAL, /* in ms */ -#endif -}; -#endif - -/* We don't use prog_int or prog_int16_t for compatibility with various libc - * versions. Here's an other compatibility hack: - */ -#ifndef PRG_RDB -#define PRG_RDB(addr) pgm_read_byte(addr) -#endif - -typedef union{ - unsigned word; - uchar *ptr; - uchar bytes[2]; -}converter_t; -/* We use this union to do type conversions. This is better optimized than - * type casts in gcc 3.4.3 and much better than using bit shifts to build - * ints from chars. Byte ordering is not a problem on an 8 bit platform. - */ - -/* ------------------------------------------------------------------------- */ - -#if USB_CFG_HAVE_INTRIN_ENDPOINT -USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len) -{ -uchar *p, i; - -#if USB_CFG_IMPLEMENT_HALT - if(usbTxLen1 == USBPID_STALL) - return; -#endif -#if 0 /* No runtime checks! Caller is responsible for valid data! */ - if(len > 8) /* interrupt transfers are limited to 8 bytes */ - len = 8; -#endif - if(usbTxLen1 & 0x10){ /* packet buffer was empty */ - usbTxBuf1[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* toggle token */ - }else{ - usbTxLen1 = USBPID_NAK; /* avoid sending outdated (overwritten) interrupt data */ - } - p = usbTxBuf1 + 1; - for(i=len;i--;) - *p++ = *data++; - usbCrc16Append(&usbTxBuf1[1], len); - usbTxLen1 = len + 4; /* len must be given including sync byte */ - DBG2(0x21, usbTxBuf1, len + 3); -} -#endif - -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 -USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len) -{ -uchar *p, i; - - if(usbTxLen3 & 0x10){ /* packet buffer was empty */ - usbTxBuf3[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* toggle token */ - }else{ - usbTxLen3 = USBPID_NAK; /* avoid sending outdated (overwritten) interrupt data */ - } - p = usbTxBuf3 + 1; - for(i=len;i--;) - *p++ = *data++; - usbCrc16Append(&usbTxBuf3[1], len); - usbTxLen3 = len + 4; /* len must be given including sync byte */ - DBG2(0x23, usbTxBuf3, len + 3); -} -#endif - - -static uchar usbRead(uchar *data, uchar len) -{ -#if USB_CFG_IMPLEMENT_FN_READ - if(usbMsgFlags & USB_FLG_USE_DEFAULT_RW){ -#endif - uchar i = len, *r = usbMsgPtr; - if(usbMsgFlags & USB_FLG_MSGPTR_IS_ROM){ /* ROM data */ - while(i--){ - uchar c = PRG_RDB(r); /* assign to char size variable to enforce byte ops */ - *data++ = c; - r++; - } - }else{ /* RAM data */ - while(i--) - *data++ = *r++; - } - usbMsgPtr = r; - return len; -#if USB_CFG_IMPLEMENT_FN_READ - }else{ - if(len != 0) /* don't bother app with 0 sized reads */ - return usbFunctionRead(data, len); - return 0; - } -#endif -} - - -#define GET_DESCRIPTOR(cfgProp, staticName) \ - if(cfgProp){ \ - if((cfgProp) & USB_PROP_IS_RAM) \ - flags &= ~USB_FLG_MSGPTR_IS_ROM; \ - if((cfgProp) & USB_PROP_IS_DYNAMIC){ \ - replyLen = usbFunctionDescriptor(rq); \ - }else{ \ - replyData = (uchar *)(staticName); \ - SET_REPLY_LEN((cfgProp) & 0xff); \ - } \ - } -/* We use if() instead of #if in the macro above because #if can't be used - * in macros and the compiler optimizes constant conditions anyway. - */ - - -/* Don't make this function static to avoid inlining. - * The entire function would become too large and exceed the range of - * relative jumps. - * 2006-02-25: Either gcc 3.4.3 is better than the gcc used when the comment - * above was written, or other parts of the code have changed. We now get - * better results with an inlined function. Test condition: PowerSwitch code. - */ -static void usbProcessRx(uchar *data, uchar len) -{ -usbRequest_t *rq = (void *)data; -uchar replyLen = 0, flags = USB_FLG_USE_DEFAULT_RW; -/* We use if() cascades because the compare is done byte-wise while switch() - * is int-based. The if() cascades are therefore more efficient. - */ -/* usbRxToken can be: - * 0x2d 00101101 (USBPID_SETUP for endpoint 0) - * 0xe1 11100001 (USBPID_OUT for endpoint 0) - * 0xff 11111111 (USBPID_OUT for endpoint 1) - */ - DBG2(0x10 + ((usbRxToken >> 1) & 3), data, len); /* SETUP0=12; OUT0=10; OUT1=13 */ -#ifdef USB_RX_USER_HOOK - USB_RX_USER_HOOK(data, len) -#endif -#if USB_CFG_IMPLEMENT_FN_WRITEOUT - if(usbRxToken == 0xff){ - usbFunctionWriteOut(data, len); - return; /* no reply expected, hence no usbMsgPtr, usbMsgFlags, usbMsgLen set */ - } -#endif - if(usbRxToken == (uchar)USBPID_SETUP){ - usbTxLen = USBPID_NAK; /* abort pending transmit */ - if(len == 8){ /* Setup size must be always 8 bytes. Ignore otherwise. */ - uchar type = rq->bmRequestType & USBRQ_TYPE_MASK; - if(type == USBRQ_TYPE_STANDARD){ - #define SET_REPLY_LEN(len) replyLen = (len); usbMsgPtr = replyData - /* This macro ensures that replyLen and usbMsgPtr are always set in the same way. - * That allows optimization of common code in if() branches */ - uchar *replyData = usbTxBuf + 9; /* there is 3 bytes free space at the end of the buffer */ - replyData[0] = 0; /* common to USBRQ_GET_STATUS and USBRQ_GET_INTERFACE */ - if(rq->bRequest == USBRQ_GET_STATUS){ /* 0 */ - uchar __attribute__((__unused__)) recipient = rq->bmRequestType & USBRQ_RCPT_MASK; /* assign arith ops to variables to enforce byte size */ -#if USB_CFG_IS_SELF_POWERED - if(recipient == USBRQ_RCPT_DEVICE) - replyData[0] = USB_CFG_IS_SELF_POWERED; -#endif -#if USB_CFG_HAVE_INTRIN_ENDPOINT && USB_CFG_IMPLEMENT_HALT - if(recipient == USBRQ_RCPT_ENDPOINT && rq->wIndex.bytes[0] == 0x81) /* request status for endpoint 1 */ - replyData[0] = usbTxLen1 == USBPID_STALL; -#endif - replyData[1] = 0; - SET_REPLY_LEN(2); - }else if(rq->bRequest == USBRQ_SET_ADDRESS){ /* 5 */ - usbNewDeviceAddr = rq->wValue.bytes[0]; - }else if(rq->bRequest == USBRQ_GET_DESCRIPTOR){ /* 6 */ - flags = USB_FLG_MSGPTR_IS_ROM | USB_FLG_USE_DEFAULT_RW; - if(rq->wValue.bytes[1] == USBDESCR_DEVICE){ /* 1 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_DEVICE, usbDescriptorDevice) - }else if(rq->wValue.bytes[1] == USBDESCR_CONFIG){ /* 2 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_CONFIGURATION, usbDescriptorConfiguration) - }else if(rq->wValue.bytes[1] == USBDESCR_STRING){ /* 3 */ -#if USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC - if(USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_RAM) - flags &= ~USB_FLG_MSGPTR_IS_ROM; - replyLen = usbFunctionDescriptor(rq); -#else /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ - if(rq->wValue.bytes[0] == 0){ /* descriptor index */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_0, usbDescriptorString0) - }else if(rq->wValue.bytes[0] == 1){ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_VENDOR, usbDescriptorStringVendor) - }else if(rq->wValue.bytes[0] == 2){ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_PRODUCT, usbDescriptorStringDevice) - }else if(rq->wValue.bytes[0] == 3){ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER, usbDescriptorStringSerialNumber) - }else if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){ - replyLen = usbFunctionDescriptor(rq); - } -#endif /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ -#if USB_CFG_DESCR_PROPS_HID_REPORT /* only support HID descriptors if enabled */ - }else if(rq->wValue.bytes[1] == USBDESCR_HID){ /* 0x21 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID, usbDescriptorConfiguration + 18) - }else if(rq->wValue.bytes[1] == USBDESCR_HID_REPORT){ /* 0x22 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID_REPORT, usbDescriptorHidReport) -#endif /* USB_CFG_DESCR_PROPS_HID_REPORT */ - }else if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){ - replyLen = usbFunctionDescriptor(rq); - } - }else if(rq->bRequest == USBRQ_GET_CONFIGURATION){ /* 8 */ - replyData = &usbConfiguration; /* send current configuration value */ - SET_REPLY_LEN(1); - }else if(rq->bRequest == USBRQ_SET_CONFIGURATION){ /* 9 */ - usbConfiguration = rq->wValue.bytes[0]; -#if USB_CFG_IMPLEMENT_HALT - usbTxLen1 = USBPID_NAK; -#endif - }else if(rq->bRequest == USBRQ_GET_INTERFACE){ /* 10 */ - SET_REPLY_LEN(1); -#if USB_CFG_HAVE_INTRIN_ENDPOINT - }else if(rq->bRequest == USBRQ_SET_INTERFACE){ /* 11 */ - USB_SET_DATATOKEN1(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */ -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 - USB_SET_DATATOKEN3(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */ -# endif -# if USB_CFG_IMPLEMENT_HALT - usbTxLen1 = USBPID_NAK; - }else if(rq->bRequest == USBRQ_CLEAR_FEATURE || rq->bRequest == USBRQ_SET_FEATURE){ /* 1|3 */ - if(rq->wValue.bytes[0] == 0 && rq->wIndex.bytes[0] == 0x81){ /* feature 0 == HALT for endpoint == 1 */ - usbTxLen1 = rq->bRequest == USBRQ_CLEAR_FEATURE ? USBPID_NAK : USBPID_STALL; - USB_SET_DATATOKEN1(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */ -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 - USB_SET_DATATOKEN3(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */ -# endif - } -# endif -#endif - }else{ - /* the following requests can be ignored, send default reply */ - /* 1: CLEAR_FEATURE, 3: SET_FEATURE, 7: SET_DESCRIPTOR */ - /* 12: SYNCH_FRAME */ - } - #undef SET_REPLY_LEN - }else{ /* not a standard request -- must be vendor or class request */ - replyLen = usbFunctionSetup(data); - } -#if USB_CFG_IMPLEMENT_FN_READ || USB_CFG_IMPLEMENT_FN_WRITE - if(replyLen == 0xff){ /* use user-supplied read/write function */ - if((rq->bmRequestType & USBRQ_DIR_MASK) == USBRQ_DIR_DEVICE_TO_HOST){ - replyLen = rq->wLength.bytes[0]; /* IN transfers only */ - } - flags &= ~USB_FLG_USE_DEFAULT_RW; /* we have no valid msg, use user supplied read/write functions */ - }else /* The 'else' prevents that we limit a replyLen of 0xff to the maximum transfer len. */ -#endif - if(!rq->wLength.bytes[1] && replyLen > rq->wLength.bytes[0]) /* limit length to max */ - replyLen = rq->wLength.bytes[0]; - } - /* make sure that data packets which are sent as ACK to an OUT transfer are always zero sized */ - }else{ /* DATA packet from out request */ -#if USB_CFG_IMPLEMENT_FN_WRITE - if(!(usbMsgFlags & USB_FLG_USE_DEFAULT_RW)){ - uchar rval = usbFunctionWrite(data, len); - replyLen = 0xff; - if(rval == 0xff){ /* an error occurred */ - usbMsgLen = 0xff; /* cancel potentially pending data packet for ACK */ - usbTxLen = USBPID_STALL; - }else if(rval != 0){ /* This was the final package */ - replyLen = 0; /* answer with a zero-sized data packet */ - } - flags = 0; /* start with a DATA1 package, stay with user supplied write() function */ - } -#endif - } - usbMsgFlags = flags; - usbMsgLen = replyLen; -} - -/* ------------------------------------------------------------------------- */ - -static void usbBuildTxBlock(void) -{ -uchar wantLen, len, txLen, token; - - wantLen = usbMsgLen; - if(wantLen > 8) - wantLen = 8; - usbMsgLen -= wantLen; - token = USBPID_DATA1; - if(usbMsgFlags & USB_FLG_TX_PACKET) - token = USBPID_DATA0; - usbMsgFlags++; - len = usbRead(usbTxBuf + 1, wantLen); - if(len <= 8){ /* valid data packet */ - usbCrc16Append(&usbTxBuf[1], len); - txLen = len + 4; /* length including sync byte */ - if(len < 8) /* a partial package identifies end of message */ - usbMsgLen = 0xff; - }else{ - txLen = USBPID_STALL; /* stall the endpoint */ - usbMsgLen = 0xff; - } - usbTxBuf[0] = token; - usbTxLen = txLen; - DBG2(0x20, usbTxBuf, txLen-1); -} - -static inline uchar isNotSE0(void) -{ -uchar rval; -/* We want to do - * return (USBIN & USBMASK); - * here, but the compiler does int-expansion acrobatics. - * We can avoid this by assigning to a char-sized variable. - */ - rval = USBIN & USBMASK; - return rval; -} - -/* ------------------------------------------------------------------------- */ - -USB_PUBLIC void usbPoll(void) -{ -schar len; -uchar i; - - if((len = usbRxLen) > 0){ -/* We could check CRC16 here -- but ACK has already been sent anyway. If you - * need data integrity checks with this driver, check the CRC in your app - * code and report errors back to the host. Since the ACK was already sent, - * retries must be handled on application level. - * unsigned crc = usbCrc16(buffer + 1, usbRxLen - 3); - */ - usbProcessRx(usbRxBuf + USB_BUFSIZE + 1 - usbInputBufOffset, len - 3); -#if USB_CFG_HAVE_FLOWCONTROL - if(usbRxLen > 0) /* only mark as available if not inactivated */ - usbRxLen = 0; -#else - usbRxLen = 0; /* mark rx buffer as available */ -#endif - } - if(usbTxLen & 0x10){ /* transmit system idle */ - if(usbMsgLen != 0xff){ /* transmit data pending? */ - usbBuildTxBlock(); - } - } - for(i = 10; i > 0; i--){ - if(isNotSE0()) - break; - } - if(i == 0){ /* RESET condition, called multiple times during reset */ - usbNewDeviceAddr = 0; - usbDeviceAddr = 0; -#if USB_CFG_IMPLEMENT_HALT - usbTxLen1 = USBPID_NAK; -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 - usbTxLen3 = USBPID_NAK; -#endif -#endif - DBG1(0xff, 0, 0); - } -} - -/* ------------------------------------------------------------------------- */ - -USB_PUBLIC void usbInit(void) -{ -#if USB_INTR_CFG_SET != 0 - USB_INTR_CFG |= USB_INTR_CFG_SET; -#endif -#if USB_INTR_CFG_CLR != 0 - USB_INTR_CFG &= ~(USB_INTR_CFG_CLR); -#endif - USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT); -#if USB_CFG_HAVE_INTRIN_ENDPOINT - USB_SET_DATATOKEN1(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */ -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 - USB_SET_DATATOKEN3(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */ -# endif -#endif -} - -/* ------------------------------------------------------------------------- */ diff --git a/tools/gnusb/firmware/usbdrv/usbdrv.h b/tools/gnusb/firmware/usbdrv/usbdrv.h deleted file mode 100644 index f75befc..0000000 --- a/tools/gnusb/firmware/usbdrv/usbdrv.h +++ /dev/null @@ -1,655 +0,0 @@ -/* Name: usbdrv.h - * Project: AVR USB driver - * Author: Christian Starkjohann - * Creation Date: 2004-12-29 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrv.h 396 2007-09-19 16:39:54Z cs $ - */ - -#ifndef __usbdrv_h_included__ -#define __usbdrv_h_included__ -#include "usbconfig.h" -#include "iarcompat.h" - -/* -Hardware Prerequisites: -======================= -USB lines D+ and D- MUST be wired to the same I/O port. We recommend that D+ -triggers the interrupt (best achieved by using INT0 for D+), but it is also -possible to trigger the interrupt from D-. If D- is used, interrupts are also -triggered by SOF packets. D- requires a pullup of 1.5k to +3.5V (and the device -must be powered at 3.5V) to identify as low-speed USB device. A pullup of -1M SHOULD be connected from D+ to +3.5V to prevent interference when no USB -master is connected. We use D+ as interrupt source and not D- because it -does not trigger on keep-alive and RESET states. - -As a compile time option, the 1.5k pullup resistor on D- can be made -switchable to allow the device to disconnect at will. See the definition of -usbDeviceConnect() and usbDeviceDisconnect() further down in this file. - -Please adapt the values in usbconfig.h according to your hardware! - -The device MUST be clocked at exactly 12 MHz, 15 MHz or 16 MHz -or at 16.5 MHz +/- 1%. See usbconfig-prototype.h for details. - - -Limitations: -============ -Robustness with respect to communication errors: -The driver assumes error-free communication. It DOES check for errors in -the PID, but does NOT check bit stuffing errors, SE0 in middle of a byte, -token CRC (5 bit) and data CRC (16 bit). CRC checks can not be performed due -to timing constraints: We must start sending a reply within 7 bit times. -Bit stuffing and misplaced SE0 would have to be checked in real-time, but CPU -performance does not permit that. The driver does not check Data0/Data1 -toggling, but application software can implement the check. - -Input characteristics: -Since no differential receiver circuit is used, electrical interference -robustness may suffer. The driver samples only one of the data lines with -an ordinary I/O pin's input characteristics. However, since this is only a -low speed USB implementation and the specification allows for 8 times the -bit rate over the same hardware, we should be on the safe side. Even the spec -requires detection of asymmetric states at high bit rate for SE0 detection. - -Number of endpoints: -The driver supports up to four endpoints: One control endpoint (endpoint 0), -two interrupt-in (or bulk-in) endpoints (endpoint 1 and 3) and one -interrupt-out (or bulk-out) endpoint (endpoint 1). Please note that the USB -standard forbids bulk endpoints for low speed devices! Most operating systems -allow them anyway, but the AVR will spend 90% of the CPU time in the USB -interrupt polling for bulk data. -By default, only the control endpoint 0 is enabled. To get the other endpoints, -define USB_CFG_HAVE_INTRIN_ENDPOINT, USB_CFG_HAVE_INTRIN_ENDPOINT3 and/or -USB_CFG_IMPLEMENT_FN_WRITEOUT respectively (see usbconfig-prototype.h for -details). - -Maximum data payload: -Data payload of control in and out transfers may be up to 254 bytes. In order -to accept payload data of out transfers, you need to implement -'usbFunctionWrite()'. - -USB Suspend Mode supply current: -The USB standard limits power consumption to 500uA when the bus is in suspend -mode. This is not a problem for self-powered devices since they don't need -bus power anyway. Bus-powered devices can achieve this only by putting the -CPU in sleep mode. The driver does not implement suspend handling by itself. -However, the application may implement activity monitoring and wakeup from -sleep. The host sends regular SE0 states on the bus to keep it active. These -SE0 states can be detected by wiring the INT1 pin to D-. It is not necessary -to enable the interrupt, checking the interrupt pending flag should suffice. -Before entering sleep mode, the application should enable INT1 for a wakeup -on the next bus activity. - -Operation without an USB master: -The driver behaves neutral without connection to an USB master if D- reads -as 1. To avoid spurious interrupts, we recommend a high impedance (e.g. 1M) -pullup resistor on D+ (interrupt). If D- becomes statically 0, the driver may -block in the interrupt routine. - -Interrupt latency: -The application must ensure that the USB interrupt is not disabled for more -than 25 cycles (this is for 12 MHz, faster clocks allow longer latency). -This implies that all interrupt routines must either be declared as "INTERRUPT" -instead of "SIGNAL" (see "avr/signal.h") or that they are written in assembler -with "sei" as the first instruction. - -Maximum interrupt duration / CPU cycle consumption: -The driver handles all USB communication during the interrupt service -routine. The routine will not return before an entire USB message is received -and the reply is sent. This may be up to ca. 1200 cycles @ 12 MHz (= 100us) if -the host conforms to the standard. The driver will consume CPU cycles for all -USB messages, even if they address another (low-speed) device on the same bus. - -*/ - -/* ------------------------------------------------------------------------- */ -/* --------------------------- Module Interface ---------------------------- */ -/* ------------------------------------------------------------------------- */ - -#define USBDRV_VERSION 20070919 -/* This define uniquely identifies a driver version. It is a decimal number - * constructed from the driver's release date in the form YYYYMMDD. If the - * driver's behavior or interface changes, you can use this constant to - * distinguish versions. If it is not defined, the driver's release date is - * older than 2006-01-25. - */ - - -#ifndef USB_PUBLIC -#define USB_PUBLIC -#endif -/* USB_PUBLIC is used as declaration attribute for all functions exported by - * the USB driver. The default is no attribute (see above). You may define it - * to static either in usbconfig.h or from the command line if you include - * usbdrv.c instead of linking against it. Including the C module of the driver - * directly in your code saves a couple of bytes in flash memory. - */ - -#ifndef __ASSEMBLER__ -#ifndef uchar -#define uchar unsigned char -#endif -#ifndef schar -#define schar signed char -#endif -/* shortcuts for well defined 8 bit integer types */ - -struct usbRequest; /* forward declaration */ - -USB_PUBLIC void usbInit(void); -/* This function must be called before interrupts are enabled and the main - * loop is entered. - */ -USB_PUBLIC void usbPoll(void); -/* This function must be called at regular intervals from the main loop. - * Maximum delay between calls is somewhat less than 50ms (USB timeout for - * accepting a Setup message). Otherwise the device will not be recognized. - * Please note that debug outputs through the UART take ~ 0.5ms per byte - * at 19200 bps. - */ -extern uchar *usbMsgPtr; -/* This variable may be used to pass transmit data to the driver from the - * implementation of usbFunctionWrite(). It is also used internally by the - * driver for standard control requests. - */ -USB_PUBLIC uchar usbFunctionSetup(uchar data[8]); -/* This function is called when the driver receives a SETUP transaction from - * the host which is not answered by the driver itself (in practice: class and - * vendor requests). All control transfers start with a SETUP transaction where - * the host communicates the parameters of the following (optional) data - * transfer. The SETUP data is available in the 'data' parameter which can - * (and should) be casted to 'usbRequest_t *' for a more user-friendly access - * to parameters. - * - * If the SETUP indicates a control-in transfer, you should provide the - * requested data to the driver. There are two ways to transfer this data: - * (1) Set the global pointer 'usbMsgPtr' to the base of the static RAM data - * block and return the length of the data in 'usbFunctionSetup()'. The driver - * will handle the rest. Or (2) return 0xff in 'usbFunctionSetup()'. The driver - * will then call 'usbFunctionRead()' when data is needed. See the - * documentation for usbFunctionRead() for details. - * - * If the SETUP indicates a control-out transfer, the only way to receive the - * data from the host is through the 'usbFunctionWrite()' call. If you - * implement this function, you must return 0xff in 'usbFunctionSetup()' to - * indicate that 'usbFunctionWrite()' should be used. See the documentation of - * this function for more information. If you just want to ignore the data sent - * by the host, return 0 in 'usbFunctionSetup()'. - * - * Note that calls to the functions usbFunctionRead() and usbFunctionWrite() - * are only done if enabled by the configuration in usbconfig.h. - */ -USB_PUBLIC uchar usbFunctionDescriptor(struct usbRequest *rq); -/* You need to implement this function ONLY if you provide USB descriptors at - * runtime (which is an expert feature). It is very similar to - * usbFunctionSetup() above, but it is called only to request USB descriptor - * data. See the documentation of usbFunctionSetup() above for more info. - */ -#if USB_CFG_HAVE_INTRIN_ENDPOINT -USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len); -/* This function sets the message which will be sent during the next interrupt - * IN transfer. The message is copied to an internal buffer and must not exceed - * a length of 8 bytes. The message may be 0 bytes long just to indicate the - * interrupt status to the host. - * If you need to transfer more bytes, use a control read after the interrupt. - */ -extern volatile uchar usbTxLen1; -#define usbInterruptIsReady() (usbTxLen1 & 0x10) -/* This macro indicates whether the last interrupt message has already been - * sent. If you set a new interrupt message before the old was sent, the - * message already buffered will be lost. - */ -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 -USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len); -extern volatile uchar usbTxLen3; -#define usbInterruptIsReady3() (usbTxLen3 & 0x10) -/* Same as above for endpoint 3 */ -#endif -#endif /* USB_CFG_HAVE_INTRIN_ENDPOINT */ -#if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* simplified interface for backward compatibility */ -#define usbHidReportDescriptor usbDescriptorHidReport -/* should be declared as: PROGMEM char usbHidReportDescriptor[]; */ -/* If you implement an HID device, you need to provide a report descriptor. - * The HID report descriptor syntax is a bit complex. If you understand how - * report descriptors are constructed, we recommend that you use the HID - * Descriptor Tool from usb.org, see http://www.usb.org/developers/hidpage/. - * Otherwise you should probably start with a working example. - */ -#endif /* USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH */ -#if USB_CFG_IMPLEMENT_FN_WRITE -USB_PUBLIC uchar usbFunctionWrite(uchar *data, uchar len); -/* This function is called by the driver to provide a control transfer's - * payload data (control-out). It is called in chunks of up to 8 bytes. The - * total count provided in the current control transfer can be obtained from - * the 'length' property in the setup data. If an error occurred during - * processing, return 0xff (== -1). The driver will answer the entire transfer - * with a STALL token in this case. If you have received the entire payload - * successfully, return 1. If you expect more data, return 0. If you don't - * know whether the host will send more data (you should know, the total is - * provided in the usbFunctionSetup() call!), return 1. - * NOTE: If you return 0xff for STALL, 'usbFunctionWrite()' may still be called - * for the remaining data. You must continue to return 0xff for STALL in these - * calls. - * In order to get usbFunctionWrite() called, define USB_CFG_IMPLEMENT_FN_WRITE - * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. - */ -#endif /* USB_CFG_IMPLEMENT_FN_WRITE */ -#if USB_CFG_IMPLEMENT_FN_READ -USB_PUBLIC uchar usbFunctionRead(uchar *data, uchar len); -/* This function is called by the driver to ask the application for a control - * transfer's payload data (control-in). It is called in chunks of up to 8 - * bytes each. You should copy the data to the location given by 'data' and - * return the actual number of bytes copied. If you return less than requested, - * the control-in transfer is terminated. If you return 0xff, the driver aborts - * the transfer with a STALL token. - * In order to get usbFunctionRead() called, define USB_CFG_IMPLEMENT_FN_READ - * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. - */ -#endif /* USB_CFG_IMPLEMENT_FN_READ */ -#if USB_CFG_IMPLEMENT_FN_WRITEOUT -USB_PUBLIC void usbFunctionWriteOut(uchar *data, uchar len); -/* This function is called by the driver when data on interrupt-out or bulk- - * out endpoint 1 is received. You must define USB_CFG_IMPLEMENT_FN_WRITEOUT - * to 1 in usbconfig.h to get this function called. - */ -#endif /* USB_CFG_IMPLEMENT_FN_WRITEOUT */ -#ifdef USB_CFG_PULLUP_IOPORTNAME -#define usbDeviceConnect() ((USB_PULLUP_DDR |= (1<device, 1=device->host - * t ..... type: 0=standard, 1=class, 2=vendor, 3=reserved - * r ..... recipient: 0=device, 1=interface, 2=endpoint, 3=other - */ - -/* USB setup recipient values */ -#define USBRQ_RCPT_MASK 0x1f -#define USBRQ_RCPT_DEVICE 0 -#define USBRQ_RCPT_INTERFACE 1 -#define USBRQ_RCPT_ENDPOINT 2 - -/* USB request type values */ -#define USBRQ_TYPE_MASK 0x60 -#define USBRQ_TYPE_STANDARD (0<<5) -#define USBRQ_TYPE_CLASS (1<<5) -#define USBRQ_TYPE_VENDOR (2<<5) - -/* USB direction values: */ -#define USBRQ_DIR_MASK 0x80 -#define USBRQ_DIR_HOST_TO_DEVICE (0<<7) -#define USBRQ_DIR_DEVICE_TO_HOST (1<<7) - -/* USB Standard Requests */ -#define USBRQ_GET_STATUS 0 -#define USBRQ_CLEAR_FEATURE 1 -#define USBRQ_SET_FEATURE 3 -#define USBRQ_SET_ADDRESS 5 -#define USBRQ_GET_DESCRIPTOR 6 -#define USBRQ_SET_DESCRIPTOR 7 -#define USBRQ_GET_CONFIGURATION 8 -#define USBRQ_SET_CONFIGURATION 9 -#define USBRQ_GET_INTERFACE 10 -#define USBRQ_SET_INTERFACE 11 -#define USBRQ_SYNCH_FRAME 12 - -/* USB descriptor constants */ -#define USBDESCR_DEVICE 1 -#define USBDESCR_CONFIG 2 -#define USBDESCR_STRING 3 -#define USBDESCR_INTERFACE 4 -#define USBDESCR_ENDPOINT 5 -#define USBDESCR_HID 0x21 -#define USBDESCR_HID_REPORT 0x22 -#define USBDESCR_HID_PHYS 0x23 - -#define USBATTR_BUSPOWER 0x80 -#define USBATTR_SELFPOWER 0x40 -#define USBATTR_REMOTEWAKE 0x20 - -/* USB HID Requests */ -#define USBRQ_HID_GET_REPORT 0x01 -#define USBRQ_HID_GET_IDLE 0x02 -#define USBRQ_HID_GET_PROTOCOL 0x03 -#define USBRQ_HID_SET_REPORT 0x09 -#define USBRQ_HID_SET_IDLE 0x0a -#define USBRQ_HID_SET_PROTOCOL 0x0b - -/* ------------------------------------------------------------------------- */ - -#endif /* __usbdrv_h_included__ */ diff --git a/tools/gnusb/firmware/usbdrv/usbdrvasm.S b/tools/gnusb/firmware/usbdrv/usbdrvasm.S deleted file mode 100644 index 1b7e26d..0000000 --- a/tools/gnusb/firmware/usbdrv/usbdrvasm.S +++ /dev/null @@ -1,221 +0,0 @@ -/* Name: usbdrvasm.S - * Project: AVR USB driver - * Author: Christian Starkjohann - * Creation Date: 2007-06-13 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt) - * Revision: $Id$ - */ - -/* -General Description: -This module is the assembler part of the USB driver. This file contains -general code (preprocessor acrobatics and CRC computation) and then includes -the file appropriate for the given clock rate. -*/ - -#include "iarcompat.h" -#ifndef __IAR_SYSTEMS_ASM__ - /* configs for io.h */ -# define __SFR_OFFSET 0 -# define _VECTOR(N) __vector_ ## N /* io.h does not define this for asm */ -# include /* for CPU I/O register definitions and vectors */ -#endif /* __IAR_SYSTEMS_ASM__ */ -#include "usbdrv.h" /* for common defs */ - -/* register names */ -#define x1 r16 -#define x2 r17 -#define shift r18 -#define cnt r19 -#define x3 r20 -#define x4 r21 -#define bitcnt r22 -#define phase x4 -#define leap x4 - -/* Some assembler dependent definitions and declarations: */ - -#ifdef __IAR_SYSTEMS_ASM__ - -# define nop2 rjmp $+2 /* jump to next instruction */ -# define XL r26 -# define XH r27 -# define YL r28 -# define YH r29 -# define ZL r30 -# define ZH r31 -# define lo8(x) LOW(x) -# define hi8(x) (((x)>>8) & 0xff) /* not HIGH to allow XLINK to make a proper range check */ - - extern usbRxBuf, usbDeviceAddr, usbNewDeviceAddr, usbInputBufOffset - extern usbCurrentTok, usbRxLen, usbRxToken, usbTxLen - extern usbTxBuf, usbMsgLen, usbTxLen1, usbTxBuf1, usbTxLen3, usbTxBuf3 -# if USB_COUNT_SOF - extern usbSofCount -# endif - public usbCrc16 - public usbCrc16Append - - COMMON INTVEC -# ifndef USB_INTR_VECTOR - ORG INT0_vect -# else /* USB_INTR_VECTOR */ - ORG USB_INTR_VECTOR -# undef USB_INTR_VECTOR -# endif /* USB_INTR_VECTOR */ -# define USB_INTR_VECTOR usbInterruptHandler - rjmp USB_INTR_VECTOR - RSEG CODE - -#else /* __IAR_SYSTEMS_ASM__ */ - -# define nop2 rjmp .+0 /* jump to next instruction */ - -# ifndef USB_INTR_VECTOR /* default to hardware interrupt INT0 */ -# define USB_INTR_VECTOR SIG_INTERRUPT0 -# endif - .text - .global USB_INTR_VECTOR - .type USB_INTR_VECTOR, @function - .global usbCrc16 - .global usbCrc16Append -#endif /* __IAR_SYSTEMS_ASM__ */ - - -#if USB_INTR_PENDING < 0x40 /* This is an I/O address, use in and out */ -# define USB_LOAD_PENDING(reg) in reg, USB_INTR_PENDING -# define USB_STORE_PENDING(reg) out USB_INTR_PENDING, reg -#else /* It's a memory address, use lds and sts */ -# define USB_LOAD_PENDING(reg) lds reg, USB_INTR_PENDING -# define USB_STORE_PENDING(reg) sts USB_INTR_PENDING, reg -#endif - - -;---------------------------------------------------------------------------- -; Utility functions -;---------------------------------------------------------------------------- - -#ifdef __IAR_SYSTEMS_ASM__ -/* Register assignments for usbCrc16 on IAR cc */ -/* Calling conventions on IAR: - * First parameter passed in r16/r17, second in r18/r19 and so on. - * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer) - * Result is passed in r16/r17 - * In case of the "tiny" memory model, pointers are only 8 bit with no - * padding. We therefore pass argument 1 as "16 bit unsigned". - */ -RTMODEL "__rt_version", "3" -/* The line above will generate an error if cc calling conventions change. - * The value "3" above is valid for IAR 4.10B/W32 - */ -# define argLen r18 /* argument 2 */ -# define argPtrL r16 /* argument 1 */ -# define argPtrH r17 /* argument 1 */ - -# define resCrcL r16 /* result */ -# define resCrcH r17 /* result */ - -# define ptrL ZL -# define ptrH ZH -# define ptr Z -# define byte r22 -# define bitCnt r19 -# define polyL r20 -# define polyH r21 -# define scratch r23 - -#else /* __IAR_SYSTEMS_ASM__ */ -/* Register assignments for usbCrc16 on gcc */ -/* Calling conventions on gcc: - * First parameter passed in r24/r25, second in r22/23 and so on. - * Callee must preserve r1-r17, r28/r29 - * Result is passed in r24/r25 - */ -# define argLen r22 /* argument 2 */ -# define argPtrL r24 /* argument 1 */ -# define argPtrH r25 /* argument 1 */ - -# define resCrcL r24 /* result */ -# define resCrcH r25 /* result */ - -# define ptrL XL -# define ptrH XH -# define ptr x -# define byte r18 -# define bitCnt r19 -# define polyL r20 -# define polyH r21 -# define scratch r23 - -#endif - -; extern unsigned usbCrc16(unsigned char *data, unsigned char len); -; data: r24/25 -; len: r22 -; temp variables: -; r18: data byte -; r19: bit counter -; r20/21: polynomial -; r23: scratch -; r24/25: crc-sum -; r26/27=X: ptr -usbCrc16: - mov ptrL, argPtrL - mov ptrH, argPtrH - ldi resCrcL, 0xff - ldi resCrcH, 0xff - ldi polyL, lo8(0xa001) - ldi polyH, hi8(0xa001) -crcByteLoop: - subi argLen, 1 - brcs crcReady - ld byte, ptr+ - ldi bitCnt, 8 -crcBitLoop: - mov scratch, byte - eor scratch, resCrcL - lsr resCrcH - ror resCrcL - lsr byte - sbrs scratch, 0 - rjmp crcNoXor - eor resCrcL, polyL - eor resCrcH, polyH -crcNoXor: - dec bitCnt - brne crcBitLoop - rjmp crcByteLoop -crcReady: - com resCrcL - com resCrcH - ret - -; extern unsigned usbCrc16Append(unsigned char *data, unsigned char len); -usbCrc16Append: - rcall usbCrc16 - st ptr+, resCrcL - st ptr+, resCrcH - ret - - -;---------------------------------------------------------------------------- -; Now include the clock rate specific code -;---------------------------------------------------------------------------- - -#ifndef USB_CFG_CLOCK_KHZ -# define USB_CFG_CLOCK_KHZ 12000 -#endif - -#if USB_CFG_CLOCK_KHZ == 12000 -# include "usbdrvasm12.S" -#elif USB_CFG_CLOCK_KHZ == 15000 -# include "usbdrvasm15.S" -#elif USB_CFG_CLOCK_KHZ == 16000 -# include "usbdrvasm16.S" -#elif USB_CFG_CLOCK_KHZ == 16500 -# include "usbdrvasm165.S" -#else -# error "USB_CFG_CLOCK_KHZ is not one of the supported rates!" -#endif diff --git a/tools/gnusb/firmware/usbdrv/usbdrvasm.asm b/tools/gnusb/firmware/usbdrv/usbdrvasm.asm deleted file mode 100644 index 4a5486f..0000000 --- a/tools/gnusb/firmware/usbdrv/usbdrvasm.asm +++ /dev/null @@ -1,21 +0,0 @@ -/* Name: usbdrvasm.asm - * Project: AVR USB driver - * Author: Christian Starkjohann - * Creation Date: 2006-03-01 - * Tabsize: 4 - * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt) - * This Revision: $Id$ - */ - -/* -General Description: -The IAR compiler/assembler system prefers assembler files with file extension -".asm". We simply provide this file as an alias for usbdrvasm.S. - -Thanks to Oleg Semyonov for his help with the IAR tools port! -*/ - -#include "usbdrvasm.S" - -end diff --git a/tools/gnusb/firmware/usbdrv/usbdrvasm12.S b/tools/gnusb/firmware/usbdrv/usbdrvasm12.S deleted file mode 100644 index b54d4d0..0000000 --- a/tools/gnusb/firmware/usbdrv/usbdrvasm12.S +++ /dev/null @@ -1,561 +0,0 @@ -/* Name: usbdrvasm12.S - * Project: AVR USB driver - * Author: Christian Starkjohann - * Creation Date: 2004-12-29 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrvasm12.S 396 2007-09-19 16:39:54Z cs $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 12 MHz version of the asssembler part of the USB driver. It -requires a 12 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! - - -Timing constraints according to spec (in bit times): -timing subject min max CPUcycles ---------------------------------------------------------------------------- -EOP of OUT/SETUP to sync pattern of DATA0 (both rx) 2 16 16-128 -EOP of IN to sync pattern of DATA0 (rx, then tx) 2 7.5 16-60 -DATAx (rx) to ACK/NAK/STALL (tx) 2 7.5 16-60 -*/ - -;Software-receiver engine. Strict timing! Don't change unless you can preserve timing! -;interrupt response time: 4 cycles + insn running = 7 max if interrupts always enabled -;max allowable interrupt latency: 34 cycles -> max 25 cycles interrupt disable -;max stack usage: [ret(2), YL, SREG, YH, shift, x1, x2, x3, cnt, x4] = 11 bytes -;Numbers in brackets are maximum cycles since SOF. -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt - push YL ;2 [35] push only what is necessary to sync with edge ASAP - in YL, SREG ;1 [37] - push YL ;2 [39] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;first part has no timeout because it waits for IDLE or SE1 (== disconnected) -waitForJ: - sbis USBIN, USBMINUS ;1 [40] wait for D- == 1 - rjmp waitForJ ;2 -waitForK: -;The following code results in a sampling window of 1/4 bit which meets the spec. - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ - rjmp sofError -foundK: -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push YH ;2 [2] - lds YL, usbInputBufOffset;2 [4] - clr YH ;1 [5] - subi YL, lo8(-(usbRxBuf));1 [6] - sbci YH, hi8(-(usbRxBuf));1 [7] - - sbis USBIN, USBMINUS ;1 [8] we want two bits K [sample 1 cycle too early] - rjmp haveTwoBitsK ;2 [10] - pop YH ;2 [11] undo the push from before - rjmp waitForK ;2 [13] this was not the end of sync, retry -haveTwoBitsK: -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- - push shift ;2 [16] - push x1 ;2 [12] - push x2 ;2 [14] - - in x1, USBIN ;1 [17] <-- sample bit 0 - ldi shift, 0xff ;1 [18] - bst x1, USBMINUS ;1 [19] - bld shift, 0 ;1 [20] - push x3 ;2 [22] - push cnt ;2 [24] - - in x2, USBIN ;1 [25] <-- sample bit 1 - ser x3 ;1 [26] [inserted init instruction] - eor x1, x2 ;1 [27] - bst x1, USBMINUS ;1 [28] - bld shift, 1 ;1 [29] - ldi cnt, USB_BUFSIZE;1 [30] [inserted init instruction] - rjmp rxbit2 ;2 [32] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- - -unstuff0: ;1 (branch taken) - andi x3, ~0x01 ;1 [15] - mov x1, x2 ;1 [16] x2 contains last sampled (stuffed) bit - in x2, USBIN ;1 [17] <-- sample bit 1 again - ori shift, 0x01 ;1 [18] - rjmp didUnstuff0 ;2 [20] - -unstuff1: ;1 (branch taken) - mov x2, x1 ;1 [21] x1 contains last sampled (stuffed) bit - andi x3, ~0x02 ;1 [22] - ori shift, 0x02 ;1 [23] - nop ;1 [24] - in x1, USBIN ;1 [25] <-- sample bit 2 again - rjmp didUnstuff1 ;2 [27] - -unstuff2: ;1 (branch taken) - andi x3, ~0x04 ;1 [29] - ori shift, 0x04 ;1 [30] - mov x1, x2 ;1 [31] x2 contains last sampled (stuffed) bit - nop ;1 [32] - in x2, USBIN ;1 [33] <-- sample bit 3 - rjmp didUnstuff2 ;2 [35] - -unstuff3: ;1 (branch taken) - in x2, USBIN ;1 [34] <-- sample stuffed bit 3 [one cycle too late] - andi x3, ~0x08 ;1 [35] - ori shift, 0x08 ;1 [36] - rjmp didUnstuff3 ;2 [38] - -unstuff4: ;1 (branch taken) - andi x3, ~0x10 ;1 [40] - in x1, USBIN ;1 [41] <-- sample stuffed bit 4 - ori shift, 0x10 ;1 [42] - rjmp didUnstuff4 ;2 [44] - -unstuff5: ;1 (branch taken) - andi x3, ~0x20 ;1 [48] - in x2, USBIN ;1 [49] <-- sample stuffed bit 5 - ori shift, 0x20 ;1 [50] - rjmp didUnstuff5 ;2 [52] - -unstuff6: ;1 (branch taken) - andi x3, ~0x40 ;1 [56] - in x1, USBIN ;1 [57] <-- sample stuffed bit 6 - ori shift, 0x40 ;1 [58] - rjmp didUnstuff6 ;2 [60] - -; extra jobs done during bit interval: -; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs] -; bit 1: se0 check -; bit 2: overflow check -; bit 3: recovery from delay [bit 0 tasks took too long] -; bit 4: none -; bit 5: none -; bit 6: none -; bit 7: jump, eor -rxLoop: - eor x3, shift ;1 [0] reconstruct: x3 is 0 at bit locations we changed, 1 at others - in x1, USBIN ;1 [1] <-- sample bit 0 - st y+, x3 ;2 [3] store data - ser x3 ;1 [4] - nop ;1 [5] - eor x2, x1 ;1 [6] - bst x2, USBMINUS;1 [7] - bld shift, 0 ;1 [8] - in x2, USBIN ;1 [9] <-- sample bit 1 (or possibly bit 0 stuffed) - andi x2, USBMASK ;1 [10] - breq se0 ;1 [11] SE0 check for bit 1 - andi shift, 0xf9 ;1 [12] -didUnstuff0: - breq unstuff0 ;1 [13] - eor x1, x2 ;1 [14] - bst x1, USBMINUS;1 [15] - bld shift, 1 ;1 [16] -rxbit2: - in x1, USBIN ;1 [17] <-- sample bit 2 (or possibly bit 1 stuffed) - andi shift, 0xf3 ;1 [18] - breq unstuff1 ;1 [19] do remaining work for bit 1 -didUnstuff1: - subi cnt, 1 ;1 [20] - brcs overflow ;1 [21] loop control - eor x2, x1 ;1 [22] - bst x2, USBMINUS;1 [23] - bld shift, 2 ;1 [24] - in x2, USBIN ;1 [25] <-- sample bit 3 (or possibly bit 2 stuffed) - andi shift, 0xe7 ;1 [26] - breq unstuff2 ;1 [27] -didUnstuff2: - eor x1, x2 ;1 [28] - bst x1, USBMINUS;1 [29] - bld shift, 3 ;1 [30] -didUnstuff3: - andi shift, 0xcf ;1 [31] - breq unstuff3 ;1 [32] - in x1, USBIN ;1 [33] <-- sample bit 4 - eor x2, x1 ;1 [34] - bst x2, USBMINUS;1 [35] - bld shift, 4 ;1 [36] -didUnstuff4: - andi shift, 0x9f ;1 [37] - breq unstuff4 ;1 [38] - nop2 ;2 [40] - in x2, USBIN ;1 [41] <-- sample bit 5 - eor x1, x2 ;1 [42] - bst x1, USBMINUS;1 [43] - bld shift, 5 ;1 [44] -didUnstuff5: - andi shift, 0x3f ;1 [45] - breq unstuff5 ;1 [46] - nop2 ;2 [48] - in x1, USBIN ;1 [49] <-- sample bit 6 - eor x2, x1 ;1 [50] - bst x2, USBMINUS;1 [51] - bld shift, 6 ;1 [52] -didUnstuff6: - cpi shift, 0x02 ;1 [53] - brlo unstuff6 ;1 [54] - nop2 ;2 [56] - in x2, USBIN ;1 [57] <-- sample bit 7 - eor x1, x2 ;1 [58] - bst x1, USBMINUS;1 [59] - bld shift, 7 ;1 [60] -didUnstuff7: - cpi shift, 0x04 ;1 [61] - brsh rxLoop ;2 [63] loop control -unstuff7: - andi x3, ~0x80 ;1 [63] - ori shift, 0x80 ;1 [64] - in x2, USBIN ;1 [65] <-- sample stuffed bit 7 - nop ;1 [66] - rjmp didUnstuff7 ;2 [68] - - -;---------------------------------------------------------------------------- -; Processing of received packet (numbers in brackets are cycles after end of SE0) -;---------------------------------------------------------------------------- -;This is the only non-error exit point for the software receiver loop -;we don't check any CRCs here because there is no time left. -#define token x1 -se0: ; [0] - subi cnt, USB_BUFSIZE ;1 [1] - neg cnt ;1 [2] - cpi cnt, 3 ;1 [3] - ldi x2, 1< 10.0 cycles per bit, 80.0 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - -;---------------------------------------------------------------------------- -; order of registers pushed: -; YL, SREG [sofError] YH, shift, x1, x2, x3, bitcnt, cnt, x4 -;---------------------------------------------------------------------------- -USB_INTR_VECTOR: - push YL ;2 push only what is necessary to sync with edge ASAP - in YL, SREG ;1 - push YL ;2 -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -; -; sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -; sync up with J to K edge during sync pattern -- use fastest possible loops -; first part has no timeout because it waits for IDLE or SE1 (== disconnected) -;------------------------------------------------------------------------------- -waitForJ: ;- - sbis USBIN, USBMINUS ;1 <-- sample: wait for D- == 1 - rjmp waitForJ ;2 -;------------------------------------------------------------------------------- -; The following code results in a sampling window of < 1/4 bit -; which meets the spec. -;------------------------------------------------------------------------------- -waitForK: ;- - sbis USBIN, USBMINUS ;1 [00] <-- sample - rjmp foundK ;2 [01] - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ - rjmp sofError -;------------------------------------------------------------------------------ -; {3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for -; center sampling] -; we have 1 bit time for setup purposes, then sample again. -; Numbers in brackets are cycles from center of first sync (double K) -; bit after the instruction -;------------------------------------------------------------------------------ -foundK: ;- [02] - lds YL, usbInputBufOffset;2 [03+04] tx loop - push YH ;2 [05+06] - clr YH ;1 [07] - subi YL, lo8(-(usbRxBuf)) ;1 [08] [rx loop init] - sbci YH, hi8(-(usbRxBuf)) ;1 [09] [rx loop init] - push shift ;2 [10+11] - ser shift ;1 [12] - sbis USBIN, USBMINUS ;1 [-1] [13] <--sample:we want two bits K (sample 1 cycle too early) - rjmp haveTwoBitsK ;2 [00] [14] - pop shift ;2 [15+16] undo the push from before - pop YH ;2 [17+18] undo the push from before - rjmp waitForK ;2 [19+20] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 20 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: ;- [01] - push x1 ;2 [02+03] - push x2 ;2 [04+05] - push x3 ;2 [06+07] - push bitcnt ;2 [08+09] - in x1, USBIN ;1 [00] [10] <-- sample bit 0 - bst x1, USBMINUS ;1 [01] - bld shift, 0 ;1 [02] - push cnt ;2 [03+04] - ldi cnt, USB_BUFSIZE ;1 [05] - push x4 ;2 [06+07] tx loop - rjmp rxLoop ;2 [08] -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -unstuff0: ;- [07] (branch taken) - andi x3, ~0x01 ;1 [08] - mov x1, x2 ;1 [09] x2 contains last sampled (stuffed) bit - in x2, USBIN ;1 [00] [10] <-- sample bit 1 again - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 1 - ori shift, 0x01 ;1 [03] 0b00000001 - nop ;1 [04] - rjmp didUnstuff0 ;2 [05] -;----------------------------------------------------- -unstuff1: ;- [05] (branch taken) - mov x2, x1 ;1 [06] x1 contains last sampled (stuffed) bit - andi x3, ~0x02 ;1 [07] - ori shift, 0x02 ;1 [08] 0b00000010 - nop ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 2 again - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 2 - rjmp didUnstuff1 ;2 [03] -;----------------------------------------------------- -unstuff2: ;- [05] (branch taken) - andi x3, ~0x04 ;1 [06] - ori shift, 0x04 ;1 [07] 0b00000100 - mov x1, x2 ;1 [08] x2 contains last sampled (stuffed) bit - nop ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample bit 3 - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 3 - rjmp didUnstuff2 ;2 [03] -;----------------------------------------------------- -unstuff3: ;- [00] [10] (branch taken) - in x2, USBIN ;1 [01] [11] <-- sample stuffed bit 3 one cycle too late - andi x2, USBMASK ;1 [02] - breq se0Hop ;1 [03] SE0 check for stuffed bit 3 - andi x3, ~0x08 ;1 [04] - ori shift, 0x08 ;1 [05] 0b00001000 - rjmp didUnstuff3 ;2 [06] -;---------------------------------------------------------------------------- -; extra jobs done during bit interval: -; -; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs], -; overflow check, jump to the head of rxLoop -; bit 1: SE0 check -; bit 2: SE0 check, recovery from delay [bit 0 tasks took too long] -; bit 3: SE0 check, recovery from delay [bit 0 tasks took too long] -; bit 4: SE0 check, none -; bit 5: SE0 check, none -; bit 6: SE0 check, none -; bit 7: SE0 check, reconstruct: x3 is 0 at bit locations we changed, 1 at others -;---------------------------------------------------------------------------- -rxLoop: ;- [09] - in x2, USBIN ;1 [00] [10] <-- sample bit 1 (or possibly bit 0 stuffed) - andi x2, USBMASK ;1 [01] - brne SkipSe0Hop ;1 [02] -se0Hop: ;- [02] - rjmp se0 ;2 [03] SE0 check for bit 1 -SkipSe0Hop: ;- [03] - ser x3 ;1 [04] - andi shift, 0xf9 ;1 [05] 0b11111001 - breq unstuff0 ;1 [06] -didUnstuff0: ;- [06] - eor x1, x2 ;1 [07] - bst x1, USBMINUS ;1 [08] - bld shift, 1 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 2 (or possibly bit 1 stuffed) - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 2 - andi shift, 0xf3 ;1 [03] 0b11110011 - breq unstuff1 ;1 [04] do remaining work for bit 1 -didUnstuff1: ;- [04] - eor x2, x1 ;1 [05] - bst x2, USBMINUS ;1 [06] - bld shift, 2 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 3 (or possibly bit 2 stuffed) - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 3 - andi shift, 0xe7 ;1 [03] 0b11100111 - breq unstuff2 ;1 [04] -didUnstuff2: ;- [04] - eor x1, x2 ;1 [05] - bst x1, USBMINUS ;1 [06] - bld shift, 3 ;1 [07] -didUnstuff3: ;- [07] - andi shift, 0xcf ;1 [08] 0b11001111 - breq unstuff3 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 4 - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 4 - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 4 ;1 [05] -didUnstuff4: ;- [05] - andi shift, 0x9f ;1 [06] 0b10011111 - breq unstuff4 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 5 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 5 - eor x1, x2 ;1 [03] - bst x1, USBMINUS ;1 [04] - bld shift, 5 ;1 [05] -didUnstuff5: ;- [05] - andi shift, 0x3f ;1 [06] 0b00111111 - breq unstuff5 ;1 [07] - nop2 ;2 [08+09] - in x1, USBIN ;1 [00] [10] <-- sample bit 6 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 6 - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 6 ;1 [05] -didUnstuff6: ;- [05] - cpi shift, 0x02 ;1 [06] 0b00000010 - brlo unstuff6 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 7 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 7 - eor x1, x2 ;1 [03] - bst x1, USBMINUS ;1 [04] - bld shift, 7 ;1 [05] -didUnstuff7: ;- [05] - cpi shift, 0x04 ;1 [06] 0b00000100 - brlo unstuff7 ;1 [07] - eor x3, shift ;1 [08] reconstruct: x3 is 0 at bit locations we changed, 1 at others - nop ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 0 - st y+, x3 ;2 [01+02] store data - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 0 ;1 [05] - subi cnt, 1 ;1 [06] - brcs ignorePacket ;1 [07] - rjmp rxLoop ;2 [08] -;----------------------------------------------------- -unstuff4: ;- [08] - andi x3, ~0x10 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 4 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 4 - ori shift, 0x10 ;1 [03] - rjmp didUnstuff4 ;2 [04] -;----------------------------------------------------- -unstuff5: ;- [08] - ori shift, 0x20 ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 5 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 5 - andi x3, ~0x20 ;1 [03] - rjmp didUnstuff5 ;2 [04] -;----------------------------------------------------- -unstuff6: ;- [08] - andi x3, ~0x40 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 6 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 6 - ori shift, 0x40 ;1 [03] - rjmp didUnstuff6 ;2 [04] -;----------------------------------------------------- -unstuff7: ;- [08] - andi x3, ~0x80 ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 7 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 7 - ori shift, 0x80 ;1 [03] - rjmp didUnstuff7 ;2 [04] -;---------------------------------------------------------------------------- -; Processing of received packet (numbers in brackets are cycles after center of SE0) -;---------------------------------------------------------------------------- -;This is the only non-error exit point for the software receiver loop -;we don't check any CRCs here because there is no time left. -#define token x1 -se0: ;- [04] - subi cnt, USB_BUFSIZE ;1 [05] - neg cnt ;1 [06] - cpi cnt, 3 ;1 [07] - ldi x2, 1< 10.6666666 cycles per bit, 85.333333333 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt - push YL ;[-25] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-23] - push YL ;[-22] - push YH ;[-20] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;first part has no timeout because it waits for IDLE or SE1 (== disconnected) -waitForJ: - sbis USBIN, USBMINUS ;[-18] wait for D- == 1 - rjmp waitForJ -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-15] - rjmp foundK ;[-14] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ - rjmp sofError -foundK: ;[-12] -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push bitcnt ;[-12] -; [---] ;[-11] - lds YL, usbInputBufOffset;[-10] -; [---] ;[-9] - clr YH ;[-8] - subi YL, lo8(-(usbRxBuf));[-7] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-6] [rx loop init] - push shift ;[-5] -; [---] ;[-4] - ldi bitcnt, 0x55 ;[-3] [rx loop init] - sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) - rjmp haveTwoBitsK ;[-1] - pop shift ;[0] undo the push from before - pop bitcnt ;[2] undo the push from before - rjmp waitForK ;[4] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 21 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[1] - push x2 ;[3] - push x3 ;[5] - ldi shift, 0 ;[7] - ldi x3, 1<<4 ;[8] [rx loop init] first sample is inverse bit, compensate that - push x4 ;[9] == leap - - in x1, USBIN ;[11] <-- sample bit 0 - andi x1, USBMASK ;[12] - bst x1, USBMINUS ;[13] - bld shift, 7 ;[14] - push cnt ;[15] - ldi leap, 0 ;[17] [rx loop init] - ldi cnt, USB_BUFSIZE;[18] [rx loop init] - rjmp rxbit1 ;[19] arrives at [21] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- - -unstuff6: - andi x2, USBMASK ;[03] - ori x3, 1<<6 ;[04] will not be shifted any more - andi shift, ~0x80;[05] - mov x1, x2 ;[06] sampled bit 7 is actually re-sampled bit 6 - subi leap, 3 ;[07] since this is a short (10 cycle) bit, enforce leap bit - rjmp didUnstuff6 ;[08] - -unstuff7: - ori x3, 1<<7 ;[09] will not be shifted any more - in x2, USBIN ;[00] [10] re-sample bit 7 - andi x2, USBMASK ;[01] - andi shift, ~0x80;[02] - subi leap, 3 ;[03] since this is a short (10 cycle) bit, enforce leap bit - rjmp didUnstuff7 ;[04] - -unstuffEven: - ori x3, 1<<6 ;[09] will be shifted right 6 times for bit 0 - in x1, USBIN ;[00] [10] - andi shift, ~0x80;[01] - andi x1, USBMASK ;[02] - breq se0 ;[03] - subi leap, 3 ;[04] since this is a short (10 cycle) bit, enforce leap bit - nop ;[05] - rjmp didUnstuffE ;[06] - -unstuffOdd: - ori x3, 1<<5 ;[09] will be shifted right 4 times for bit 1 - in x2, USBIN ;[00] [10] - andi shift, ~0x80;[01] - andi x2, USBMASK ;[02] - breq se0 ;[03] - subi leap, 3 ;[04] since this is a short (10 cycle) bit, enforce leap bit - nop ;[05] - rjmp didUnstuffO ;[06] - -rxByteLoop: - andi x1, USBMASK ;[03] - eor x2, x1 ;[04] - subi leap, 1 ;[05] - brpl skipLeap ;[06] - subi leap, -3 ;1 one leap cycle every 3rd byte -> 85 + 1/3 cycles per byte - nop ;1 -skipLeap: - subi x2, 1 ;[08] - ror shift ;[09] -didUnstuff6: - cpi shift, 0xfc ;[10] - in x2, USBIN ;[00] [11] <-- sample bit 7 - brcc unstuff6 ;[01] - andi x2, USBMASK ;[02] - eor x1, x2 ;[03] - subi x1, 1 ;[04] - ror shift ;[05] -didUnstuff7: - cpi shift, 0xfc ;[06] - brcc unstuff7 ;[07] - eor x3, shift ;[08] reconstruct: x3 is 1 at bit locations we changed, 0 at others - st y+, x3 ;[09] store data -rxBitLoop: - in x1, USBIN ;[00] [11] <-- sample bit 0/2/4 - andi x1, USBMASK ;[01] - eor x2, x1 ;[02] - andi x3, 0x3f ;[03] topmost two bits reserved for 6 and 7 - subi x2, 1 ;[04] - ror shift ;[05] - cpi shift, 0xfc ;[06] - brcc unstuffEven ;[07] -didUnstuffE: - lsr x3 ;[08] - lsr x3 ;[09] -rxbit1: - in x2, USBIN ;[00] [10] <-- sample bit 1/3/5 - andi x2, USBMASK ;[01] - breq se0 ;[02] - eor x1, x2 ;[03] - subi x1, 1 ;[04] - ror shift ;[05] - cpi shift, 0xfc ;[06] - brcc unstuffOdd ;[07] -didUnstuffO: - subi bitcnt, 0xab;[08] == addi 0x55, 0x55 = 0x100/3 - brcs rxBitLoop ;[09] - - subi cnt, 1 ;[10] - in x1, USBIN ;[00] [11] <-- sample bit 6 - brcc rxByteLoop ;[01] - rjmp ignorePacket; overflow - -;---------------------------------------------------------------------------- -; Processing of received packet (numbers in brackets are cycles after center of SE0) -;---------------------------------------------------------------------------- -;This is the only non-error exit point for the software receiver loop -;we don't check any CRCs here because there is no time left. -#define token x1 -se0: - subi cnt, USB_BUFSIZE ;[5] - neg cnt ;[6] - cpi cnt, 3 ;[7] - ldi x2, 1< max 52 cycles interrupt disable -;max stack usage: [ret(2), r0, SREG, YL, YH, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 16.5 MHz -> 11 cycles per bit -; 16.3125 MHz < F_CPU < 16.6875 MHz (+/- 1.1%) -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - - -USB_INTR_VECTOR: -;order of registers pushed: r0, SREG [sofError], YL, YH, shift, x1, x2, x3, x4, cnt - push r0 ;[-23] push only what is necessary to sync with edge ASAP - in r0, SREG ;[-21] - push r0 ;[-20] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;first part has no timeout because it waits for IDLE or SE1 (== disconnected) -waitForJ: - sbis USBIN, USBMINUS ;[-18] wait for D- == 1 - rjmp waitForJ -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-15] - rjmp foundK ;[-14] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ - rjmp sofError -foundK: ;[-12] -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push YL ;[-12] -; [---] ;[-11] - push YH ;[-10] -; [---] ;[-9] - lds YL, usbInputBufOffset;[-8] -; [---] ;[-7] - clr YH ;[-6] - subi YL, lo8(-(usbRxBuf));[-5] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-4] [rx loop init] - mov r0, x2 ;[-3] [rx loop init] - sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) - rjmp haveTwoBitsK ;[-1] - pop YH ;[0] undo the pushes from before - pop YL ;[2] - rjmp waitForK ;[4] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 22 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: ;[1] - push shift ;[1] - push x1 ;[3] - push x2 ;[5] - push x3 ;[7] - ldi shift, 0xff ;[9] [rx loop init] - ori x3, 0xff ;[10] [rx loop init] == ser x3, clear zero flag - - in x1, USBIN ;[11] <-- sample bit 0 - bst x1, USBMINUS ;[12] - bld shift, 0 ;[13] - push x4 ;[14] == phase -; [---] ;[15] - push cnt ;[16] -; [---] ;[17] - ldi phase, 0 ;[18] [rx loop init] - ldi cnt, USB_BUFSIZE;[19] [rx loop init] - rjmp rxbit1 ;[20] -; [---] ;[21] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -/* -byte oriented operations done during loop: -bit 0: store data -bit 1: SE0 check -bit 2: overflow check -bit 3: catch up -bit 4: rjmp to achieve conditional jump range -bit 5: PLL -bit 6: catch up -bit 7: jump, fixup bitstuff -; 87 [+ 2] cycles ------------------------------------------------------------------- -*/ -continueWithBit5: - in x2, USBIN ;[055] <-- bit 5 - eor r0, x2 ;[056] - or phase, r0 ;[057] - sbrc phase, USBMINUS ;[058] - lpm ;[059] optional nop3; modifies r0 - in phase, USBIN ;[060] <-- phase - eor x1, x2 ;[061] - bst x1, USBMINUS ;[062] - bld shift, 5 ;[063] - andi shift, 0x3f ;[064] - in x1, USBIN ;[065] <-- bit 6 - breq unstuff5 ;[066] *** unstuff escape - eor phase, x1 ;[067] - eor x2, x1 ;[068] - bst x2, USBMINUS ;[069] - bld shift, 6 ;[070] -didUnstuff6: ;[ ] - in r0, USBIN ;[071] <-- phase - cpi shift, 0x02 ;[072] - brlo unstuff6 ;[073] *** unstuff escape -didUnstuff5: ;[ ] - nop2 ;[074] -; [---] ;[075] - in x2, USBIN ;[076] <-- bit 7 - eor x1, x2 ;[077] - bst x1, USBMINUS ;[078] - bld shift, 7 ;[079] -didUnstuff7: ;[ ] - eor r0, x2 ;[080] - or phase, r0 ;[081] - in r0, USBIN ;[082] <-- phase - cpi shift, 0x04 ;[083] - brsh rxLoop ;[084] -; [---] ;[085] -unstuff7: ;[ ] - andi x3, ~0x80 ;[085] - ori shift, 0x80 ;[086] - in x2, USBIN ;[087] <-- sample stuffed bit 7 - nop ;[088] - rjmp didUnstuff7 ;[089] -; [---] ;[090] - ;[080] - -unstuff5: ;[067] - eor phase, x1 ;[068] - andi x3, ~0x20 ;[069] - ori shift, 0x20 ;[070] - in r0, USBIN ;[071] <-- phase - mov x2, x1 ;[072] - nop ;[073] - nop2 ;[074] -; [---] ;[075] - in x1, USBIN ;[076] <-- bit 6 - eor r0, x1 ;[077] - or phase, r0 ;[078] - eor x2, x1 ;[079] - bst x2, USBMINUS ;[080] - bld shift, 6 ;[081] no need to check bitstuffing, we just had one - in r0, USBIN ;[082] <-- phase - rjmp didUnstuff5 ;[083] -; [---] ;[084] - ;[074] - -unstuff6: ;[074] - andi x3, ~0x40 ;[075] - in x1, USBIN ;[076] <-- bit 6 again - ori shift, 0x40 ;[077] - nop2 ;[078] -; [---] ;[079] - rjmp didUnstuff6 ;[080] -; [---] ;[081] - ;[071] - -unstuff0: ;[013] - eor r0, x2 ;[014] - or phase, r0 ;[015] - andi x2, USBMASK ;[016] check for SE0 - in r0, USBIN ;[017] <-- phase - breq didUnstuff0 ;[018] direct jump to se0 would be too long - andi x3, ~0x01 ;[019] - ori shift, 0x01 ;[020] - mov x1, x2 ;[021] mov existing sample - in x2, USBIN ;[022] <-- bit 1 again - rjmp didUnstuff0 ;[023] -; [---] ;[024] - ;[014] - -unstuff1: ;[024] - eor r0, x1 ;[025] - or phase, r0 ;[026] - andi x3, ~0x02 ;[027] - in r0, USBIN ;[028] <-- phase - ori shift, 0x02 ;[029] - mov x2, x1 ;[030] - rjmp didUnstuff1 ;[031] -; [---] ;[032] - ;[022] - -unstuff2: ;[035] - eor r0, x2 ;[036] - or phase, r0 ;[037] - andi x3, ~0x04 ;[038] - in r0, USBIN ;[039] <-- phase - ori shift, 0x04 ;[040] - mov x1, x2 ;[041] - rjmp didUnstuff2 ;[042] -; [---] ;[043] - ;[033] - -unstuff3: ;[043] - in x2, USBIN ;[044] <-- bit 3 again - eor r0, x2 ;[045] - or phase, r0 ;[046] - andi x3, ~0x08 ;[047] - ori shift, 0x08 ;[048] - nop ;[049] - in r0, USBIN ;[050] <-- phase - rjmp didUnstuff3 ;[051] -; [---] ;[052] - ;[042] - -unstuff4: ;[053] - andi x3, ~0x10 ;[054] - in x1, USBIN ;[055] <-- bit 4 again - ori shift, 0x10 ;[056] - rjmp didUnstuff4 ;[057] -; [---] ;[058] - ;[048] - -rxLoop: ;[085] - eor x3, shift ;[086] reconstruct: x3 is 0 at bit locations we changed, 1 at others - in x1, USBIN ;[000] <-- bit 0 - st y+, x3 ;[001] -; [---] ;[002] - eor r0, x1 ;[003] - or phase, r0 ;[004] - eor x2, x1 ;[005] - in r0, USBIN ;[006] <-- phase - ser x3 ;[007] - bst x2, USBMINUS ;[008] - bld shift, 0 ;[009] - andi shift, 0xf9 ;[010] -rxbit1: ;[ ] - in x2, USBIN ;[011] <-- bit 1 - breq unstuff0 ;[012] *** unstuff escape - andi x2, USBMASK ;[013] SE0 check for bit 1 -didUnstuff0: ;[ ] Z only set if we detected SE0 in bitstuff - breq se0 ;[014] - eor r0, x2 ;[015] - or phase, r0 ;[016] - in r0, USBIN ;[017] <-- phase - eor x1, x2 ;[018] - bst x1, USBMINUS ;[019] - bld shift, 1 ;[020] - andi shift, 0xf3 ;[021] -didUnstuff1: ;[ ] - in x1, USBIN ;[022] <-- bit 2 - breq unstuff1 ;[023] *** unstuff escape - eor r0, x1 ;[024] - or phase, r0 ;[025] - subi cnt, 1 ;[026] overflow check - brcs overflow ;[027] - in r0, USBIN ;[028] <-- phase - eor x2, x1 ;[029] - bst x2, USBMINUS ;[030] - bld shift, 2 ;[031] - andi shift, 0xe7 ;[032] -didUnstuff2: ;[ ] - in x2, USBIN ;[033] <-- bit 3 - breq unstuff2 ;[034] *** unstuff escape - eor r0, x2 ;[035] - or phase, r0 ;[036] - eor x1, x2 ;[037] - bst x1, USBMINUS ;[038] - in r0, USBIN ;[039] <-- phase - bld shift, 3 ;[040] - andi shift, 0xcf ;[041] -didUnstuff3: ;[ ] - breq unstuff3 ;[042] *** unstuff escape - nop ;[043] - in x1, USBIN ;[044] <-- bit 4 - eor x2, x1 ;[045] - bst x2, USBMINUS ;[046] - bld shift, 4 ;[047] -didUnstuff4: ;[ ] - eor r0, x1 ;[048] - or phase, r0 ;[049] - in r0, USBIN ;[050] <-- phase - andi shift, 0x9f ;[051] - breq unstuff4 ;[052] *** unstuff escape - rjmp continueWithBit5;[053] -; [---] ;[054] - -;---------------------------------------------------------------------------- -; Processing of received packet (numbers in brackets are cycles after center of SE0) -;---------------------------------------------------------------------------- -;This is the only non-error exit point for the software receiver loop -;we don't check any CRCs here because there is no time left. -#define token x1 -se0: - subi cnt, USB_BUFSIZE ;[5] - neg cnt ;[6] - cpi cnt, 3 ;[7] - ldi x2, 1<`E@*_yFn;*a?1Pl@&NRVGq67qwj4M|Kku-HxZ zLV|{hHAqyffZ>1RWp<;`QEv>XgMe=!_nR9n1A(FlykIz4! z@0WcT?lb3}J9FmDnKN_e-i>cvdgY)HA_zZy@Pkj75XNn8Kq!8C;3rrZ*^n(RWEl=u zKUY0))dN>OaMc4>J#f_nS3Pjm16Mt8)dN>OaMc4>J#f_n|1Wvq(idO<2KMs3zvvFW zPKa(XIIhKyf&bE$EXka@AQQjw$0*1KmGN)#Nc#lc@M9z4k|pkZ5A7iE=kn`I@`Ol( zMlT%Y-htyr~uX=(A23U}qw%gcD_gev|{I@11y{Fp+7Fh*%*P!Z!g zDWer;k-y&o`psu_ecMgfwr}OJ=cJ2$m4`jFbugP0gOkVc?-qD8R zxSo9GrlVGdbp^G#1f8JzqRd^6-!Cg80@@CgK}Wp|ilU6hdowI-B7N39Hl zVk-_mC?mJDq{2-oKb_cd7ALT8<)))nMzFd7|1Mdww4%cQ8~uJ+TQ1-<%8(ze3>pjm z53zH}lJx1bW=u_;o~h(UK`Vgz)WpxP$WXG~y3Pjfi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sx%3IC$AAUd`2C#B)qC`IXnN`jkNLqG;ZD zcP}YG<9G6HqgIK*+X!%=gh2DakUrLh7U?N8WttURZ#W zMGymvQ498R!!((Ynh{<*JqtX3Zeh4_A=ODBh)uvokk(EUhXIf5e}wwt@LMS4$-^$y+>sXK17 z+%)B8)@`|kZa$5>m2O7OEmVwe^!X#c2Xcxdku!Hdx)T#QOw&CaG5 zP1m<|GSSYV2irPI_6>!076s?bd~E~$a!Z=N-L8)N2bh!h(&*w?Ti*Y&Yh=Dn7o!dq zS(V3qxXZo7;GE!xf z!3{MxbE;UNSFVvTiLygaqh{iiW=Ap=o^(N zG38GMw7;_)(0Y)Wmt&mVp7+m5&uv@&oq+Vfl_3ON97D8S&tPnTx!THMoUbxfHB?4~ zvQ7Ud4OIh}-q>8z*r;`ujvCPD)WCMui;SaT7NF7w7pJFl1ruoT)nOK}z8 zwe1V%|K*pGD%HBmnrcxYcK9&d__?S~mOD~yGjbEC%s1@@(-}i0J}tt>=HRQ2S<%FaB~?Bk>05kz+_^#$B3YOjS(T>bj@^is|Tazm)Q6#NytUgaC( X$74?ApN5pH!IaYn>HHIRQS|=+rBs?6 diff --git a/tools/gnusb/maxmsp/Info.plist b/tools/gnusb/maxmsp/Info.plist deleted file mode 100644 index e6f1da4..0000000 --- a/tools/gnusb/maxmsp/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - gnusb - CFBundleIconFile - - CFBundleIdentifier - ch.anyma.gnusb - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - iLaX - CFBundleSignature - ???? - CFBundleVersion - 1.0 - CSResourcesFileMapped - - - diff --git a/tools/gnusb/maxmsp/Makefile b/tools/gnusb/maxmsp/Makefile deleted file mode 100644 index 0c38664..0000000 --- a/tools/gnusb/maxmsp/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -all: - /usr/bin/xcodebuild -project gnusb.xcodeproj -# cp -f -r build/Default/gnusb.mxo /Applications/MaxMSP\ 4.5/ diff --git a/tools/gnusb/maxmsp/gnusb.c b/tools/gnusb/maxmsp/gnusb.c deleted file mode 100644 index 3032019..0000000 --- a/tools/gnusb/maxmsp/gnusb.c +++ /dev/null @@ -1,509 +0,0 @@ -// ============================================================================== -// gnusb.c -// -// Max-Interface to the [ a n y m a | gnusb - Open Source USB Sensor Box ] -// -// Authors: Michael Egger -// Copyright: 2007 [ a n y m a ] -// Website: www.anyma.ch -// -// License: GNU GPL 2.0 www.gnu.org -// -// Version: 2007-11-12 -// ============================================================================== - - - -#include "ext.h" // you must include this - it contains the external object's link to available Max functions -#include "ext_common.h" - -#include "../common/gnusb_cmds.h" // codes used between gnusb client and host software, eg. between the max external and the gnusb firmware -#include // this is libusb, see http://libusb.sourceforge.net/ */ - -#include -#include -#include - -// ============================================================================== -// Constants -// ------------------------------------------------------------------------------ - -#define USBDEV_SHARED_VENDOR 0x16C0 /* VOTI */ -#define USBDEV_SHARED_PRODUCT 0x05DC /* Obdev's free shared PID */ -#define OUTLETS 10 -#define DEFAULT_CLOCK_INTERVAL 40 // default interval for polling the gnusb: 40ms - -// ============================================================================== -// Our External's Memory structure -// ------------------------------------------------------------------------------ - -typedef struct _gnusb // defines our object's internal variables for each instance in a patch -{ - t_object p_ob; // object header - ALL max external MUST begin with this... - usb_dev_handle *dev_handle; // handle to the gnusb usb device - void *m_clock; // handle to our clock - double m_interval; // clock interval for polling the gnusb - double m_interval_bak; // backup clock interval for polling the gnusb - int is_running; // is our clock ticking? - int do_10_bit; // output analog values with 8bit or 10bit resolution? - int debug_flag; - void *outlets[OUTLETS]; // handle to the objects outlets - int values[10]; // stored values from last poll -} t_gnusb; - -void *gnusb_class; // global pointer to the object class - so max can reference the object - - -// ============================================================================== -// Function Prototypes -// ------------------------------------------------------------------------------ - -void *gnusb_new(t_symbol *s); -void gnusb_assist(t_gnusb *x, void *b, long m, long a, char *s); -void gnusb_bang(t_gnusb *x); -void gnusb_close(t_gnusb *x); -void gnusb_debug(t_gnusb *x, long n); -void gnusb_int(t_gnusb *x,long n); -void gnusb_output(t_gnusb *x, t_symbol *s, long n); -void gnusb_input(t_gnusb *x, t_symbol *s); -void gnusb_precision(t_gnusb *x, t_symbol *s); -void gnusb_open(t_gnusb *x); -void gnusb_poll(t_gnusb *x, long n); -void gnusb_smooth(t_gnusb *x, long n); -void gnusb_start(t_gnusb *x); -void gnusb_stop(t_gnusb *x); - -// functions used to find the USB device -static int usbGetStringAscii(usb_dev_handle *dev, int index, int langid, char *buf, int buflen); -void find_device(t_gnusb *x); - - - -// ============================================================================== -// Implementation -// ------------------------------------------------------------------------------ - - - -//-------------------------------------------------------------------------- -// - Message: output -> output a byte on port B or C -//-------------------------------------------------------------------------- - -void gnusb_output(t_gnusb *x, t_symbol *s, long n) -{ - int cmd; - int nBytes; - unsigned char buffer[8]; - - cmd = 0; - if (s == gensym("b")) cmd = GNUSB_CMD_SET_PORTB; - else if (s == gensym("c")) cmd = GNUSB_CMD_SET_PORTC; - else { - post ("gnusb: unknown port\n"); - return; - } - - if (n < 0) n = 0; - if (n > 255) n = 255; - - if (!(x->dev_handle)) find_device(x); - else { - nBytes = usb_control_msg(x->dev_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, - cmd, n, 0, (char *)buffer, sizeof(buffer), 10); - } - - -} - -//-------------------------------------------------------------------------- -// - Message: input -> sets port to be an input -//-------------------------------------------------------------------------- - -void gnusb_input(t_gnusb *x, t_symbol *s) -{ - int cmd; - int nBytes; - unsigned char buffer[8]; - - cmd = 0; - if (s == gensym("b")) cmd = GNUSB_CMD_INPUT_PORTB; - else if (s == gensym("c")) cmd = GNUSB_CMD_INPUT_PORTC; - else { - post ("gnusb: unknown port\n"); - return; - } - - if (!(x->dev_handle)) find_device(x); - else { - nBytes = usb_control_msg(x->dev_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, - cmd, 0, 0, (char *)buffer, sizeof(buffer), 10); - } - - -} - -//-------------------------------------------------------------------------- -// - Message: precision -> 8 or 10 bit -//-------------------------------------------------------------------------- - -void gnusb_precision(t_gnusb *x, t_symbol *s) -{ - if (s == gensym("10bit")) x->do_10_bit = 1; - else x->do_10_bit = 0; -} - - -//-------------------------------------------------------------------------- -// - Message: debug -//-------------------------------------------------------------------------- - -void gnusb_debug(t_gnusb *x, long n) // x = the instance of the object; n = the int received in the left inlet -{ - if (n) x->debug_flag = 1; - else x->debug_flag = 0; -} -//-------------------------------------------------------------------------- -// - Message: bang -> poll the gnusb -//-------------------------------------------------------------------------- - -void gnusb_bang(t_gnusb *x) // poll the gnusb -{ - int nBytes,i,n; - int replymask,replyshift,replybyte; - int temp; - unsigned char buffer[12]; - - if (!(x->dev_handle)) find_device(x); - else { - // ask the gnusb to send us data - nBytes = usb_control_msg(x->dev_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, - GNUSB_CMD_POLL, 0, 0, (char *)buffer, sizeof(buffer), 10); - // let's see what has come back... - if(nBytes < sizeof(buffer)){ - if (x->debug_flag) { - if(nBytes < 0) - post( "USB error: %s\n", usb_strerror()); - post( "only %d bytes status received\n", nBytes); - } - } else { - for (i = 0; i < OUTLETS; i++) { - n = OUTLETS - i - 1; - temp = buffer[n]; - - - // add 2 stuffed bits from end of buffer if we're doing 10bit precision - if (n < 8) { - if (x->do_10_bit) { - - if (n < 4) replybyte = buffer[10]; - else replybyte = buffer[11]; - - replyshift = ((n % 4) * 2); // how much to shift the bits - replymask = (3 << replyshift); - - temp = temp * 4 + ((replybyte & replymask) >> replyshift); // add 2 LSB - - } - } - - if (x->values[i] != temp) { // output if value has changed - outlet_int(x->outlets[i], temp); - x->values[i] = temp; - } - } - } - } -} - - -//-------------------------------------------------------------------------- -// - Message: open -> open connection to gnusb -//-------------------------------------------------------------------------- - -void gnusb_open(t_gnusb *x) -{ - if (x->dev_handle) { - post("gnusb: There is already a connection to www.anyma.ch/gnusb",0); - } else find_device(x); -} - -//-------------------------------------------------------------------------- -// - Message: close -> close connection to gnusb -//-------------------------------------------------------------------------- - -void gnusb_close(t_gnusb *x) -{ - if (x->dev_handle) { - usb_close(x->dev_handle); - x->dev_handle = NULL; - post("gnusb: Closed connection to www.anyma.ch/gnusb",0); - } else - post("gnusb: There was no open connection to www.anyma.ch/gnusb",0); -} - -//-------------------------------------------------------------------------- -// - Message: poll -> set polling interval -//-------------------------------------------------------------------------- - -void gnusb_poll(t_gnusb *x, long n){ - if (n > 0) { - x->m_interval = n; - x->m_interval_bak = n; - gnusb_start(x); - } else { - gnusb_stop(x); - } -} - -//-------------------------------------------------------------------------- -// - Message: smooth -> set smoothing on analog inputs -//-------------------------------------------------------------------------- - -void gnusb_smooth(t_gnusb *x, long n) { - int nBytes; - unsigned char buffer[8]; - - if (n < 0) n = 0; - if (n > 15) n = 15; - - if (!(x->dev_handle)) find_device(x); - else { - nBytes = usb_control_msg(x->dev_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, - GNUSB_CMD_SET_SMOOTHING, n, 0, (char *)buffer, sizeof(buffer), 10); - } - -} - -//-------------------------------------------------------------------------- -// - Message: int -> zero stops / nonzero starts -//-------------------------------------------------------------------------- - -void gnusb_int(t_gnusb *x,long n) { - if (n) { - if (!x->is_running) gnusb_start(x); - } else { - if (x->is_running) gnusb_stop(x); - } -} - -//-------------------------------------------------------------------------- -// - Message: start -> start automatic polling -//-------------------------------------------------------------------------- - -void gnusb_start (t_gnusb *x) { - if (!x->is_running) { - clock_fdelay(x->m_clock,0.); - x->is_running = 1; - } -} - -//-------------------------------------------------------------------------- -// - Message: stop -> stop automatic polling -//-------------------------------------------------------------------------- - -void gnusb_stop (t_gnusb *x) { - if (x->is_running) { - x->is_running = 0; - clock_unset(x->m_clock); - gnusb_close(x); - } -} - - - -//-------------------------------------------------------------------------- -// - The clock is ticking, tic, tac... -//-------------------------------------------------------------------------- - -void gnusb_tick(t_gnusb *x) { - clock_fdelay(x->m_clock, x->m_interval); // schedule another tick - gnusb_bang(x); // poll the gnusb -} - - -//-------------------------------------------------------------------------- -// - Object creation and setup -//-------------------------------------------------------------------------- - -int main(void) -{ - setup((t_messlist **)&gnusb_class, (method)gnusb_new, 0L, (short)sizeof(t_gnusb), 0L, A_DEFSYM, 0); - // setup() loads our external into Max's memory so it can be used in a patch - // gnusb_new = object creation method defined below, A_DEFLONG = its (optional) arguement is a long (32-bit) int - - // Add message handlers - addbang((method)gnusb_bang); - addint((method)gnusb_int); - addmess((method)gnusb_debug,"debug", A_DEFLONG, 0); - addmess((method)gnusb_open, "open", 0); - addmess((method)gnusb_close, "close", 0); - addmess((method)gnusb_poll, "poll", A_DEFLONG,0); - addmess((method)gnusb_output, "output", A_SYM,A_DEFLONG,0); - addmess((method)gnusb_input, "input", A_SYM,0); - addmess((method)gnusb_precision, "precision", A_SYM,0); - addmess((method)gnusb_smooth, "smooth", A_DEFLONG,0); - addmess((method)gnusb_start, "start", 0); - addmess((method)gnusb_stop, "stop", 0); - addmess((method)gnusb_assist,"assist",A_CANT,0); - - post("gnusb version 1.0 - (c) 2007 [ a n y m a ]",0); // post any important info to the max window when our object is laoded - - return 1; -} - -//-------------------------------------------------------------------------- - -void *gnusb_new(t_symbol *s) // s = optional argument typed into object box (A_SYM) -- defaults to 0 if no args are typed -{ - t_gnusb *x; // local variable (pointer to a t_gnusb data structure) - - x = (t_gnusb *)newobject(gnusb_class); // create a new instance of this object - x->m_clock = clock_new(x,(method)gnusb_tick); // make new clock for polling and attach gnsub_tick function to it - - if (s == gensym("10bit")) x->do_10_bit = 1; - else x->do_10_bit = 0; - - x->m_interval = DEFAULT_CLOCK_INTERVAL; - x->m_interval_bak = DEFAULT_CLOCK_INTERVAL; - - x->debug_flag = 0; - x->dev_handle = NULL; - int i; - // create outlets and assign it to our outlet variable in the instance's data structure - for (i=0; i < OUTLETS; i++) { - x->outlets[i] = intout(x); - } - - return x; // return a reference to the object instance -} - -//-------------------------------------------------------------------------- -// - Assist messages -//-------------------------------------------------------------------------- - -void gnusb_assist(t_gnusb *x, void *b, long m, long a, char *s) -{ - if (m==ASSIST_INLET) { - switch (a) { - case 0: sprintf(s,"Messages to the gnusb out there"); break; - } - } else { - switch (a) { - case 0: sprintf(s,"A 0"); break; - case 1: sprintf(s,"A 1"); break; - case 2: sprintf(s,"A 2"); break; - case 3: sprintf(s,"A 3"); break; - case 4: sprintf(s,"A 4"); break; - case 5: sprintf(s,"A 5"); break; - case 6: sprintf(s,"A 6"); break; - case 7: sprintf(s,"A 7"); break; - case 8: sprintf(s,"PORT B"); break; - case 9: sprintf(s,"PORT C"); break; - } - } -} - - -//-------------------------------------------------------------------------- -// - Object destruction -//-------------------------------------------------------------------------- - -void gnusb_free(t_gnusb *x) -{ - if (x->dev_handle) usb_close(x->dev_handle); - freeobject((t_object *)x->m_clock); // free the clock -} - - - - - -//-------------------------------------------------------------------------- -// - USB Utility Functions -//-------------------------------------------------------------------------- - - -static int usbGetStringAscii(usb_dev_handle *dev, int index, int langid, char *buf, int buflen) -{ -char buffer[256]; -int rval, i; - - if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, langid, buffer, sizeof(buffer), 1000)) < 0) - return rval; - if(buffer[1] != USB_DT_STRING) - return 0; - if((unsigned char)buffer[0] < rval) - rval = (unsigned char)buffer[0]; - rval /= 2; - /* lossy conversion to ISO Latin1 */ - for(i=1;i buflen) /* destination buffer overflow */ - break; - buf[i-1] = buffer[2 * i]; - if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */ - buf[i-1] = '?'; - } - buf[i-1] = 0; - return i-1; -} - -//-------------------------------------------------------------------------- - - -void find_device(t_gnusb *x) -{ - usb_dev_handle *handle = NULL; - struct usb_bus *bus; - struct usb_device *dev; - - usb_find_busses(); - usb_find_devices(); - for(bus=usb_busses; bus; bus=bus->next){ - for(dev=bus->devices; dev; dev=dev->next){ - if(dev->descriptor.idVendor == USBDEV_SHARED_VENDOR && dev->descriptor.idProduct == USBDEV_SHARED_PRODUCT){ - char string[256]; - int len; - handle = usb_open(dev); /* we need to open the device in order to query strings */ - if(!handle){ - error ("Warning: cannot open USB device: %s", usb_strerror()); - continue; - } - /* now find out whether the device actually is gnusb */ - len = usbGetStringAscii(handle, dev->descriptor.iManufacturer, 0x0409, string, sizeof(string)); - if(len < 0){ - post("gnusb: warning: cannot query manufacturer for device: %s", usb_strerror()); - goto skipDevice; - } - - // post("gnusb: seen device from vendor ->%s<-", string); - if(strcmp(string, "www.anyma.ch") != 0) - goto skipDevice; - len = usbGetStringAscii(handle, dev->descriptor.iProduct, 0x0409, string, sizeof(string)); - if(len < 0){ - post("gnusb: warning: cannot query product for device: %s", usb_strerror()); - goto skipDevice; - } - // post("gnusb: seen product ->%s<-", string); - if(strcmp(string, "gnusb") == 0) - break; -skipDevice: - usb_close(handle); - handle = NULL; - } - } - if(handle) - break; - } - - if(!handle){ - post("gnusb: Could not find USB device www.anyma.ch/gnusb"); - x->dev_handle = NULL; - if (x->m_interval < 10000) x->m_interval *=2; // throttle polling down to max 20s if we can't find a gnusb - } else { - x->dev_handle = handle; - post("gnusb: Found USB device www.anyma.ch/gnusb"); - x->m_interval = x->m_interval_bak; // restore original polling interval - if (x->is_running) gnusb_tick(x); - else gnusb_bang(x); - } -} \ No newline at end of file diff --git a/tools/gnusb/maxmsp/gnusb.help b/tools/gnusb/maxmsp/gnusb.help deleted file mode 100644 index 094c3d3..0000000 --- a/tools/gnusb/maxmsp/gnusb.help +++ /dev/null @@ -1 +0,0 @@ -max v2; #N vpatcher 68 52 880 709; #P origin 0 -4; #P window setfont "Sans Serif" 9.; #P comment 380 473 165 196617 output [port] [value]; #P comment 576 440 165 196617 you send for PORTC.; #P comment 576 427 172 196617 The gnusb will just echo the value; #P comment 576 414 176 196617 as an output.; #P comment 576 401 151 196617 By default \, PORTC is configured; #P comment 25 457 203 196617 gnusb outputs only if the value has changed; #P comment 377 440 165 196617 will show high; #P comment 128 543 189 196617 Output values from 0 to 255 (default); #P comment 128 528 151 196617 Output values from 0 to 1023; #P message 27 540 72 196617 precision 8bit; #P comment 377 427 172 196617 turned on \, so unconnected pins; #P comment 377 414 176 196617 as an input with pull-up resistors; #P comment 377 401 151 196617 By default \, PORTB is configured; #P message 27 526 78 196617 precision 10bit; #P hidden message 340 134 164 196617 frgb 20 20 20 \, brgb 230 230 200; #P message 688 259 40 196617 input c; #B color 5; #P message 489 258 40 196617 input b; #B color 5; #P window setfont "Sans Serif" 12.; #P comment 31 106 133 196620 Controlling the clock; #P toggle 713 367 15 0; #P toggle 694 367 15 0; #P toggle 675 367 15 0; #P toggle 656 367 15 0; #P toggle 637 367 15 0; #P toggle 618 367 15 0; #P toggle 599 367 15 0; #P toggle 580 367 15 0; #P toggle 514 367 15 0; #P toggle 495 367 15 0; #P toggle 476 367 15 0; #P toggle 457 367 15 0; #P toggle 438 367 15 0; #P toggle 419 367 15 0; #P toggle 400 367 15 0; #P toggle 381 367 15 0; #P window setfont "Sans Serif" 9.; #N vpatcher 14 59 355 467; #P outlet 217 332 15 0; #P outlet 198 332 15 0; #P outlet 179 332 15 0; #P outlet 160 332 15 0; #P outlet 141 332 15 0; #P outlet 122 332 15 0; #P outlet 103 332 15 0; #P outlet 84 332 15 0; #P window setfont "Sans Serif" 9.; #P newex 84 294 146 196617 unpack 0 0 0 0 0 0 0 0; #P window linecount 1; #P newex 84 90 27 196617 t b i; #P window linecount 0; #P newex 84 265 37 196617 zl rev; #P newex 84 124 40 196617 uzi 8; #P newex 84 169 27 196617 i; #P newex 52 213 27 196617 / 2; #P newex 84 212 27 196617 % 2; #P newex 84 242 55 196617 zl group 8; #P inlet 84 41 15 0; #P fasten 4 0 3 0 89 195 57 195; #P connect 0 0 7 0; #P connect 7 0 5 0; #P connect 5 0 4 0; #P connect 4 0 2 0; #P connect 2 0 1 0; #P connect 1 0 6 0; #P connect 6 0 8 0; #P connect 8 0 9 0; #P fasten 7 1 4 1 106 114 133 114 133 157 106 157; #P fasten 3 0 4 1 57 237 37 237 37 157 106 157; #P connect 8 1 10 0; #P connect 8 2 11 0; #P connect 8 3 12 0; #P connect 8 4 13 0; #P connect 8 5 14 0; #P connect 8 6 15 0; #P connect 8 7 16 0; #P pop; #P newobj 580 343 148 196617 p; #N vpatcher 14 59 355 467; #P outlet 217 332 15 0; #P outlet 198 332 15 0; #P outlet 179 332 15 0; #P outlet 160 332 15 0; #P outlet 141 332 15 0; #P outlet 122 332 15 0; #P outlet 103 332 15 0; #P outlet 84 332 15 0; #P window setfont "Sans Serif" 9.; #P newex 84 294 146 196617 unpack 0 0 0 0 0 0 0 0; #P window linecount 1; #P newex 84 90 27 196617 t b i; #P window linecount 0; #P newex 84 265 37 196617 zl rev; #P newex 84 124 40 196617 uzi 8; #P newex 84 169 27 196617 i; #P newex 52 213 27 196617 / 2; #P newex 84 212 27 196617 % 2; #P newex 84 242 55 196617 zl group 8; #P inlet 84 41 15 0; #P fasten 4 0 3 0 89 195 57 195; #P connect 0 0 7 0; #P connect 7 0 5 0; #P connect 5 0 4 0; #P connect 4 0 2 0; #P connect 2 0 1 0; #P connect 1 0 6 0; #P connect 6 0 8 0; #P connect 8 0 9 0; #P fasten 3 0 4 1 57 237 37 237 37 157 106 157; #P fasten 7 1 4 1 106 114 133 114 133 157 106 157; #P connect 8 1 10 0; #P connect 8 2 11 0; #P connect 8 3 12 0; #P connect 8 4 13 0; #P connect 8 5 14 0; #P connect 8 6 15 0; #P connect 8 7 16 0; #P pop; #P newobj 381 342 148 196617 p; #P toggle 713 210 15 0; #P toggle 694 210 15 0; #P toggle 675 210 15 0; #P toggle 656 210 15 0; #P toggle 637 210 15 0; #P toggle 618 210 15 0; #P toggle 599 210 15 0; #P toggle 580 210 15 0; #N vpatcher 14 59 614 459; #P outlet 69 336 15 0; #P window setfont "Sans Serif" 9.; #P window linecount 1; #P newex 111 200 27 196617 t i b; #P window linecount 0; #P newex 69 305 27 196617 i; #P window linecount 1; #P newex 111 265 27 196617 * 2; #P newex 111 241 27 196617 +; #P newex 111 149 44 196617 t b l 0; #P window linecount 0; #P newex 111 180 25 196617 iter; #P newex 127 220 28 196617 i; #P window linecount 1; #P newex 545 67 27 196617 > 0; #P newex 483 67 27 196617 > 0; #P newex 421 67 27 196617 > 0; #P newex 359 67 27 196617 > 0; #P newex 297 67 27 196617 > 0; #P newex 235 67 27 196617 > 0; #P newex 173 67 27 196617 > 0; #P window linecount 0; #P newex 111 67 27 196617 > 0; #P newex 111 100 450 196617 pak 0 0 0 0 0 0 0 0; #P inlet 545 39 15 0; #P inlet 483 39 15 0; #P inlet 421 39 15 0; #P inlet 359 39 15 0; #P inlet 297 39 15 0; #P inlet 235 39 15 0; #P inlet 173 39 15 0; #P inlet 111 39 15 0; #P fasten 19 0 22 0 116 169 74 169; #P connect 22 0 24 0; #P fasten 20 0 22 1 116 260 91 260; #P connect 0 0 9 0; #P connect 9 0 8 0; #P connect 8 0 19 0; #P fasten 19 1 18 0 133 173 116 173; #P connect 18 0 23 0; #P connect 23 0 20 0; #P connect 20 0 21 0; #P connect 23 1 17 0; #P connect 17 0 20 1; #P connect 19 2 17 1; #P fasten 21 0 17 1 116 289 167 289 167 211 150 211; #P connect 1 0 10 0; #P connect 10 0 8 1; #P connect 2 0 11 0; #P connect 11 0 8 2; #P connect 3 0 12 0; #P connect 12 0 8 3; #P connect 4 0 13 0; #P connect 13 0 8 4; #P connect 5 0 14 0; #P connect 14 0 8 5; #P connect 6 0 15 0; #P connect 15 0 8 6; #P connect 7 0 16 0; #P connect 16 0 8 7; #P pop; #P newobj 580 236 148 196617 p; #P number 381 258 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P toggle 514 210 15 0; #P toggle 495 210 15 0; #P toggle 476 210 15 0; #P toggle 457 210 15 0; #P toggle 438 210 15 0; #P toggle 419 210 15 0; #P toggle 400 210 15 0; #P toggle 381 210 15 0; #N vpatcher 14 59 614 459; #P outlet 69 336 15 0; #P window setfont "Sans Serif" 9.; #P window linecount 1; #P newex 111 200 27 196617 t i b; #P window linecount 0; #P newex 69 305 27 196617 i; #P window linecount 1; #P newex 111 265 27 196617 * 2; #P newex 111 241 27 196617 +; #P newex 111 149 44 196617 t b l 0; #P window linecount 0; #P newex 111 180 25 196617 iter; #P newex 127 220 28 196617 i; #P window linecount 1; #P newex 545 67 27 196617 > 0; #P newex 483 67 27 196617 > 0; #P newex 421 67 27 196617 > 0; #P newex 359 67 27 196617 > 0; #P newex 297 67 27 196617 > 0; #P newex 235 67 27 196617 > 0; #P newex 173 67 27 196617 > 0; #P window linecount 0; #P newex 111 67 27 196617 > 0; #P newex 111 100 450 196617 pak 0 0 0 0 0 0 0 0; #P inlet 545 39 15 0; #P inlet 483 39 15 0; #P inlet 421 39 15 0; #P inlet 359 39 15 0; #P inlet 297 39 15 0; #P inlet 235 39 15 0; #P inlet 173 39 15 0; #P inlet 111 39 15 0; #P fasten 19 0 22 0 116 169 74 169; #P connect 22 0 24 0; #P fasten 20 0 22 1 116 260 91 260; #P connect 0 0 9 0; #P connect 9 0 8 0; #P connect 8 0 19 0; #P fasten 19 1 18 0 133 173 116 173; #P connect 18 0 23 0; #P connect 23 0 20 0; #P connect 20 0 21 0; #P connect 23 1 17 0; #P connect 17 0 20 1; #P fasten 21 0 17 1 116 289 167 289 167 211 150 211; #P connect 19 2 17 1; #P connect 1 0 10 0; #P connect 10 0 8 1; #P connect 2 0 11 0; #P connect 11 0 8 2; #P connect 3 0 12 0; #P connect 12 0 8 3; #P connect 4 0 13 0; #P connect 13 0 8 4; #P connect 5 0 14 0; #P connect 14 0 8 5; #P connect 6 0 15 0; #P connect 15 0 8 6; #P connect 7 0 16 0; #P connect 16 0 8 7; #P pop; #P newobj 381 236 144 196617 p; #P number 580 258 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P message 618 258 61 196617 output c \$1; #P message 419 258 61 196617 output b \$1; #P window setfont "Sans Serif" 12.; #P comment 376 571 227 196620 Ports B & C: Digital inputs/outputs; #P window setfont "Sans Serif" 9.; #P number 580 322 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P number 381 322 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P comment 127 496 169 196617 Smoothing of analog input values; #P number 27 495 35 9 0 15 3 3 0 0 0 221 221 221 222 222 222 0 0 0; #P message 65 495 57 196617 smooth \$1; #P comment 137 132 123 196617 Bang polls the gnusb once; #P comment 137 160 136 196617 Start/stop polling the gnusb; #P message 89 190 41 196617 poll 10; #P message 37 204 35 196617 poll 0; #P message 37 190 53 196617 poll 1000; #P toggle 37 157 15 0; #P comment 21 62 292 196617 See: http://www.anyma.ch/gnusb; #P window setfont "Sans Serif" 18.; #P comment 21 24 141 196626 gnusb; #B frgb 21 56 9; #P window setfont "Sans Serif" 9.; #P comment 21 50 292 196617 Interface to the open source usb sensor box; #P button 175 437 15 0; #P button 154 437 15 0; #P button 133 437 15 0; #P button 112 437 15 0; #P button 91 437 15 0; #P button 70 437 15 0; #P button 49 437 15 0; #P button 28 437 15 0; #P button 37 127 15 0; #P user uslider 175 341 19 77 255 1 0 0; #P user uslider 154 341 19 77 255 1 0 0; #P user uslider 133 341 19 77 255 1 0 0; #P user uslider 112 341 19 77 255 1 0 0; #P user uslider 91 341 19 77 255 1 0 0; #P user uslider 70 341 19 77 255 1 0 0; #P user uslider 49 341 19 77 255 1 0 0; #P user uslider 28 341 19 77 255 1 0 0; #P message 93 157 29 196617 stop; #P message 57 157 33 196617 start; #P newex 28 288 204 196617 gnusb; #P user panel 15 20 748 59; #X brgb 255 247 207; #X frgb 0 0 0; #X border 0; #X rounded 0; #X shadow 0; #X done; #P window linecount 2; #P comment 137 191 197 196617 Set polling interval in ms (default 40ms) \, poll 0 stops the clock; #P user panel 353 163 414 435; #X brgb 230 230 200; #X frgb 20 20 20; #X border 1; #X rounded 0; #X shadow 0; #X done; #P window setfont "Sans Serif" 12.; #P window linecount 1; #P comment 24 570 159 196620 Port A: 8 Analog inputs; #P user panel 15 328 333 270; #X brgb 230 230 200; #X frgb 20 20 20; #X border 1; #X rounded 0; #X shadow 0; #X done; #P user panel 16 101 332 137; #X brgb 230 230 200; #X frgb 20 20 20; #X border 1; #X rounded 0; #X shadow 0; #X done; #P hidden connect 84 0 1 0; #P hidden connect 84 0 0 0; #P fasten 83 0 6 0 693 280 33 280; #P fasten 82 0 6 0 494 280 33 280; #P hidden fasten 31 0 6 0 42 222 33 222; #P fasten 30 0 6 0 42 204 33 204; #P fasten 29 0 6 0 42 176 33 176; #P fasten 7 0 6 0 62 176 33 176; #P fasten 8 0 6 0 98 176 33 176; #P fasten 17 0 6 0 42 147 33 147; #P hidden fasten 32 0 6 0 94 228 33 228; #P fasten 41 0 6 0 424 280 33 280; #P fasten 42 0 6 0 623 280 33 280; #P hidden fasten 35 0 6 0 70 537 7 537 7 280 33 280; #P hidden connect 85 0 6 0; #P hidden fasten 89 0 6 0 32 633 9 633 9 282 33 282; #P connect 6 0 9 0; #P connect 9 0 18 0; #P connect 6 1 10 0; #P connect 10 0 19 0; #P fasten 36 0 35 0 32 511 63 511 63 493 70 493; #P connect 6 2 11 0; #P connect 11 0 20 0; #P connect 6 3 12 0; #P connect 12 0 21 0; #P connect 6 4 13 0; #P connect 13 0 22 0; #P connect 6 5 14 0; #P connect 14 0 23 0; #P connect 6 6 15 0; #P connect 15 0 24 0; #P connect 6 7 16 0; #P connect 16 0 25 0; #P hidden connect 84 0 3 0; #P connect 45 0 44 0; #P connect 44 0 53 0; #P fasten 6 8 38 0 201 313 386 313; #P connect 38 0 63 0; #P connect 63 0 65 0; #P connect 46 0 44 1; #P connect 63 1 66 0; #P connect 47 0 44 2; #P fasten 53 0 41 0 386 274 417 274 417 256 424 256; #P connect 63 2 67 0; #P connect 48 0 44 3; #P connect 63 3 68 0; #P connect 49 0 44 4; #P connect 63 4 69 0; #P connect 50 0 44 5; #P connect 63 5 70 0; #P connect 51 0 44 6; #P connect 63 6 71 0; #P connect 52 0 44 7; #P connect 63 7 72 0; #P connect 55 0 54 0; #P connect 54 0 43 0; #P fasten 6 9 39 0 222 311 585 311; #P connect 39 0 64 0; #P connect 64 0 73 0; #P connect 56 0 54 1; #P connect 64 1 74 0; #P connect 57 0 54 2; #P fasten 43 0 42 0 587 274 616 274 616 256 623 256; #P connect 64 2 75 0; #P connect 58 0 54 3; #P connect 64 3 76 0; #P connect 59 0 54 4; #P connect 64 4 77 0; #P connect 60 0 54 5; #P connect 64 5 78 0; #P connect 61 0 54 6; #P connect 64 6 79 0; #P connect 62 0 54 7; #P connect 64 7 80 0; #P pop; \ No newline at end of file diff --git a/tools/gnusb/maxmsp/gnusb.xcodeproj/anyma.mode1 b/tools/gnusb/maxmsp/gnusb.xcodeproj/anyma.mode1 deleted file mode 100644 index 69da817..0000000 --- a/tools/gnusb/maxmsp/gnusb.xcodeproj/anyma.mode1 +++ /dev/null @@ -1,1324 +0,0 @@ - - - - - ActivePerspectiveName - Project - AllowedModules - - - BundleLoadPath - - MaxInstances - n - Module - PBXSmartGroupTreeModule - Name - Groups and Files Outline View - - - BundleLoadPath - - MaxInstances - n - Module - PBXNavigatorGroup - Name - Editor - - - BundleLoadPath - - MaxInstances - n - Module - XCTaskListModule - Name - Task List - - - BundleLoadPath - - MaxInstances - n - Module - XCDetailModule - Name - File and Smart Group Detail Viewer - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXBuildResultsModule - Name - Detailed Build Results Viewer - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXProjectFindModule - Name - Project Batch Find Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXRunSessionModule - Name - Run Log - - - BundleLoadPath - - MaxInstances - n - Module - PBXBookmarksModule - Name - Bookmarks Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXClassBrowserModule - Name - Class Browser - - - BundleLoadPath - - MaxInstances - n - Module - PBXCVSModule - Name - Source Code Control Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXDebugBreakpointsModule - Name - Debug Breakpoints Tool - - - BundleLoadPath - - MaxInstances - n - Module - XCDockableInspector - Name - Inspector - - - BundleLoadPath - - MaxInstances - n - Module - PBXOpenQuicklyModule - Name - Open Quickly Tool - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXDebugSessionModule - Name - Debugger - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXDebugCLIModule - Name - Debug Console - - - Description - DefaultDescriptionKey - DockingSystemVisible - - Extension - mode1 - FavBarConfig - - PBXProjectModuleGUID - C75D36110C2A5BB900D4E379 - XCBarModuleItemNames - - XCBarModuleItems - - - FirstTimeWindowDisplayed - - Identifier - com.apple.perspectives.project.mode1 - MajorVersion - 31 - MinorVersion - 1 - Name - Default - Notifications - - OpenEditors - - PerspectiveWidths - - -1 - -1 - - Perspectives - - - ChosenToolbarItems - - active-target-popup - active-buildstyle-popup - action - NSToolbarFlexibleSpaceItem - buildOrClean - build-and-runOrDebug - com.apple.ide.PBXToolbarStopButton - get-info - toggle-editor - NSToolbarFlexibleSpaceItem - com.apple.pbx.toolbar.searchfield - - ControllerClassBaseName - - IconName - WindowOfProjectWithEditor - Identifier - perspective.project - IsVertical - - Layout - - - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C37FBAC04509CD000000102 - 1C37FAAC04509CD000000102 - 1C08E77C0454961000C914BD - 1C37FABC05509CD000000102 - 1C37FABC05539CD112110102 - E2644B35053B69B200211256 - 1C37FABC04509CD000100104 - 1CC0EA4004350EF90044410B - 1CC0EA4004350EF90041110B - - PBXProjectModuleGUID - 1CE0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - yes - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 186 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 089C166AFE841209C02AAC07 - 1C37FABC05509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {186, 338}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - - XCSharingToken - com.apple.Xcode.GFSharingToken - - GeometryConfiguration - - Frame - {{0, 0}, {203, 356}} - GroupTreeTableConfiguration - - MainColumn - 186 - - RubberWindowFrame - 295 498 690 397 0 0 1280 1002 - - Module - PBXSmartGroupTreeModule - Proportion - 203pt - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CE0B20306471E060097A5F4 - PBXProjectModuleLabel - MyNewFile14.java - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1CE0B20406471E060097A5F4 - PBXProjectModuleLabel - MyNewFile14.java - - SplitCount - 1 - - StatusBarVisibility - - - GeometryConfiguration - - Frame - {{0, 0}, {482, 0}} - RubberWindowFrame - 295 498 690 397 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 0pt - - - BecomeActive - - ContentConfiguration - - PBXProjectModuleGUID - 1CE0B20506471E060097A5F4 - PBXProjectModuleLabel - Detail - - GeometryConfiguration - - Frame - {{0, 5}, {482, 351}} - RubberWindowFrame - 295 498 690 397 0 0 1280 1002 - - Module - XCDetailModule - Proportion - 351pt - - - Proportion - 482pt - - - Name - Project - ServiceClasses - - XCModuleDock - PBXSmartGroupTreeModule - XCModuleDock - PBXNavigatorGroup - XCDetailModule - - TableOfContents - - C75D360F0C2A5BB900D4E379 - 1CE0B1FE06471DED0097A5F4 - C75D36100C2A5BB900D4E379 - 1CE0B20306471E060097A5F4 - 1CE0B20506471E060097A5F4 - - ToolbarConfiguration - xcode.toolbar.config.default - - - ControllerClassBaseName - - IconName - WindowOfProject - Identifier - perspective.morph - IsVertical - 0 - Layout - - - BecomeActive - 1 - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C37FBAC04509CD000000102 - 1C37FAAC04509CD000000102 - 1C08E77C0454961000C914BD - 1C37FABC05509CD000000102 - 1C37FABC05539CD112110102 - E2644B35053B69B200211256 - 1C37FABC04509CD000100104 - 1CC0EA4004350EF90044410B - 1CC0EA4004350EF90041110B - - PBXProjectModuleGUID - 11E0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - yes - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 186 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 29B97314FDCFA39411CA2CEA - 1C37FABC05509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {186, 337}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - 1 - XCSharingToken - com.apple.Xcode.GFSharingToken - - GeometryConfiguration - - Frame - {{0, 0}, {203, 355}} - GroupTreeTableConfiguration - - MainColumn - 186 - - RubberWindowFrame - 373 269 690 397 0 0 1440 878 - - Module - PBXSmartGroupTreeModule - Proportion - 100% - - - Name - Morph - PreferredWidth - 300 - ServiceClasses - - XCModuleDock - PBXSmartGroupTreeModule - - TableOfContents - - 11E0B1FE06471DED0097A5F4 - - ToolbarConfiguration - xcode.toolbar.config.default.short - - - PerspectivesBarVisible - - ShelfIsVisible - - SourceDescription - file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' - StatusbarIsVisible - - TimeStamp - 0.0 - ToolbarDisplayMode - 1 - ToolbarIsVisible - - ToolbarSizeMode - 1 - Type - Perspectives - UpdateMessage - The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? - WindowJustification - 5 - WindowOrderList - - /Users/anyma/_Workshop_Romainmotier/gnusb/gnusbCore2.5/maxmsp/gnusb.xcodeproj - - WindowString - 295 498 690 397 0 0 1280 1002 - WindowTools - - - Identifier - windowTool.build - Layout - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CD0528F0623707200166675 - PBXProjectModuleLabel - <No Editor> - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1CD052900623707200166675 - - SplitCount - 1 - - StatusBarVisibility - 1 - - GeometryConfiguration - - Frame - {{0, 0}, {500, 215}} - RubberWindowFrame - 192 257 500 500 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 218pt - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - XCMainBuildResultsModuleGUID - PBXProjectModuleLabel - Build - - GeometryConfiguration - - Frame - {{0, 222}, {500, 236}} - RubberWindowFrame - 192 257 500 500 0 0 1280 1002 - - Module - PBXBuildResultsModule - Proportion - 236pt - - - Proportion - 458pt - - - Name - Build Results - ServiceClasses - - PBXBuildResultsModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C78EAA5065D492600B07095 - 1C78EAA6065D492600B07095 - 1CD0528F0623707200166675 - XCMainBuildResultsModuleGUID - - ToolbarConfiguration - xcode.toolbar.config.build - WindowString - 192 257 500 500 0 0 1280 1002 - - - Identifier - windowTool.debugger - Layout - - - Dock - - - ContentConfiguration - - Debugger - - HorizontalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {317, 164}} - {{317, 0}, {377, 164}} - - - VerticalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {694, 164}} - {{0, 164}, {694, 216}} - - - - LauncherConfigVersion - 8 - PBXProjectModuleGUID - 1C162984064C10D400B95A72 - PBXProjectModuleLabel - Debug - GLUTExamples (Underwater) - - GeometryConfiguration - - DebugConsoleDrawerSize - {100, 120} - DebugConsoleVisible - None - DebugConsoleWindowFrame - {{200, 200}, {500, 300}} - DebugSTDIOWindowFrame - {{200, 200}, {500, 300}} - Frame - {{0, 0}, {694, 380}} - RubberWindowFrame - 321 238 694 422 0 0 1440 878 - - Module - PBXDebugSessionModule - Proportion - 100% - - - Proportion - 100% - - - Name - Debugger - ServiceClasses - - PBXDebugSessionModule - - StatusbarIsVisible - 1 - TableOfContents - - 1CD10A99069EF8BA00B06720 - 1C0AD2AB069F1E9B00FABCE6 - 1C162984064C10D400B95A72 - 1C0AD2AC069F1E9B00FABCE6 - - ToolbarConfiguration - xcode.toolbar.config.debug - WindowString - 321 238 694 422 0 0 1440 878 - WindowToolGUID - 1CD10A99069EF8BA00B06720 - WindowToolIsVisible - 0 - - - Identifier - windowTool.find - Layout - - - Dock - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CDD528C0622207200134675 - PBXProjectModuleLabel - <No Editor> - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1CD0528D0623707200166675 - - SplitCount - 1 - - StatusBarVisibility - 1 - - GeometryConfiguration - - Frame - {{0, 0}, {781, 167}} - RubberWindowFrame - 62 385 781 470 0 0 1440 878 - - Module - PBXNavigatorGroup - Proportion - 781pt - - - Proportion - 50% - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - 1CD0528E0623707200166675 - PBXProjectModuleLabel - Project Find - - GeometryConfiguration - - Frame - {{8, 0}, {773, 254}} - RubberWindowFrame - 62 385 781 470 0 0 1440 878 - - Module - PBXProjectFindModule - Proportion - 50% - - - Proportion - 428pt - - - Name - Project Find - ServiceClasses - - PBXProjectFindModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C530D57069F1CE1000CFCEE - 1C530D58069F1CE1000CFCEE - 1C530D59069F1CE1000CFCEE - 1CDD528C0622207200134675 - 1C530D5A069F1CE1000CFCEE - 1CE0B1FE06471DED0097A5F4 - 1CD0528E0623707200166675 - - WindowString - 62 385 781 470 0 0 1440 878 - WindowToolGUID - 1C530D57069F1CE1000CFCEE - WindowToolIsVisible - 0 - - - Identifier - MENUSEPARATOR - - - Identifier - windowTool.debuggerConsole - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - 1C78EAAC065D492600B07095 - PBXProjectModuleLabel - Debugger Console - - GeometryConfiguration - - Frame - {{0, 0}, {440, 358}} - RubberWindowFrame - 650 41 440 400 0 0 1280 1002 - - Module - PBXDebugCLIModule - Proportion - 358pt - - - Proportion - 358pt - - - Name - Debugger Console - ServiceClasses - - PBXDebugCLIModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C78EAAD065D492600B07095 - 1C78EAAE065D492600B07095 - 1C78EAAC065D492600B07095 - - WindowString - 650 41 440 400 0 0 1280 1002 - - - Identifier - windowTool.run - Layout - - - Dock - - - ContentConfiguration - - LauncherConfigVersion - 3 - PBXProjectModuleGUID - 1CD0528B0623707200166675 - PBXProjectModuleLabel - Run - Runner - - HorizontalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {493, 167}} - {{0, 176}, {493, 267}} - - - VerticalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {405, 443}} - {{414, 0}, {514, 443}} - - - - - GeometryConfiguration - - Frame - {{0, 0}, {460, 159}} - RubberWindowFrame - 316 696 459 200 0 0 1280 1002 - - Module - PBXRunSessionModule - Proportion - 159pt - - - Proportion - 159pt - - - Name - Run Log - ServiceClasses - - PBXRunSessionModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C0AD2B3069F1EA900FABCE6 - 1C0AD2B4069F1EA900FABCE6 - 1CD0528B0623707200166675 - 1C0AD2B5069F1EA900FABCE6 - - ToolbarConfiguration - xcode.toolbar.config.run - WindowString - 316 696 459 200 0 0 1280 1002 - WindowToolGUID - 1C0AD2B3069F1EA900FABCE6 - WindowToolIsVisible - 0 - - - Identifier - windowTool.scm - Layout - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1C78EAB2065D492600B07095 - PBXProjectModuleLabel - <No Editor> - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1C78EAB3065D492600B07095 - - SplitCount - 1 - - StatusBarVisibility - 1 - - GeometryConfiguration - - Frame - {{0, 0}, {452, 0}} - RubberWindowFrame - 743 379 452 308 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 0pt - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - 1CD052920623707200166675 - PBXProjectModuleLabel - SCM - - GeometryConfiguration - - ConsoleFrame - {{0, 259}, {452, 0}} - Frame - {{0, 7}, {452, 259}} - RubberWindowFrame - 743 379 452 308 0 0 1280 1002 - TableConfiguration - - Status - 30 - FileName - 199 - Path - 197.09500122070312 - - TableFrame - {{0, 0}, {452, 250}} - - Module - PBXCVSModule - Proportion - 262pt - - - Proportion - 266pt - - - Name - SCM - ServiceClasses - - PBXCVSModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C78EAB4065D492600B07095 - 1C78EAB5065D492600B07095 - 1C78EAB2065D492600B07095 - 1CD052920623707200166675 - - ToolbarConfiguration - xcode.toolbar.config.scm - WindowString - 743 379 452 308 0 0 1280 1002 - - - Identifier - windowTool.breakpoints - IsVertical - 0 - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C77FABC04509CD000000102 - - PBXProjectModuleGUID - 1CE0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - no - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 168 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 1C77FABC04509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {168, 350}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - 0 - - GeometryConfiguration - - Frame - {{0, 0}, {185, 368}} - GroupTreeTableConfiguration - - MainColumn - 168 - - RubberWindowFrame - 315 424 744 409 0 0 1440 878 - - Module - PBXSmartGroupTreeModule - Proportion - 185pt - - - ContentConfiguration - - PBXProjectModuleGUID - 1CA1AED706398EBD00589147 - PBXProjectModuleLabel - Detail - - GeometryConfiguration - - Frame - {{190, 0}, {554, 368}} - RubberWindowFrame - 315 424 744 409 0 0 1440 878 - - Module - XCDetailModule - Proportion - 554pt - - - Proportion - 368pt - - - MajorVersion - 2 - MinorVersion - 0 - Name - Breakpoints - ServiceClasses - - PBXSmartGroupTreeModule - XCDetailModule - - StatusbarIsVisible - 1 - TableOfContents - - 1CDDB66807F98D9800BB5817 - 1CDDB66907F98D9800BB5817 - 1CE0B1FE06471DED0097A5F4 - 1CA1AED706398EBD00589147 - - ToolbarConfiguration - xcode.toolbar.config.breakpoints - WindowString - 315 424 744 409 0 0 1440 878 - WindowToolGUID - 1CDDB66807F98D9800BB5817 - WindowToolIsVisible - 1 - - - Identifier - windowTool.debugAnimator - Layout - - - Dock - - - Module - PBXNavigatorGroup - Proportion - 100% - - - Proportion - 100% - - - Name - Debug Visualizer - ServiceClasses - - PBXNavigatorGroup - - StatusbarIsVisible - 1 - ToolbarConfiguration - xcode.toolbar.config.debugAnimator - WindowString - 100 100 700 500 0 0 1280 1002 - - - Identifier - windowTool.bookmarks - Layout - - - Dock - - - Module - PBXBookmarksModule - Proportion - 100% - - - Proportion - 100% - - - Name - Bookmarks - ServiceClasses - - PBXBookmarksModule - - StatusbarIsVisible - 0 - WindowString - 538 42 401 187 0 0 1280 1002 - - - Identifier - windowTool.classBrowser - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - OptionsSetName - Hierarchy, all classes - PBXProjectModuleGUID - 1CA6456E063B45B4001379D8 - PBXProjectModuleLabel - Class Browser - NSObject - - GeometryConfiguration - - ClassesFrame - {{0, 0}, {374, 96}} - ClassesTreeTableConfiguration - - PBXClassNameColumnIdentifier - 208 - PBXClassBookColumnIdentifier - 22 - - Frame - {{0, 0}, {630, 331}} - MembersFrame - {{0, 105}, {374, 395}} - MembersTreeTableConfiguration - - PBXMemberTypeIconColumnIdentifier - 22 - PBXMemberNameColumnIdentifier - 216 - PBXMemberTypeColumnIdentifier - 97 - PBXMemberBookColumnIdentifier - 22 - - PBXModuleWindowStatusBarHidden2 - 1 - RubberWindowFrame - 385 179 630 352 0 0 1440 878 - - Module - PBXClassBrowserModule - Proportion - 332pt - - - Proportion - 332pt - - - Name - Class Browser - ServiceClasses - - PBXClassBrowserModule - - StatusbarIsVisible - 0 - TableOfContents - - 1C0AD2AF069F1E9B00FABCE6 - 1C0AD2B0069F1E9B00FABCE6 - 1CA6456E063B45B4001379D8 - - ToolbarConfiguration - xcode.toolbar.config.classbrowser - WindowString - 385 179 630 352 0 0 1440 878 - WindowToolGUID - 1C0AD2AF069F1E9B00FABCE6 - WindowToolIsVisible - 0 - - - - diff --git a/tools/gnusb/maxmsp/gnusb.xcodeproj/anyma.pbxuser b/tools/gnusb/maxmsp/gnusb.xcodeproj/anyma.pbxuser deleted file mode 100644 index dc34090..0000000 --- a/tools/gnusb/maxmsp/gnusb.xcodeproj/anyma.pbxuser +++ /dev/null @@ -1,60 +0,0 @@ -// !$*UTF8*$! -{ - 089C1669FE841209C02AAC07 /* Project object */ = { - activeBuildConfigurationName = Development; - activeTarget = 8D01CCC60486CAD60068D4B7 /* gnusb */; - codeSenseManager = C75D360C0C2A5BB100D4E379 /* Code sense */; - perUserDictionary = { - PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 243, - 20, - 48.1626, - 43, - 43, - 20, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFileDataSource_FiletypeID, - PBXFileDataSource_Filename_ColumnID, - PBXFileDataSource_Built_ColumnID, - PBXFileDataSource_ObjectSize_ColumnID, - PBXFileDataSource_Errors_ColumnID, - PBXFileDataSource_Warnings_ColumnID, - PBXFileDataSource_Target_ColumnID, - ); - }; - PBXPerProjectTemplateStateSaveDate = 204102547; - PBXWorkspaceStateSaveDate = 204102547; - }; - sourceControlManager = C75D360B0C2A5BB100D4E379 /* Source Control */; - userBuildSettings = { - }; - }; - 8C76827B0AC579580055918D /* gnusb.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {920, 3696}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRect = "{{0, 0}, {711, 429}}"; - sepNavWindowFrame = "{{15, 439}, {750, 558}}"; - }; - }; - 8D01CCC60486CAD60068D4B7 /* gnusb */ = { - activeExec = 0; - }; - C75D360B0C2A5BB100D4E379 /* Source Control */ = { - isa = PBXSourceControlManager; - fallbackIsa = XCSourceControlManager; - isSCMEnabled = 0; - scmConfiguration = { - }; - scmType = ""; - }; - C75D360C0C2A5BB100D4E379 /* Code sense */ = { - isa = PBXCodeSenseManager; - indexTemplatePath = ""; - }; -} diff --git a/tools/gnusb/maxmsp/gnusb.xcodeproj/me.mode1 b/tools/gnusb/maxmsp/gnusb.xcodeproj/me.mode1 deleted file mode 100644 index fab480a..0000000 --- a/tools/gnusb/maxmsp/gnusb.xcodeproj/me.mode1 +++ /dev/null @@ -1,1391 +0,0 @@ - - - - - ActivePerspectiveName - Project - AllowedModules - - - BundleLoadPath - - MaxInstances - n - Module - PBXSmartGroupTreeModule - Name - Groups and Files Outline View - - - BundleLoadPath - - MaxInstances - n - Module - PBXNavigatorGroup - Name - Editor - - - BundleLoadPath - - MaxInstances - n - Module - XCTaskListModule - Name - Task List - - - BundleLoadPath - - MaxInstances - n - Module - XCDetailModule - Name - File and Smart Group Detail Viewer - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXBuildResultsModule - Name - Detailed Build Results Viewer - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXProjectFindModule - Name - Project Batch Find Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXRunSessionModule - Name - Run Log - - - BundleLoadPath - - MaxInstances - n - Module - PBXBookmarksModule - Name - Bookmarks Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXClassBrowserModule - Name - Class Browser - - - BundleLoadPath - - MaxInstances - n - Module - PBXCVSModule - Name - Source Code Control Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXDebugBreakpointsModule - Name - Debug Breakpoints Tool - - - BundleLoadPath - - MaxInstances - n - Module - XCDockableInspector - Name - Inspector - - - BundleLoadPath - - MaxInstances - n - Module - PBXOpenQuicklyModule - Name - Open Quickly Tool - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXDebugSessionModule - Name - Debugger - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXDebugCLIModule - Name - Debug Console - - - Description - DefaultDescriptionKey - DockingSystemVisible - - Extension - mode1 - FavBarConfig - - PBXProjectModuleGUID - 8C7682650AC575F00055918D - XCBarModuleItemNames - - XCBarModuleItems - - - FirstTimeWindowDisplayed - - Identifier - com.apple.perspectives.project.mode1 - MajorVersion - 31 - MinorVersion - 1 - Name - Default - Notifications - - OpenEditors - - - Content - - PBXProjectModuleGUID - 8CD0DDA60CEA0F9100D609F6 - PBXProjectModuleLabel - gnusb.c - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 8CD0DDA70CEA0F9100D609F6 - PBXProjectModuleLabel - gnusb.c - _historyCapacity - 0 - bookmark - 8CD3D92D0CEB1A26009C300E - history - - 8CD0DDAA0CEA18A700D609F6 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {873, 718}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 351 73 873 759 0 0 1280 832 - - - - PerspectiveWidths - - -1 - -1 - - Perspectives - - - ChosenToolbarItems - - active-target-popup - action - NSToolbarFlexibleSpaceItem - buildOrClean - build-and-runOrDebug - com.apple.ide.PBXToolbarStopButton - get-info - toggle-editor - NSToolbarFlexibleSpaceItem - com.apple.pbx.toolbar.searchfield - - ControllerClassBaseName - - IconName - WindowOfProjectWithEditor - Identifier - perspective.project - IsVertical - - Layout - - - BecomeActive - - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C37FBAC04509CD000000102 - 1C37FAAC04509CD000000102 - 1C08E77C0454961000C914BD - 1C37FABC05509CD000000102 - 1C37FABC05539CD112110102 - E2644B35053B69B200211256 - 1C37FABC04509CD000100104 - 1CC0EA4004350EF90044410B - 1CC0EA4004350EF90041110B - - PBXProjectModuleGUID - 1CE0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - yes - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 186 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 089C166AFE841209C02AAC07 - 08FB77ADFE841716C02AAC07 - 089C167CFE841241C02AAC07 - 089C1671FE841209C02AAC07 - 19C28FB4FE9D528D11CA2CBB - 8D01CCD20486CAD60068D4B7 - 1C37FBAC04509CD000000102 - 1C37FABC05509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 14 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {186, 338}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - - XCSharingToken - com.apple.Xcode.GFSharingToken - - GeometryConfiguration - - Frame - {{0, 0}, {203, 356}} - GroupTreeTableConfiguration - - MainColumn - 186 - - RubberWindowFrame - 135 83 690 397 0 0 1280 832 - - Module - PBXSmartGroupTreeModule - Proportion - 203pt - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CE0B20306471E060097A5F4 - PBXProjectModuleLabel - MyNewFile14.java - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1CE0B20406471E060097A5F4 - PBXProjectModuleLabel - MyNewFile14.java - - SplitCount - 1 - - StatusBarVisibility - - - GeometryConfiguration - - Frame - {{0, 0}, {482, 0}} - RubberWindowFrame - 135 83 690 397 0 0 1280 832 - - Module - PBXNavigatorGroup - Proportion - 0pt - - - ContentConfiguration - - PBXProjectModuleGUID - 1CE0B20506471E060097A5F4 - PBXProjectModuleLabel - Detail - - GeometryConfiguration - - Frame - {{0, 5}, {482, 351}} - RubberWindowFrame - 135 83 690 397 0 0 1280 832 - - Module - XCDetailModule - Proportion - 351pt - - - Proportion - 482pt - - - Name - Project - ServiceClasses - - XCModuleDock - PBXSmartGroupTreeModule - XCModuleDock - PBXNavigatorGroup - XCDetailModule - - TableOfContents - - 8CD3D91F0CEB0856009C300E - 1CE0B1FE06471DED0097A5F4 - 8CD3D9200CEB0856009C300E - 1CE0B20306471E060097A5F4 - 1CE0B20506471E060097A5F4 - - ToolbarConfiguration - xcode.toolbar.config.default - - - ControllerClassBaseName - - IconName - WindowOfProject - Identifier - perspective.morph - IsVertical - 0 - Layout - - - BecomeActive - 1 - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C37FBAC04509CD000000102 - 1C37FAAC04509CD000000102 - 1C08E77C0454961000C914BD - 1C37FABC05509CD000000102 - 1C37FABC05539CD112110102 - E2644B35053B69B200211256 - 1C37FABC04509CD000100104 - 1CC0EA4004350EF90044410B - 1CC0EA4004350EF90041110B - - PBXProjectModuleGUID - 11E0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - yes - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 186 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 29B97314FDCFA39411CA2CEA - 1C37FABC05509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {186, 337}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - 1 - XCSharingToken - com.apple.Xcode.GFSharingToken - - GeometryConfiguration - - Frame - {{0, 0}, {203, 355}} - GroupTreeTableConfiguration - - MainColumn - 186 - - RubberWindowFrame - 373 269 690 397 0 0 1440 878 - - Module - PBXSmartGroupTreeModule - Proportion - 100% - - - Name - Morph - PreferredWidth - 300 - ServiceClasses - - XCModuleDock - PBXSmartGroupTreeModule - - TableOfContents - - 11E0B1FE06471DED0097A5F4 - - ToolbarConfiguration - xcode.toolbar.config.default.short - - - PerspectivesBarVisible - - ShelfIsVisible - - SourceDescription - file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' - StatusbarIsVisible - - TimeStamp - 0.0 - ToolbarDisplayMode - 1 - ToolbarIsVisible - - ToolbarSizeMode - 1 - Type - Perspectives - UpdateMessage - The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? - WindowJustification - 5 - WindowOrderList - - 8CD0DDA60CEA0F9100D609F6 - /Users/me/Documents/development/gnusb/sources/maxmsp/gnusb.xcodeproj - 8C76826D0AC576250055918D - - WindowString - 135 83 690 397 0 0 1280 832 - WindowTools - - - FirstTimeWindowDisplayed - - Identifier - windowTool.build - IsVertical - - Layout - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CD0528F0623707200166675 - PBXProjectModuleLabel - gnusb.c - StatusBarVisibility - - - GeometryConfiguration - - Frame - {{0, 0}, {717, 223}} - RubberWindowFrame - 318 252 717 505 0 0 1280 832 - - Module - PBXNavigatorGroup - Proportion - 223pt - - - BecomeActive - - ContentConfiguration - - PBXProjectModuleGUID - XCMainBuildResultsModuleGUID - PBXProjectModuleLabel - Build - XCBuildResultsTrigger_Collapse - 1021 - XCBuildResultsTrigger_Open - 1011 - - GeometryConfiguration - - Frame - {{0, 228}, {717, 236}} - RubberWindowFrame - 318 252 717 505 0 0 1280 832 - - Module - PBXBuildResultsModule - Proportion - 236pt - - - Proportion - 464pt - - - Name - Build Results - ServiceClasses - - PBXBuildResultsModule - - StatusbarIsVisible - - TableOfContents - - 8C76826D0AC576250055918D - 8CD3D9220CEB0856009C300E - 1CD0528F0623707200166675 - XCMainBuildResultsModuleGUID - - ToolbarConfiguration - xcode.toolbar.config.build - WindowString - 318 252 717 505 0 0 1280 832 - WindowToolGUID - 8C76826D0AC576250055918D - WindowToolIsVisible - - - - FirstTimeWindowDisplayed - - Identifier - windowTool.debugger - IsVertical - - Layout - - - Dock - - - ContentConfiguration - - Debugger - - HorizontalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {316, 183}} - {{316, 0}, {378, 183}} - - - VerticalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {694, 183}} - {{0, 183}, {694, 198}} - - - - LauncherConfigVersion - 8 - PBXProjectModuleGUID - 1C162984064C10D400B95A72 - PBXProjectModuleLabel - Debug - GLUTExamples (Underwater) - - GeometryConfiguration - - DebugConsoleDrawerSize - {100, 120} - DebugConsoleVisible - None - DebugConsoleWindowFrame - {{200, 200}, {500, 300}} - DebugSTDIOWindowFrame - {{200, 200}, {500, 300}} - Frame - {{0, 0}, {694, 381}} - RubberWindowFrame - 372 387 694 422 0 0 1280 832 - - Module - PBXDebugSessionModule - Proportion - 381pt - - - Proportion - 381pt - - - Name - Debugger - ServiceClasses - - PBXDebugSessionModule - - StatusbarIsVisible - - TableOfContents - - 1CD10A99069EF8BA00B06720 - 8C51C3870ADA64E900EC8537 - 1C162984064C10D400B95A72 - 8C51C3880ADA64E900EC8537 - 8C51C3890ADA64E900EC8537 - 8C51C38A0ADA64E900EC8537 - 8C51C38B0ADA64E900EC8537 - 8C51C38C0ADA64E900EC8537 - 8C51C38D0ADA64E900EC8537 - - ToolbarConfiguration - xcode.toolbar.config.debug - WindowString - 372 387 694 422 0 0 1280 832 - WindowToolGUID - 1CD10A99069EF8BA00B06720 - WindowToolIsVisible - - - - Identifier - windowTool.find - Layout - - - Dock - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CDD528C0622207200134675 - PBXProjectModuleLabel - <No Editor> - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1CD0528D0623707200166675 - - SplitCount - 1 - - StatusBarVisibility - 1 - - GeometryConfiguration - - Frame - {{0, 0}, {781, 167}} - RubberWindowFrame - 62 385 781 470 0 0 1440 878 - - Module - PBXNavigatorGroup - Proportion - 781pt - - - Proportion - 50% - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - 1CD0528E0623707200166675 - PBXProjectModuleLabel - Project Find - - GeometryConfiguration - - Frame - {{8, 0}, {773, 254}} - RubberWindowFrame - 62 385 781 470 0 0 1440 878 - - Module - PBXProjectFindModule - Proportion - 50% - - - Proportion - 428pt - - - Name - Project Find - ServiceClasses - - PBXProjectFindModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C530D57069F1CE1000CFCEE - 1C530D58069F1CE1000CFCEE - 1C530D59069F1CE1000CFCEE - 1CDD528C0622207200134675 - 1C530D5A069F1CE1000CFCEE - 1CE0B1FE06471DED0097A5F4 - 1CD0528E0623707200166675 - - WindowString - 62 385 781 470 0 0 1440 878 - WindowToolGUID - 1C530D57069F1CE1000CFCEE - WindowToolIsVisible - 0 - - - Identifier - MENUSEPARATOR - - - FirstTimeWindowDisplayed - - Identifier - windowTool.debuggerConsole - IsVertical - - Layout - - - Dock - - - BecomeActive - - ContentConfiguration - - PBXProjectModuleGUID - 1C78EAAC065D492600B07095 - PBXProjectModuleLabel - Debugger Console - - GeometryConfiguration - - Frame - {{0, 0}, {440, 358}} - RubberWindowFrame - 568 298 440 400 0 0 1280 832 - - Module - PBXDebugCLIModule - Proportion - 358pt - - - Proportion - 359pt - - - Name - Debugger Console - ServiceClasses - - PBXDebugCLIModule - - StatusbarIsVisible - - TableOfContents - - 8C88AFE70AC587BA00D0E069 - 8C88AFE80AC587BA00D0E069 - 1C78EAAC065D492600B07095 - - WindowString - 568 298 440 400 0 0 1280 832 - WindowToolGUID - 8C88AFE70AC587BA00D0E069 - WindowToolIsVisible - - - - Identifier - windowTool.run - Layout - - - Dock - - - ContentConfiguration - - LauncherConfigVersion - 3 - PBXProjectModuleGUID - 1CD0528B0623707200166675 - PBXProjectModuleLabel - Run - Runner - - HorizontalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {493, 167}} - {{0, 176}, {493, 267}} - - - VerticalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {405, 443}} - {{414, 0}, {514, 443}} - - - - - GeometryConfiguration - - Frame - {{0, 0}, {460, 159}} - RubberWindowFrame - 316 696 459 200 0 0 1280 1002 - - Module - PBXRunSessionModule - Proportion - 159pt - - - Proportion - 159pt - - - Name - Run Log - ServiceClasses - - PBXRunSessionModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C0AD2B3069F1EA900FABCE6 - 1C0AD2B4069F1EA900FABCE6 - 1CD0528B0623707200166675 - 1C0AD2B5069F1EA900FABCE6 - - ToolbarConfiguration - xcode.toolbar.config.run - WindowString - 316 696 459 200 0 0 1280 1002 - WindowToolGUID - 1C0AD2B3069F1EA900FABCE6 - WindowToolIsVisible - 0 - - - Identifier - windowTool.scm - Layout - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1C78EAB2065D492600B07095 - PBXProjectModuleLabel - <No Editor> - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1C78EAB3065D492600B07095 - - SplitCount - 1 - - StatusBarVisibility - 1 - - GeometryConfiguration - - Frame - {{0, 0}, {452, 0}} - RubberWindowFrame - 743 379 452 308 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 0pt - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - 1CD052920623707200166675 - PBXProjectModuleLabel - SCM - - GeometryConfiguration - - ConsoleFrame - {{0, 259}, {452, 0}} - Frame - {{0, 7}, {452, 259}} - RubberWindowFrame - 743 379 452 308 0 0 1280 1002 - TableConfiguration - - Status - 30 - FileName - 199 - Path - 197.09500122070312 - - TableFrame - {{0, 0}, {452, 250}} - - Module - PBXCVSModule - Proportion - 262pt - - - Proportion - 266pt - - - Name - SCM - ServiceClasses - - PBXCVSModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C78EAB4065D492600B07095 - 1C78EAB5065D492600B07095 - 1C78EAB2065D492600B07095 - 1CD052920623707200166675 - - ToolbarConfiguration - xcode.toolbar.config.scm - WindowString - 743 379 452 308 0 0 1280 1002 - - - Identifier - windowTool.breakpoints - IsVertical - 0 - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C77FABC04509CD000000102 - - PBXProjectModuleGUID - 1CE0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - no - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 168 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 1C77FABC04509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {168, 350}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - 0 - - GeometryConfiguration - - Frame - {{0, 0}, {185, 368}} - GroupTreeTableConfiguration - - MainColumn - 168 - - RubberWindowFrame - 315 424 744 409 0 0 1440 878 - - Module - PBXSmartGroupTreeModule - Proportion - 185pt - - - ContentConfiguration - - PBXProjectModuleGUID - 1CA1AED706398EBD00589147 - PBXProjectModuleLabel - Detail - - GeometryConfiguration - - Frame - {{190, 0}, {554, 368}} - RubberWindowFrame - 315 424 744 409 0 0 1440 878 - - Module - XCDetailModule - Proportion - 554pt - - - Proportion - 368pt - - - MajorVersion - 2 - MinorVersion - 0 - Name - Breakpoints - ServiceClasses - - PBXSmartGroupTreeModule - XCDetailModule - - StatusbarIsVisible - 1 - TableOfContents - - 1CDDB66807F98D9800BB5817 - 1CDDB66907F98D9800BB5817 - 1CE0B1FE06471DED0097A5F4 - 1CA1AED706398EBD00589147 - - ToolbarConfiguration - xcode.toolbar.config.breakpoints - WindowString - 315 424 744 409 0 0 1440 878 - WindowToolGUID - 1CDDB66807F98D9800BB5817 - WindowToolIsVisible - 1 - - - Identifier - windowTool.debugAnimator - Layout - - - Dock - - - Module - PBXNavigatorGroup - Proportion - 100% - - - Proportion - 100% - - - Name - Debug Visualizer - ServiceClasses - - PBXNavigatorGroup - - StatusbarIsVisible - 1 - ToolbarConfiguration - xcode.toolbar.config.debugAnimator - WindowString - 100 100 700 500 0 0 1280 1002 - - - Identifier - windowTool.bookmarks - Layout - - - Dock - - - Module - PBXBookmarksModule - Proportion - 100% - - - Proportion - 100% - - - Name - Bookmarks - ServiceClasses - - PBXBookmarksModule - - StatusbarIsVisible - 0 - WindowString - 538 42 401 187 0 0 1280 1002 - - - Identifier - windowTool.classBrowser - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - OptionsSetName - Hierarchy, all classes - PBXProjectModuleGUID - 1CA6456E063B45B4001379D8 - PBXProjectModuleLabel - Class Browser - NSObject - - GeometryConfiguration - - ClassesFrame - {{0, 0}, {374, 96}} - ClassesTreeTableConfiguration - - PBXClassNameColumnIdentifier - 208 - PBXClassBookColumnIdentifier - 22 - - Frame - {{0, 0}, {630, 331}} - MembersFrame - {{0, 105}, {374, 395}} - MembersTreeTableConfiguration - - PBXMemberTypeIconColumnIdentifier - 22 - PBXMemberNameColumnIdentifier - 216 - PBXMemberTypeColumnIdentifier - 97 - PBXMemberBookColumnIdentifier - 22 - - PBXModuleWindowStatusBarHidden2 - 1 - RubberWindowFrame - 385 179 630 352 0 0 1440 878 - - Module - PBXClassBrowserModule - Proportion - 332pt - - - Proportion - 332pt - - - Name - Class Browser - ServiceClasses - - PBXClassBrowserModule - - StatusbarIsVisible - 0 - TableOfContents - - 1C0AD2AF069F1E9B00FABCE6 - 1C0AD2B0069F1E9B00FABCE6 - 1CA6456E063B45B4001379D8 - - ToolbarConfiguration - xcode.toolbar.config.classbrowser - WindowString - 385 179 630 352 0 0 1440 878 - WindowToolGUID - 1C0AD2AF069F1E9B00FABCE6 - WindowToolIsVisible - 0 - - - - diff --git a/tools/gnusb/maxmsp/gnusb.xcodeproj/me.pbxuser b/tools/gnusb/maxmsp/gnusb.xcodeproj/me.pbxuser deleted file mode 100644 index 03825bc..0000000 --- a/tools/gnusb/maxmsp/gnusb.xcodeproj/me.pbxuser +++ /dev/null @@ -1,221 +0,0 @@ -// !$*UTF8*$! -{ - 089C1669FE841209C02AAC07 /* Project object */ = { - activeBuildConfigurationName = Deployment; - activeTarget = 8D01CCC60486CAD60068D4B7 /* gnusb */; - addToTargets = ( - 8D01CCC60486CAD60068D4B7 /* gnusb */, - ); - breakpoints = ( - ); - breakpointsGroup = 8C51C38E0ADA64E900EC8537 /* XCBreakpointsBucket */; - codeSenseManager = 8C7682670AC575F00055918D /* Code sense */; - perUserDictionary = { - PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 300, - 133.2085, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXErrorsWarningsDataSource_TypeID, - PBXErrorsWarningsDataSource_MessageID, - PBXErrorsWarningsDataSource_LocationID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; - PBXFileTableDataSourceColumnWidthsKey = ( - 22, - 300, - 130.5835, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXExecutablesDataSource_ActiveFlagID, - PBXExecutablesDataSource_NameID, - PBXExecutablesDataSource_CommentsID, - ); - }; - PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 243, - 20, - 48, - 43, - 43, - 20, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFileDataSource_FiletypeID, - PBXFileDataSource_Filename_ColumnID, - PBXFileDataSource_Built_ColumnID, - PBXFileDataSource_ObjectSize_ColumnID, - PBXFileDataSource_Errors_ColumnID, - PBXFileDataSource_Warnings_ColumnID, - PBXFileDataSource_Target_ColumnID, - ); - }; - PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 200, - 63, - 20, - 48, - 43, - 43, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFileDataSource_FiletypeID, - PBXFileDataSource_Filename_ColumnID, - PBXTargetDataSource_PrimaryAttribute, - PBXFileDataSource_Built_ColumnID, - PBXFileDataSource_ObjectSize_ColumnID, - PBXFileDataSource_Errors_ColumnID, - PBXFileDataSource_Warnings_ColumnID, - ); - }; - PBXPerProjectTemplateStateSaveDate = 216729659; - PBXWorkspaceStateSaveDate = 216729659; - }; - perUserProjectItems = { - 8CD0DDA30CEA0F8800D609F6 = 8CD0DDA30CEA0F8800D609F6 /* PBXTextBookmark */; - 8CD0DDAA0CEA18A700D609F6 = 8CD0DDAA0CEA18A700D609F6 /* PBXTextBookmark */; - 8CD3D9210CEB0856009C300E /* PBXTextBookmark */ = 8CD3D9210CEB0856009C300E /* PBXTextBookmark */; - 8CD3D9240CEB08B2009C300E /* PBXTextBookmark */ = 8CD3D9240CEB08B2009C300E /* PBXTextBookmark */; - 8CD3D9250CEB08D2009C300E /* PBXTextBookmark */ = 8CD3D9250CEB08D2009C300E /* PBXTextBookmark */; - 8CD3D9270CEB08EF009C300E /* PBXTextBookmark */ = 8CD3D9270CEB08EF009C300E /* PBXTextBookmark */; - 8CD3D9290CEB1865009C300E /* PBXTextBookmark */ = 8CD3D9290CEB1865009C300E /* PBXTextBookmark */; - 8CD3D92B0CEB1957009C300E /* PBXTextBookmark */ = 8CD3D92B0CEB1957009C300E /* PBXTextBookmark */; - 8CD3D92D0CEB1A26009C300E /* PBXTextBookmark */ = 8CD3D92D0CEB1A26009C300E /* PBXTextBookmark */; - }; - sourceControlManager = 8C7682660AC575F00055918D /* Source Control */; - userBuildSettings = { - }; - }; - 8C51C38E0ADA64E900EC8537 /* XCBreakpointsBucket */ = { - isa = XCBreakpointsBucket; - name = "Project Breakpoints"; - objects = ( - ); - }; - 8C7682660AC575F00055918D /* Source Control */ = { - isa = PBXSourceControlManager; - fallbackIsa = XCSourceControlManager; - isSCMEnabled = 0; - scmConfiguration = { - }; - scmType = ""; - }; - 8C7682670AC575F00055918D /* Code sense */ = { - isa = PBXCodeSenseManager; - indexTemplatePath = ""; - }; - 8C76827B0AC579580055918D /* gnusb.c */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {920, 7126}}"; - sepNavSelRange = "{16603, 0}"; - sepNavVisRect = "{{0, 0}, {828, 686}}"; - sepNavWindowFrame = "{{351, 17}, {873, 815}}"; - }; - }; - 8CD0DDA30CEA0F8800D609F6 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - comments = "error: 'n' undeclared (first use in this function)"; - fRef = 8C76827B0AC579580055918D /* gnusb.c */; - rLen = 1; - rLoc = 135; - rType = 1; - }; - 8CD0DDAA0CEA18A700D609F6 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8C76827B0AC579580055918D /* gnusb.c */; - name = "gnusb.c: 136"; - rLen = 0; - rLoc = 4546; - rType = 0; - vrLen = 1372; - vrLoc = 3908; - }; - 8CD3D9210CEB0856009C300E /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8C76827B0AC579580055918D /* gnusb.c */; - name = "gnusb.c: 137"; - rLen = 0; - rLoc = 4546; - rType = 0; - vrLen = 1337; - vrLoc = 3849; - }; - 8CD3D9240CEB08B2009C300E /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8C76827B0AC579580055918D /* gnusb.c */; - name = "gnusb.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 2024; - vrLoc = 0; - }; - 8CD3D9250CEB08D2009C300E /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8C76827B0AC579580055918D /* gnusb.c */; - name = "gnusb.c: find_device"; - rLen = 0; - rLoc = 16297; - rType = 0; - vrLen = 2024; - vrLoc = 0; - }; - 8CD3D9270CEB08EF009C300E /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8C76827B0AC579580055918D /* gnusb.c */; - name = "gnusb.c: find_device"; - rLen = 0; - rLoc = 16302; - rType = 0; - vrLen = 2024; - vrLoc = 0; - }; - 8CD3D9290CEB1865009C300E /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8C76827B0AC579580055918D /* gnusb.c */; - name = "gnusb.c: 508"; - rLen = 0; - rLoc = 16480; - rType = 0; - vrLen = 2038; - vrLoc = 0; - }; - 8CD3D92B0CEB1957009C300E /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8C76827B0AC579580055918D /* gnusb.c */; - name = "gnusb.c: find_device"; - rLen = 0; - rLoc = 16561; - rType = 0; - vrLen = 2038; - vrLoc = 0; - }; - 8CD3D92D0CEB1A26009C300E /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8C76827B0AC579580055918D /* gnusb.c */; - name = "gnusb.c: 509"; - rLen = 0; - rLoc = 16603; - rType = 0; - vrLen = 2038; - vrLoc = 0; - }; - 8D01CCC60486CAD60068D4B7 /* gnusb */ = { - activeExec = 0; - }; -} diff --git a/tools/gnusb/maxmsp/gnusb.xcodeproj/project.pbxproj b/tools/gnusb/maxmsp/gnusb.xcodeproj/project.pbxproj deleted file mode 100644 index 9603ba5..0000000 --- a/tools/gnusb/maxmsp/gnusb.xcodeproj/project.pbxproj +++ /dev/null @@ -1,339 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXBuildFile section */ - 0F5B62030919440900A62EB9 /* MaxAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F5B62020919440900A62EB9 /* MaxAPI.framework */; }; - 8C76827C0AC579580055918D /* gnusb.c in Sources */ = {isa = PBXBuildFile; fileRef = 8C76827B0AC579580055918D /* gnusb.c */; }; - 8CE44F350AC58F2600D71D18 /* libusb.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CE44F340AC58F2600D71D18 /* libusb.dylib */; }; - 8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; - 0F5B62020919440900A62EB9 /* MaxAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MaxAPI.framework; path = /Library/Frameworks/MaxAPI.framework; sourceTree = ""; }; - 8C76827B0AC579580055918D /* gnusb.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gnusb.c; sourceTree = ""; }; - 8CE44F340AC58F2600D71D18 /* libusb.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libusb.dylib; path = Contents/MacOS/libusb.dylib; sourceTree = ""; }; - 8D01CCD20486CAD60068D4B7 /* gnusb.mxo */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = gnusb.mxo; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D01CCCD0486CAD60068D4B7 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */, - 0F5B62030919440900A62EB9 /* MaxAPI.framework in Frameworks */, - 8CE44F350AC58F2600D71D18 /* libusb.dylib in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 089C166AFE841209C02AAC07 /* maximum */ = { - isa = PBXGroup; - children = ( - 08FB77ADFE841716C02AAC07 /* Source */, - 089C167CFE841241C02AAC07 /* Resources */, - 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */, - 19C28FB4FE9D528D11CA2CBB /* Products */, - ); - name = maximum; - sourceTree = ""; - }; - 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 8CE44F340AC58F2600D71D18 /* libusb.dylib */, - 0F5B62020919440900A62EB9 /* MaxAPI.framework */, - 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */, - ); - name = "External Frameworks and Libraries"; - sourceTree = ""; - }; - 089C167CFE841241C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - ); - name = Resources; - sourceTree = ""; - }; - 08FB77ADFE841716C02AAC07 /* Source */ = { - isa = PBXGroup; - children = ( - 8C76827B0AC579580055918D /* gnusb.c */, - ); - name = Source; - sourceTree = ""; - }; - 19C28FB4FE9D528D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D01CCD20486CAD60068D4B7 /* gnusb.mxo */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 8D01CCC70486CAD60068D4B7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 8D01CCC60486CAD60068D4B7 /* gnusb */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0FF6670A096B494E00E9E0B4 /* Build configuration list for PBXNativeTarget "gnusb" */; - buildPhases = ( - 8D01CCC70486CAD60068D4B7 /* Headers */, - 8D01CCC90486CAD60068D4B7 /* Resources */, - 8D01CCCB0486CAD60068D4B7 /* Sources */, - 8D01CCCD0486CAD60068D4B7 /* Frameworks */, - 8D01CCCF0486CAD60068D4B7 /* Rez */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = gnusb; - productInstallPath = "$(HOME)/Library/Bundles"; - productName = MaxExternal; - productReference = 8D01CCD20486CAD60068D4B7 /* gnusb.mxo */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 089C1669FE841209C02AAC07 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 0FF6670E096B494E00E9E0B4 /* Build configuration list for PBXProject "gnusb" */; - hasScannedForEncodings = 1; - mainGroup = 089C166AFE841209C02AAC07 /* maximum */; - projectDirPath = ""; - targets = ( - 8D01CCC60486CAD60068D4B7 /* gnusb */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D01CCC90486CAD60068D4B7 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - 8D01CCCF0486CAD60068D4B7 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D01CCCB0486CAD60068D4B7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8C76827C0AC579580055918D /* gnusb.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 0FF6670B096B494E00E9E0B4 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - DEBUGGING_SYMBOLS = YES; - DEPLOYMENT_LOCATION = NO; - DSTROOT = "$(PROJECT_DIR)"; - FRAMEWORK_SEARCH_PATHS = /Library/Frameworks; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_ENABLE_TRIGRAPHS = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "../../c74support/max-includes/macho-prefix.h"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - GENERATE_PKGINFO_FILE = YES; - HEADER_SEARCH_PATHS = "../../c74support/max-includes"; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "/../../../sysbuild/$(CONFIGURATION)/Cycling '74/externals"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_2)", - ); - LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)\""; - LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/Contents/MacOS\""; - LIBRARY_STYLE = Bundle; - OPTIMIZATION_CFLAGS = "-O0"; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = gnusb; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = mxo; - ZERO_LINK = NO; - }; - name = Development; - }; - 0FF6670C096B494E00E9E0B4 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - ppc, - i386, - ); - COPY_PHASE_STRIP = YES; - DEPLOYMENT_LOCATION = NO; - DSTROOT = "$(PROJECT_DIR)"; - FRAMEWORK_SEARCH_PATHS = /Library/Frameworks; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_ENABLE_TRIGRAPHS = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "../../c74support/max-includes/macho-prefix.h"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - GENERATE_PKGINFO_FILE = YES; - HEADER_SEARCH_PATHS = "../../c74support/max-includes"; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "/../../../sysbuild/$(CONFIGURATION)/Cycling '74/externals"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_2)", - ); - LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)\""; - LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/Contents/MacOS\""; - LIBRARY_STYLE = Bundle; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = gnusb; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = mxo; - ZERO_LINK = NO; - }; - name = Deployment; - }; - 0FF6670D096B494E00E9E0B4 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEPLOYMENT_LOCATION = NO; - DSTROOT = "$(PROJECT_DIR)"; - FRAMEWORK_SEARCH_PATHS = /Library/Frameworks; - GCC_ENABLE_TRIGRAPHS = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "../../c74support/max-includes/macho-prefix.h"; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - GENERATE_PKGINFO_FILE = YES; - HEADER_SEARCH_PATHS = "../../c74support/max-includes"; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "/../../../sysbuild/$(CONFIGURATION)/Cycling '74/externals"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", - "$(LIBRARY_SEARCH_PATHS_QUOTED_2)", - ); - LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)\""; - LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/Contents/MacOS\""; - LIBRARY_STYLE = Bundle; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = gnusb; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = mxo; - }; - name = Default; - }; - 0FF6670F096B494E00E9E0B4 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Development; - }; - 0FF66710096B494E00E9E0B4 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Deployment; - }; - 0FF66711096B494E00E9E0B4 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Default; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0FF6670A096B494E00E9E0B4 /* Build configuration list for PBXNativeTarget "gnusb" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0FF6670B096B494E00E9E0B4 /* Development */, - 0FF6670C096B494E00E9E0B4 /* Deployment */, - 0FF6670D096B494E00E9E0B4 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; - 0FF6670E096B494E00E9E0B4 /* Build configuration list for PBXProject "gnusb" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0FF6670F096B494E00E9E0B4 /* Development */, - 0FF66710096B494E00E9E0B4 /* Deployment */, - 0FF66711096B494E00E9E0B4 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; -/* End XCConfigurationList section */ - }; - rootObject = 089C1669FE841209C02AAC07 /* Project object */; -} diff --git a/tools/gnusb/puredata/gnusb.c b/tools/gnusb/puredata/gnusb.c deleted file mode 100644 index c4fcb5a..0000000 --- a/tools/gnusb/puredata/gnusb.c +++ /dev/null @@ -1,493 +0,0 @@ -// ============================================================================== -// gnusb.c -// -// pd-Interface to the [ a n y m a | gnusb - Open Source USB Sensor Box ] -// -// Authors: Michael Egger -// Copyright: 2007 [ a n y m a ] -// Website: www.anyma.ch -// -// License: GNU GPL 2.0 www.gnu.org -// -// Version: 2007-11-12 -// ============================================================================== - - - -#include "m_pd.h" - -#include "../common/gnusb_cmds.h" // codes used between gnusb client and host software, eg. between the max external and the gnusb firmware -#include // this is libusb, see http://libusb.sourceforge.net/ */ - -#include -#include -#include - -// ============================================================================== -// Constants -// ------------------------------------------------------------------------------ - -#define USBDEV_SHARED_VENDOR 0x16C0 /* VOTI */ -#define USBDEV_SHARED_PRODUCT 0x05DC /* Obdev's free shared PID */ -#define OUTLETS 10 -#define DEFAULT_CLOCK_INTERVAL 40 // default interval for polling the gnusb: 40ms - -// ============================================================================== -// Our External's Memory structure -// ------------------------------------------------------------------------------ - -typedef struct _gnusb // defines our object's internal variables for each instance in a patch -{ - t_object p_ob; // object header - ALL max external MUST begin with this... - usb_dev_handle *dev_handle; // handle to the gnusb usb device - void *m_clock; // handle to our clock - double m_interval; // clock interval for polling the gnusb - double m_interval_bak; // backup clock interval for polling the gnusb - int is_running; // is our clock ticking? - int do_10_bit; // output analog values with 8bit or 10bit resolution? - int debug_flag; - void *outlets[OUTLETS]; // handle to the objects outlets - int values[10]; // stored values from last poll -} t_gnusb; - -void *gnusb_class; // global pointer to the object class - so max can reference the object - - -// ============================================================================== -// Function Prototypes -// ------------------------------------------------------------------------------ - -void *gnusb_new(t_symbol *s); -void gnusb_assist(t_gnusb *x, void *b, long m, long a, char *s); -void gnusb_bang(t_gnusb *x); -void gnusb_close(t_gnusb *x); -void gnusb_debug(t_gnusb *x, long n); -void gnusb_int(t_gnusb *x,long n); -void gnusb_output(t_gnusb *x, t_symbol *s, long n); -void gnusb_input(t_gnusb *x, t_symbol *s); -void gnusb_precision(t_gnusb *x, t_symbol *s); -void gnusb_open(t_gnusb *x); -void gnusb_poll(t_gnusb *x, long n); -void gnusb_smooth(t_gnusb *x, long n); -void gnusb_start(t_gnusb *x); -void gnusb_stop(t_gnusb *x); - -// functions used to find the USB device -static int usbGetStringAscii(usb_dev_handle *dev, int index, int langid, char *buf, int buflen); -void find_device(t_gnusb *x); - - - -// ============================================================================== -// Implementation -// ------------------------------------------------------------------------------ - - - -//-------------------------------------------------------------------------- -// - Message: output -> output a byte on port B or C -//-------------------------------------------------------------------------- - -void gnusb_output(t_gnusb *x, t_symbol *s, long n) -{ - int cmd; - int nBytes; - unsigned char buffer[8]; - - cmd = 0; - if (s == gensym("b")) cmd = GNUSB_CMD_SET_PORTB; - else if (s == gensym("c")) cmd = GNUSB_CMD_SET_PORTC; - else { - post ("gnusb: unknown port\n"); - return; - } - - if (n < 0) n = 0; - if (n > 255) n = 255; - - if (!(x->dev_handle)) find_device(x); - else { - nBytes = usb_control_msg(x->dev_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, - cmd, n, 0, (char *)buffer, sizeof(buffer), 10); - } - - -} - -//-------------------------------------------------------------------------- -// - Message: input -> sets port to be an input -//-------------------------------------------------------------------------- - -void gnusb_input(t_gnusb *x, t_symbol *s) -{ - int cmd; - int nBytes; - unsigned char buffer[8]; - - cmd = 0; - if (s == gensym("b")) cmd = GNUSB_CMD_INPUT_PORTB; - else if (s == gensym("c")) cmd = GNUSB_CMD_INPUT_PORTC; - else { - post ("gnusb: unknown port\n"); - return; - } - - if (!(x->dev_handle)) find_device(x); - else { - nBytes = usb_control_msg(x->dev_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, - cmd, 0, 0, (char *)buffer, sizeof(buffer), 10); - } - - -} - -//-------------------------------------------------------------------------- -// - Message: precision -> 8 or 10 bit -//-------------------------------------------------------------------------- - -void gnusb_precision(t_gnusb *x, t_symbol *s) -{ - if (s == gensym("10bit")) x->do_10_bit = 1; - else x->do_10_bit = 0; -} - - -//-------------------------------------------------------------------------- -// - Message: debug -//-------------------------------------------------------------------------- - -void gnusb_debug(t_gnusb *x, long n) // x = the instance of the object; n = the int received in the left inlet -{ - if (n) x->debug_flag = 1; - else x->debug_flag = 0; -} -//-------------------------------------------------------------------------- -// - Message: bang -> poll the gnusb -//-------------------------------------------------------------------------- - -void gnusb_bang(t_gnusb *x) // poll the gnusb -{ - int nBytes,i,n; - int replymask,replyshift,replybyte; - int temp; - unsigned char buffer[12]; - - if (!(x->dev_handle)) find_device(x); - else { - // ask the gnusb to send us data - nBytes = usb_control_msg(x->dev_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, - GNUSB_CMD_POLL, 0, 0, (char *)buffer, sizeof(buffer), 10); - // let's see what has come back... - if(nBytes < sizeof(buffer)){ - if (x->debug_flag) { - if(nBytes < 0) - post( "USB error: %s\n", usb_strerror()); - post( "only %d bytes status received\n", nBytes); - } - } else { - for (i = 0; i < OUTLETS; i++) { - // n = OUTLETS - i - 1; // on max/msp outlets are reversed - n = i; - temp = buffer[n]; - - - // add 2 stuffed bits from end of buffer if we're doing 10bit precision - if (n < 8) { - if (x->do_10_bit) { - - if (n < 4) replybyte = buffer[10]; - else replybyte = buffer[11]; - - replyshift = ((n % 4) * 2); // how much to shift the bits - replymask = (3 << replyshift); - - temp = temp * 4 + ((replybyte & replymask) >> replyshift); // add 2 LSB - - } - } - - if (x->values[i] != temp) { // output if value has changed -//max outlet_int(x->outlets[i], temp); - outlet_float(x->outlets[i], temp); - x->values[i] = temp; - } - } - } - } -} - - -//-------------------------------------------------------------------------- -// - Message: open -> open connection to gnusb -//-------------------------------------------------------------------------- - -void gnusb_open(t_gnusb *x) -{ - if (x->dev_handle) { - post("gnusb: There is already a connection to www.anyma.ch/gnusb",0); - } else find_device(x); -} - -//-------------------------------------------------------------------------- -// - Message: close -> close connection to gnusb -//-------------------------------------------------------------------------- - -void gnusb_close(t_gnusb *x) -{ - if (x->dev_handle) { - usb_close(x->dev_handle); - x->dev_handle = NULL; - post("gnusb: Closed connection to www.anyma.ch/gnusb",0); - } else - post("gnusb: There was no open connection to www.anyma.ch/gnusb",0); -} - -//-------------------------------------------------------------------------- -// - Message: poll -> set polling interval -//-------------------------------------------------------------------------- - -void gnusb_poll(t_gnusb *x, long n){ - if (n > 0) { - x->m_interval = n; - x->m_interval_bak = n; - gnusb_start(x); - } else { - gnusb_stop(x); - } -} - -//-------------------------------------------------------------------------- -// - Message: smooth -> set smoothing on analog inputs -//-------------------------------------------------------------------------- - -void gnusb_smooth(t_gnusb *x, long n) { - int nBytes; - unsigned char buffer[8]; - - if (n < 0) n = 0; - if (n > 15) n = 15; - - if (!(x->dev_handle)) find_device(x); - else { - nBytes = usb_control_msg(x->dev_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, - GNUSB_CMD_SET_SMOOTHING, n, 0, (char *)buffer, sizeof(buffer), 10); - } - -} - -//-------------------------------------------------------------------------- -// - Message: int -> zero stops / nonzero starts -//-------------------------------------------------------------------------- - -void gnusb_int(t_gnusb *x,long n) { - if (n) { - if (!x->is_running) gnusb_start(x); - } else { - if (x->is_running) gnusb_stop(x); - } -} - -//-------------------------------------------------------------------------- -// - Message: start -> start automatic polling -//-------------------------------------------------------------------------- - -void gnusb_start (t_gnusb *x) { - if (!x->is_running) { - clock_delay(x->m_clock,0.); - x->is_running = 1; - } -} - -//-------------------------------------------------------------------------- -// - Message: stop -> stop automatic polling -//-------------------------------------------------------------------------- - -void gnusb_stop (t_gnusb *x) { - if (x->is_running) { - x->is_running = 0; - clock_unset(x->m_clock); - gnusb_close(x); - } -} - - - -//-------------------------------------------------------------------------- -// - The clock is ticking, tic, tac... -//-------------------------------------------------------------------------- - -void gnusb_tick(t_gnusb *x) { -// clock_fdelay(x->m_clock, x->m_interval); // schedule another tick - clock_delay(x->m_clock, x->m_interval); // schedule another tick - gnusb_bang(x); // poll the gnusb -} - - -//-------------------------------------------------------------------------- -// - Object creation and setup -//-------------------------------------------------------------------------- - -int gnusb_setup(void) -{ - - gnusb_class = class_new ( gensym("gnusb"),(t_newmethod)gnusb_new, 0, sizeof(t_gnusb), CLASS_DEFAULT,0); - - // setup() loads our external into Max's memory so it can be used in a patch - // gnusb_new = object creation method defined below, A_DEFLONG = its (optional) arguement is a long (32-bit) int - - // Add message handlers - class_addbang(gnusb_class, (t_method)gnusb_bang); -//max addint(gnusb_class, (t_method)gnusb_int); - class_addfloat(gnusb_class, (t_method)gnusb_int); - class_addmethod(gnusb_class, (t_method)gnusb_debug,gensym("debug"), A_DEFFLOAT, 0); - class_addmethod(gnusb_class, (t_method)gnusb_open, gensym("open"), 0); - class_addmethod(gnusb_class, (t_method)gnusb_close, gensym("close"), 0); - class_addmethod(gnusb_class, (t_method)gnusb_poll, gensym("poll"), A_DEFFLOAT,0); - class_addmethod(gnusb_class, (t_method)gnusb_output, gensym("output"), A_DEFSYM,A_DEFFLOAT,0); - class_addmethod(gnusb_class, (t_method)gnusb_input, gensym("input"), A_DEFSYM,0); - class_addmethod(gnusb_class, (t_method)gnusb_precision, gensym("precision"), A_DEFSYM,0); - class_addmethod(gnusb_class, (t_method)gnusb_smooth, gensym("smooth"), A_DEFFLOAT,0); - class_addmethod(gnusb_class, (t_method)gnusb_start, gensym("start"), 0); - class_addmethod(gnusb_class, (t_method)gnusb_stop, gensym("stop"), 0); - - post("gnusb version 1.0 - (c) 2007 [ a n y m a ]",0); // post any important info to the max window when our object is laoded - - return 1; -} - -//-------------------------------------------------------------------------- - -void *gnusb_new(t_symbol *s) // s = optional argument typed into object box (A_SYM) -- defaults to 0 if no args are typed -{ - t_gnusb *x; // local variable (pointer to a t_gnusb data structure) - -//max x = (t_gnusb *)newobject(gnusb_class); // create a new instance of this object - x = (t_gnusb *)pd_new(gnusb_class); // create a new instance of this object - x->m_clock = clock_new(x,(t_method)gnusb_tick); // make new clock for polling and attach gnsub_tick function to it - - if (s == gensym("10bit")) x->do_10_bit = 1; - else x->do_10_bit = 0; - - x->m_interval = DEFAULT_CLOCK_INTERVAL; - x->m_interval_bak = DEFAULT_CLOCK_INTERVAL; - - x->debug_flag = 0; - x->dev_handle = NULL; - int i; - // create outlets and assign it to our outlet variable in the instance's data structure - for (i=0; i < OUTLETS; i++) { - x->outlets[i] = outlet_new(&x->p_ob, &s_float); -//max x->outlets[i] = intout(x); - } - - return x; // return a reference to the object instance -} - - - -//-------------------------------------------------------------------------- -// - Object destruction -//-------------------------------------------------------------------------- - -void gnusb_free(t_gnusb *x) -{ - if (x->dev_handle) usb_close(x->dev_handle); -// freeobject((t_object *)x->m_clock); // free the clock - - freebytes((t_object *)x->m_clock, sizeof(x->m_clock)); - -} - - - - - -//-------------------------------------------------------------------------- -// - USB Utility Functions -//-------------------------------------------------------------------------- - - -static int usbGetStringAscii(usb_dev_handle *dev, int index, int langid, char *buf, int buflen) -{ -char buffer[256]; -int rval, i; - - if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, langid, buffer, sizeof(buffer), 1000)) < 0) - return rval; - if(buffer[1] != USB_DT_STRING) - return 0; - if((unsigned char)buffer[0] < rval) - rval = (unsigned char)buffer[0]; - rval /= 2; - /* lossy conversion to ISO Latin1 */ - for(i=1;i buflen) /* destination buffer overflow */ - break; - buf[i-1] = buffer[2 * i]; - if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */ - buf[i-1] = '?'; - } - buf[i-1] = 0; - return i-1; -} - -//-------------------------------------------------------------------------- - - -void find_device(t_gnusb *x) -{ - usb_dev_handle *handle = NULL; - struct usb_bus *bus; - struct usb_device *dev; - - usb_find_busses(); - usb_find_devices(); - for(bus=usb_busses; bus; bus=bus->next){ - for(dev=bus->devices; dev; dev=dev->next){ - if(dev->descriptor.idVendor == USBDEV_SHARED_VENDOR && dev->descriptor.idProduct == USBDEV_SHARED_PRODUCT){ - char string[256]; - int len; - handle = usb_open(dev); /* we need to open the device in order to query strings */ - if(!handle){ - error ("Warning: cannot open USB device: %s", usb_strerror()); - continue; - } - /* now find out whether the device actually is gnusb */ - len = usbGetStringAscii(handle, dev->descriptor.iManufacturer, 0x0409, string, sizeof(string)); - if(len < 0){ - post("gnusb: warning: cannot query manufacturer for device: %s", usb_strerror()); - goto skipDevice; - } - - // post("gnusb: seen device from vendor ->%s<-", string); - if(strcmp(string, "www.anyma.ch") != 0) - goto skipDevice; - len = usbGetStringAscii(handle, dev->descriptor.iProduct, 0x0409, string, sizeof(string)); - if(len < 0){ - post("gnusb: warning: cannot query product for device: %s", usb_strerror()); - goto skipDevice; - } - // post("gnusb: seen product ->%s<-", string); - if(strcmp(string, "gnusb") == 0) - break; -skipDevice: - usb_close(handle); - handle = NULL; - } - } - if(handle) - break; - } - - if(!handle){ - post("gnusb: Could not find USB device www.anyma.ch/gnusb"); - x->dev_handle = NULL; - if (x->m_interval < 10000) x->m_interval *=2; // throttle polling down to max 20s if we can't find a gnusb - } else { - x->dev_handle = handle; - post("gnusb: Found USB device www.anyma.ch/gnusb"); - x->m_interval = x->m_interval_bak; // restore original polling interval - if (x->is_running) gnusb_tick(x); - else gnusb_bang(x); - } -} \ No newline at end of file diff --git a/tools/gnusb/puredata/gnusb.help.pd b/tools/gnusb/puredata/gnusb.help.pd deleted file mode 100644 index eae279b..0000000 --- a/tools/gnusb/puredata/gnusb.help.pd +++ /dev/null @@ -1,43 +0,0 @@ -#N canvas 518 117 576 441 10; -#X obj 92 193 gnusb __________________1; -#X floatatom 91 221 5 0 0 0 - - -; -#X floatatom 109 238 5 0 0 0 - - -; -#X floatatom 128 261 5 0 0 0 - - -; -#X obj 92 33 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1 -; -#X floatatom 225 350 5 0 0 0 - - -; -#X floatatom 149 279 5 0 0 0 - - -; -#X floatatom 166 297 5 0 0 0 - - -; -#X floatatom 186 313 5 0 0 0 - - -; -#X floatatom 204 332 5 0 0 0 - - -; -#X floatatom 243 239 5 0 0 0 - - -; -#X floatatom 259 256 5 0 0 0 - - -; -#X msg 309 37 precision 10bit; -#X msg 430 36 precision 8bit; -#X msg 148 35 smooth 0; -#X msg 231 36 smooth \$1; -#X floatatom 231 17 5 0 0 0 - - -; -#X msg 279 151 output b \$1; -#X floatatom 279 130 5 0 0 0 - - -; -#X floatatom 432 129 5 0 0 0 - - -; -#X msg 432 150 output c \$1; -#X connect 0 0 1 0; -#X connect 0 1 2 0; -#X connect 0 2 3 0; -#X connect 0 3 6 0; -#X connect 0 4 7 0; -#X connect 0 5 8 0; -#X connect 0 6 9 0; -#X connect 0 7 5 0; -#X connect 0 8 10 0; -#X connect 0 9 11 0; -#X connect 4 0 0 0; -#X connect 12 0 0 0; -#X connect 13 0 0 0; -#X connect 14 0 0 0; -#X connect 15 0 0 0; -#X connect 16 0 15 0; -#X connect 17 0 0 0; -#X connect 18 0 17 0; -#X connect 19 0 20 0; -#X connect 20 0 0 0; diff --git a/tools/gnusb/puredata/m_imp.h b/tools/gnusb/puredata/m_imp.h deleted file mode 100644 index 2247bf4..0000000 --- a/tools/gnusb/puredata/m_imp.h +++ /dev/null @@ -1,223 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* This file contains function prototypes and data types used to implement -Pd, but not shared with Pd objects. */ - -#include "m_pd.h" - -/* LATER consider whether to use 'char' for method arg types to save space */ - -/* the structure for a method handler ala Max */ -typedef struct _methodentry -{ - t_symbol *me_name; - t_gotfn me_fun; - t_atomtype me_arg[MAXPDARG+1]; -} t_methodentry; - -EXTERN_STRUCT _widgetbehavior; - -typedef void (*t_bangmethod)(t_pd *x); -typedef void (*t_pointermethod)(t_pd *x, t_gpointer *gp); -typedef void (*t_floatmethod)(t_pd *x, t_float f); -typedef void (*t_symbolmethod)(t_pd *x, t_symbol *s); -typedef void (*t_listmethod)(t_pd *x, t_symbol *s, int argc, t_atom *argv); -typedef void (*t_anymethod)(t_pd *x, t_symbol *s, int argc, t_atom *argv); - -struct _class -{ - t_symbol *c_name; /* name (mostly for error reporting) */ - t_symbol *c_helpname; /* name of help file */ - size_t c_size; /* size of an instance */ - t_methodentry *c_methods; /* methods other than bang, etc below */ - int c_nmethod; /* number of methods */ - t_method c_freemethod; /* function to call before freeing */ - t_bangmethod c_bangmethod; /* common methods */ - t_pointermethod c_pointermethod; - t_floatmethod c_floatmethod; - t_symbolmethod c_symbolmethod; - t_listmethod c_listmethod; - t_anymethod c_anymethod; - struct _widgetbehavior *c_wb; /* "gobjs" only */ - struct _parentwidgetbehavior *c_pwb;/* widget behavior in parent */ - int c_floatsignalin; /* onset to float for signal input */ - char c_gobj; /* true if is a gobj */ - char c_patchable; /* true if we have a t_object header */ - char c_firstin; /* if patchable, true if draw first inlet */ - char c_drawcommand; /* a drawing command for a template */ -}; - -/* s_file.c */ -typedef struct _namelist -{ - struct _namelist *nl_next; - char *nl_string; -} t_namelist; - -t_namelist *namelist_append(t_namelist *listwas, const char *s); -void namelist_free(t_namelist *listwas); - -extern int sys_debuglevel; -extern int sys_verbose; - -#define DEBUG_MESSUP 1 /* messages up from pd to pd-gui */ -#define DEBUG_MESSDOWN 2 /* messages down from pd-gui to pd */ - -extern int sys_noloadbang; -extern int sys_nogui; -extern char *sys_guicmd; - -/* in s_main.c */ -EXTERN int sys_nearestfontsize(int fontsize); -EXTERN int sys_hostfontsize(int fontsize); - -extern int sys_defaultfont; -extern t_symbol *sys_libdir; /* library directory for auxilliary files */ -/* s_loader.c */ -int sys_load_lib(char *dirname, char *filename); - -/* s_unix.c */ -EXTERN void sys_microsleep(int microsec); - -/* s_sgi.c, s_nt.c, s_linux.c each implement the same API for audio -and MIDI I/O as follows: */ - -#define DACBLKSIZE 64 - -#define SENDDACS_NO 0 /* return values for sys_send_dacs() */ -#define SENDDACS_YES 1 -#define SENDDACS_SLEPT 2 - -#define API_OSS 0 /* API choices */ -#define API_ALSA 1 -#define API_RME 2 -#define API_MMIO 3 -#define API_PORTAUDIO 4 - - - /* MIDI input and output */ -#define MAXMIDIINDEV 16 /* max. number of input ports */ -#define MAXMIDIOUTDEV 16 /* max. number of output ports */ -extern int sys_nmidiin; -extern int sys_nmidiout; -extern int sys_midiindevlist[]; -extern int sys_midioutdevlist[]; - -EXTERN void sys_putmidimess(int portno, int a, int b, int c); -EXTERN void sys_putmidibyte(int portno, int a); -EXTERN void sys_poll_midi(void); -EXTERN void sys_setmiditimediff(double inbuftime, double outbuftime); -EXTERN void sys_midibytein(int portno, int byte); - -extern int sys_hipriority; /* real-time flag, true if priority boosted */ -extern t_sample *sys_soundout; -extern t_sample *sys_soundin; -extern float sys_dacsr; -extern int sys_schedadvance; -extern int sys_sleepgrain; -EXTERN void sys_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev, - int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, - int srate); /* IOhannes */ - -EXTERN void sys_close_audio(void); - -EXTERN void sys_open_midi(int nmidiin, int *midiinvec, - int nmidiout, int *midioutvec); -EXTERN void sys_close_midi(void); - -EXTERN int sys_send_dacs(void); -EXTERN void sys_reportidle(void); -EXTERN void sys_set_priority(int higher); -EXTERN void sys_audiobuf(int nbufs); -EXTERN void sys_getmeters(float *inmax, float *outmax); -EXTERN void sys_listdevs(void); -EXTERN void sys_setblocksize(int n); - - /* for NT and Linux, there are additional bits of fluff as follows. */ -#ifdef NT -EXTERN void nt_soundindev(int which); -EXTERN void nt_soundoutdev(int which); -EXTERN void nt_midiindev(int which); -EXTERN void nt_midioutdev(int which); -EXTERN void nt_noresync( void); -EXTERN void nt_set_sound_api(int which); -#endif - -#ifdef __linux__ - /* the following definitions allow you to switch at run time - between audio APIs in Linux and later in NT. */ -void linux_set_sound_api(int which); - -void linux_setfrags(int n); -void linux_streammode( void); -void linux_32bit( void); -void rme_soundindev(int which); -void rme_soundoutdev(int which); -void linux_alsa_queue_size(int size); -#ifdef ALSA99 /* old fashioned ALSA */ -void linux_alsa_devno(int devno); -#else -void linux_alsa_devname(char *devname); -#endif -#endif /* __linux__ */ - -/* portaudio, used in Windows and Mac versions... */ - -int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, - t_sample *soundout, int framesperbuf, int nbuffers, - int indeviceno, int outdeviceno); -void pa_close_audio(void); -int pa_send_dacs(void); -void pa_reportidle(void); -void pa_listdevs(void); - -/* m_sched.c */ -EXTERN void sys_log_error(int type); -#define ERR_NOTHING 0 -#define ERR_ADCSLEPT 1 -#define ERR_DACSLEPT 2 -#define ERR_RESYNC 3 -#define ERR_DATALATE 4 - -/* s_inter.c */ - -EXTERN void sys_bail(int exitcode); -EXTERN int sys_pollgui(void); - -EXTERN_STRUCT _socketreceiver; -#define t_socketreceiver struct _socketreceiver - -typedef void (*t_socketnotifier)(void *x); -typedef void (*t_socketreceivefn)(void *x, t_binbuf *b); - -EXTERN t_socketreceiver *socketreceiver_new(void *owner, - t_socketnotifier notifier, t_socketreceivefn socketreceivefn, int udp); -EXTERN void socketreceiver_read(t_socketreceiver *x, int fd); -EXTERN void sys_sockerror(char *s); -EXTERN void sys_closesocket(int fd); - -typedef void (*t_fdpollfn)(void *ptr, int fd); -EXTERN void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr); -EXTERN void sys_rmpollfn(int fd); -#ifdef UNIX -void sys_setalarm(int microsec); -void sys_setvirtualalarm( void); -#endif - -/* m_obj.c */ -EXTERN int obj_noutlets(t_object *x); -EXTERN int obj_ninlets(t_object *x); -EXTERN t_outconnect *obj_starttraverseoutlet(t_object *x, t_outlet **op, - int nout); -EXTERN t_outconnect *obj_nexttraverseoutlet(t_outconnect *lastconnect, - t_object **destp, t_inlet **inletp, int *whichp); -EXTERN t_outconnect *obj_connect(t_object *source, int outno, - t_object *sink, int inno); -EXTERN void obj_disconnect(t_object *source, int outno, t_object *sink, - int inno); -EXTERN void outlet_setstacklim(void); -/* misc */ -EXTERN void glob_evalfile(t_pd *ignore, t_symbol *name, t_symbol *dir); -EXTERN void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv); diff --git a/tools/gnusb/puredata/m_pd.h b/tools/gnusb/puredata/m_pd.h deleted file mode 100644 index 6f1c0fd..0000000 --- a/tools/gnusb/puredata/m_pd.h +++ /dev/null @@ -1,594 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) -extern "C" { -#endif - -#ifdef NT -// #pragma warning( disable : 4091 ) -#pragma warning( disable : 4305 ) /* uncast const double to float */ -#pragma warning( disable : 4244 ) /* uncast float/int conversion etc. */ -#pragma warning( disable : 4101 ) /* unused automatic variables */ -#endif /* NT */ - - /* the external storage class is "extern" in UNIX; in NT it's ugly. */ -#ifdef NT -#ifdef PD_INTERNAL -#define EXTERN __declspec(dllexport) extern -#else -#define EXTERN __declspec(dllimport) extern -#endif /* PD_INTERNAL */ -#else -#define EXTERN extern -#endif /* NT */ - - /* and depending on the compiler, hidden data structures are - declared differently: */ -#if defined(__GNUC__) || defined(__BORLANDC__) || defined(__INTEL_COMPILER) -#define EXTERN_STRUCT struct -#else -#define EXTERN_STRUCT extern struct -#endif - - -#if !defined(_SIZE_T) && !defined(_SIZE_T_) -#include /* just for size_t -- how lame! */ -#endif - -#define MAXPDSTRING 1000 /* use this for anything you want */ -#define MAXPDARG 5 /* max number of args we can typecheck today */ - - /* signed and unsigned integer types the size of a pointer: */ -#ifdef __alpha__ -typedef long t_int; -#else -typedef int t_int; -#endif - -typedef float t_float; /* a floating-point number at most the same size */ -typedef float t_floatarg; /* floating-point type for function calls */ - -typedef struct _symbol -{ - char *s_name; - struct _class **s_thing; - struct _symbol *s_next; -} t_symbol; - -EXTERN_STRUCT _array; -#define t_array struct _array /* g_canvas.h */ - -/* pointers to glist and array elements go through a "stub" which sticks -around after the glist or array is freed. The stub itself is deleted when -both the glist/array is gone and the refcount is zero, ensuring that no -gpointers are pointing here. */ - -#define GP_NONE 0 /* the stub points nowhere (has been cut off) */ -#define GP_GLIST 1 /* the stub points to a glist element */ -#define GP_ARRAY 2 /* ... or array */ - -typedef struct _gstub -{ - union - { - struct _glist *gs_glist; /* glist we're in */ - struct _array *gs_array; /* array we're in */ - } gs_un; - int gs_which; /* GP_GLIST/GP_ARRAY */ - int gs_refcount; /* number of gpointers pointing here */ -} t_gstub; - -typedef struct _gpointer /* pointer to a gobj in a glist */ -{ - union - { - struct _scalar *gp_scalar; /* scalar we're in (if glist) */ - union word *gp_w; /* raw data (if array) */ - } gp_un; - int gp_valid; /* number which must match gpointee */ - t_gstub *gp_stub; /* stub which points to glist/array */ -} t_gpointer; - -typedef union word -{ - t_float w_float; - t_symbol *w_symbol; - t_gpointer *w_gpointer; - t_array *w_array; - struct _glist *w_list; - int w_index; -} t_word; - -typedef enum -{ - A_NULL, - A_FLOAT, - A_SYMBOL, - A_POINTER, - A_SEMI, - A_COMMA, - A_DEFFLOAT, - A_DEFSYM, - A_DOLLAR, - A_DOLLSYM, - A_GIMME, - A_CANT -} t_atomtype; - -#define A_DEFSYMBOL A_DEFSYM /* better name for this */ - -typedef struct _atom -{ - t_atomtype a_type; - union word a_w; -} t_atom; - -EXTERN_STRUCT _class; -#define t_class struct _class - -EXTERN_STRUCT _outlet; -#define t_outlet struct _outlet - -EXTERN_STRUCT _inlet; -#define t_inlet struct _inlet - -EXTERN_STRUCT _binbuf; -#define t_binbuf struct _binbuf - -EXTERN_STRUCT _clock; -#define t_clock struct _clock - -EXTERN_STRUCT _outconnect; -#define t_outconnect struct _outconnect - -EXTERN_STRUCT _glist; -#define t_glist struct _glist -#define t_canvas struct _glist /* LATER lose this */ - -typedef t_class *t_pd; /* pure datum: nothing but a class pointer */ - -typedef struct _gobj /* a graphical object */ -{ - t_pd g_pd; /* pure datum header (class) */ - struct _gobj *g_next; /* next in list */ -} t_gobj; - -typedef struct _scalar /* a graphical object holding data */ -{ - t_gobj sc_gobj; /* header for graphical object */ - t_symbol *sc_template; /* template name (LATER replace with pointer) */ - t_word sc_vec[1]; /* indeterminate-length array of words */ -} t_scalar; - -typedef struct _text /* patchable object - graphical, with text */ -{ - t_gobj te_g; /* header for graphical object */ - t_binbuf *te_binbuf; /* holder for the text */ - t_outlet *te_outlet; /* linked list of outlets */ - t_inlet *te_inlet; /* linked list of inlets */ - short te_xpix; /* x&y location (within the toplevel) */ - short te_ypix; - short te_width; /* requested width in chars, 0 if auto */ - unsigned int te_type:2; /* from defs below */ -} t_text; - -#define T_TEXT 0 /* just a textual comment */ -#define T_OBJECT 1 /* a MAX style patchable object */ -#define T_MESSAGE 2 /* a MAX stype message */ -#define T_ATOM 3 /* a cell to display a number or symbol */ - -#define te_pd te_g.g_pd - - /* t_object is synonym for t_text (LATER unify them) */ - -typedef struct _text t_object; - -#define ob_outlet te_outlet -#define ob_inlet te_inlet -#define ob_binbuf te_binbuf -#define ob_pd te_g.g_pd -#define ob_g te_g - -typedef void (*t_method)(void); -typedef void *(*t_newmethod)( void); -typedef void (*t_gotfn)(void *x, ...); - -/* ---------------- pre-defined objects and symbols --------------*/ -EXTERN t_pd pd_objectmaker; /* factory for creating "object" boxes */ -EXTERN t_pd pd_canvasmaker; /* factory for creating canvases */ -EXTERN t_symbol s_pointer; -EXTERN t_symbol s_float; -EXTERN t_symbol s_symbol; -EXTERN t_symbol s_bang; -EXTERN t_symbol s_list; -EXTERN t_symbol s_anything; -EXTERN t_symbol s_signal; -EXTERN t_symbol s__N; -EXTERN t_symbol s__X; -EXTERN t_symbol s_x; -EXTERN t_symbol s_y; -EXTERN t_symbol s_; - -/* --------- prototypes from the central message system ----------- */ -EXTERN void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv); -EXTERN void pd_forwardmess(t_pd *x, int argc, t_atom *argv); -EXTERN t_symbol *gensym(char *s); -EXTERN t_gotfn getfn(t_pd *x, t_symbol *s); -EXTERN t_gotfn zgetfn(t_pd *x, t_symbol *s); -EXTERN void nullfn(void); -EXTERN void pd_vmess(t_pd *x, t_symbol *s, char *fmt, ...); -#define mess0(x, s) ((*getfn((x), (s)))((x))) -#define mess1(x, s, a) ((*getfn((x), (s)))((x), (a))) -#define mess2(x, s, a,b) ((*getfn((x), (s)))((x), (a),(b))) -#define mess3(x, s, a,b,c) ((*getfn((x), (s)))((x), (a),(b),(c))) -#define mess4(x, s, a,b,c,d) ((*getfn((x), (s)))((x), (a),(b),(c),(d))) -#define mess5(x, s, a,b,c,d,e) ((*getfn((x), (s)))((x), (a),(b),(c),(d),(e))) -void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv); - -/* --------------- memory management -------------------- */ -EXTERN void *getbytes(size_t nbytes); -EXTERN void *getzbytes(size_t nbytes); -EXTERN void *copybytes(void *src, size_t nbytes); -EXTERN void freebytes(void *x, size_t nbytes); -EXTERN void *resizebytes(void *x, size_t oldsize, size_t newsize); - -/* -------------------- atoms ----------------------------- */ - -#define SETSEMI(atom) ((atom)->a_type = A_SEMI, (atom)->a_w.w_index = 0) -#define SETCOMMA(atom) ((atom)->a_type = A_COMMA, (atom)->a_w.w_index = 0) -#define SETPOINTER(atom, gp) ((atom)->a_type = A_POINTER, \ - (atom)->a_w.w_gpointer = (gp)) -#define SETFLOAT(atom, f) ((atom)->a_type = A_FLOAT, (atom)->a_w.w_float = (f)) -#define SETSYMBOL(atom, s) ((atom)->a_type = A_SYMBOL, \ - (atom)->a_w.w_symbol = (s)) -#define SETDOLLAR(atom, n) ((atom)->a_type = A_DOLLAR, \ - (atom)->a_w.w_index = (n)) -#define SETDOLLSYM(atom, s) ((atom)->a_type = A_DOLLSYM, \ - (atom)->a_w.w_symbol= (s)) - -EXTERN t_float atom_getfloat(t_atom *a); -EXTERN t_int atom_getint(t_atom *a); -EXTERN t_symbol *atom_getsymbol(t_atom *a); -EXTERN t_symbol *atom_gensym(t_atom *a); -EXTERN t_float atom_getfloatarg(int which, int argc, t_atom *argv); -EXTERN t_int atom_getintarg(int which, int argc, t_atom *argv); -EXTERN t_symbol *atom_getsymbolarg(int which, int argc, t_atom *argv); - -EXTERN void atom_string(t_atom *a, char *buf, unsigned int bufsize); - -/* ------------------ binbufs --------------- */ - -EXTERN t_binbuf *binbuf_new(void); -EXTERN void binbuf_free(t_binbuf *x); - -EXTERN void binbuf_text(t_binbuf *x, char *text, size_t size); -EXTERN void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp); -EXTERN void binbuf_clear(t_binbuf *x); -EXTERN void binbuf_add(t_binbuf *x, int argc, t_atom *argv); -EXTERN void binbuf_addv(t_binbuf *x, char *fmt, ...); -EXTERN void binbuf_addbinbuf(t_binbuf *x, t_binbuf *y); -EXTERN void binbuf_addsemi(t_binbuf *x); -EXTERN void binbuf_restore(t_binbuf *x, int argc, t_atom *argv); -EXTERN void binbuf_print(t_binbuf *x); -EXTERN int binbuf_getnatom(t_binbuf *x); -EXTERN t_atom *binbuf_getvec(t_binbuf *x); -EXTERN void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv); -EXTERN int binbuf_read(t_binbuf *b, char *filename, char *dirname, - int crflag); -EXTERN int binbuf_read_via_path(t_binbuf *b, char *filename, char *dirname, - int crflag); -EXTERN int binbuf_write(t_binbuf *x, char *filename, char *dir, - int crflag); -EXTERN void binbuf_evalfile(t_symbol *name, t_symbol *dir); - -/* ------------------ clocks --------------- */ - -EXTERN t_clock *clock_new(void *owner, t_method fn); -EXTERN void clock_set(t_clock *x, double systime); -EXTERN void clock_delay(t_clock *x, double delaytime); -EXTERN void clock_unset(t_clock *x); -EXTERN double clock_getlogicaltime(void); -EXTERN double clock_getsystime(void); /* OBSOLETE; use clock_getlogicaltime() */ -EXTERN double clock_gettimesince(double prevsystime); -EXTERN double clock_getsystimeafter(double delaytime); -EXTERN void clock_free(t_clock *x); - -/* ----------------- pure data ---------------- */ -EXTERN t_pd *pd_new(t_class *cls); -EXTERN void pd_free(t_pd *x); -EXTERN void pd_bind(t_pd *x, t_symbol *s); -EXTERN void pd_unbind(t_pd *x, t_symbol *s); -EXTERN t_pd *pd_findbyclass(t_symbol *s, t_class *c); -EXTERN void pd_pushsym(t_pd *x); -EXTERN void pd_popsym(t_pd *x); -EXTERN t_symbol *pd_getfilename(void); -EXTERN t_symbol *pd_getdirname(void); -EXTERN void pd_bang(t_pd *x); -EXTERN void pd_pointer(t_pd *x, t_gpointer *gp); -EXTERN void pd_float(t_pd *x, t_float f); -EXTERN void pd_symbol(t_pd *x, t_symbol *s); -EXTERN void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv); -EXTERN void pd_anything(t_pd *x, t_symbol *s, int argc, t_atom *argv); -#define pd_class(x) (*(x)) - -/* ----------------- pointers ---------------- */ -EXTERN void gpointer_init(t_gpointer *gp); -EXTERN void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto); -EXTERN void gpointer_unset(t_gpointer *gp); -EXTERN int gpointer_check(const t_gpointer *gp, int headok); - -/* ----------------- patchable "objects" -------------- */ -EXTERN_STRUCT _inlet; -#define t_inlet struct _inlet -EXTERN_STRUCT _outlet; -#define t_outlet struct _outlet - -EXTERN t_inlet *inlet_new(t_object *owner, t_pd *dest, t_symbol *s1, - t_symbol *s2); -EXTERN t_inlet *pointerinlet_new(t_object *owner, t_gpointer *gp); -EXTERN t_inlet *floatinlet_new(t_object *owner, t_float *fp); -EXTERN t_inlet *symbolinlet_new(t_object *owner, t_symbol **sp); -EXTERN void inlet_free(t_inlet *x); - -EXTERN t_outlet *outlet_new(t_object *owner, t_symbol *s); -EXTERN void outlet_bang(t_outlet *x); -EXTERN void outlet_pointer(t_outlet *x, t_gpointer *gp); -EXTERN void outlet_float(t_outlet *x, t_float f); -EXTERN void outlet_symbol(t_outlet *x, t_symbol *s); -EXTERN void outlet_list(t_outlet *x, t_symbol *s, int argc, t_atom *argv); -EXTERN void outlet_anything(t_outlet *x, t_symbol *s, int argc, t_atom *argv); -EXTERN void outlet_free(t_outlet *x); -EXTERN t_object *pd_checkobject(t_pd *x); - - -/* -------------------- canvases -------------- */ - -EXTERN void glob_setfilename(void *dummy, t_symbol *name, t_symbol *dir); - -EXTERN void canvas_setargs(int argc, t_atom *argv); -EXTERN t_atom *canvas_getarg(int which); -EXTERN t_symbol *canvas_getcurrentdir(void); -EXTERN t_glist *canvas_getcurrent(void); -EXTERN void canvas_makefilename(t_glist *c, char *file, - char *result,int resultsize); -EXTERN t_symbol *canvas_getdir(t_glist *x); -EXTERN int sys_fontwidth(int fontsize); -EXTERN int sys_fontheight(int fontsize); -EXTERN void canvas_dataproperties(t_glist *x, t_scalar *sc, t_binbuf *b); - -/* ---------------- widget behaviors ---------------------- */ - -EXTERN_STRUCT _widgetbehavior; -#define t_widgetbehavior struct _widgetbehavior - -EXTERN_STRUCT _parentwidgetbehavior; -#define t_parentwidgetbehavior struct _parentwidgetbehavior -EXTERN t_parentwidgetbehavior *pd_getparentwidget(t_pd *x); - -/* -------------------- classes -------------- */ - -#define CLASS_DEFAULT 0 /* flags for new classes below */ -#define CLASS_PD 1 -#define CLASS_GOBJ 2 -#define CLASS_PATCHABLE 3 -#define CLASS_NOINLET 8 - -#define CLASS_TYPEMASK 3 - - -EXTERN t_class *class_new(t_symbol *name, t_newmethod newmethod, - t_method freemethod, size_t size, int flags, t_atomtype arg1, ...); -EXTERN void class_addcreator(t_newmethod newmethod, t_symbol *s, - t_atomtype type1, ...); -EXTERN void class_addmethod(t_class *c, t_method fn, t_symbol *sel, - t_atomtype arg1, ...); -EXTERN void class_addbang(t_class *c, t_method fn); -EXTERN void class_addpointer(t_class *c, t_method fn); -EXTERN void class_doaddfloat(t_class *c, t_method fn); -EXTERN void class_addsymbol(t_class *c, t_method fn); -EXTERN void class_addlist(t_class *c, t_method fn); -EXTERN void class_addanything(t_class *c, t_method fn); -EXTERN void class_sethelpsymbol(t_class *c, t_symbol *s); -EXTERN void class_setwidget(t_class *c, t_widgetbehavior *w); -EXTERN void class_setparentwidget(t_class *c, t_parentwidgetbehavior *w); -EXTERN t_parentwidgetbehavior *class_parentwidget(t_class *c); -EXTERN char *class_getname(t_class *c); -EXTERN char *class_gethelpname(t_class *c); -EXTERN void class_setdrawcommand(t_class *c); -EXTERN int class_isdrawcommand(t_class *c); -EXTERN void class_domainsignalin(t_class *c, int onset); -#define CLASS_MAINSIGNALIN(c, type, field) \ - class_domainsignalin(c, (char *)(&((type *)0)->field) - (char *)0) - -#ifndef PD_CLASS_DEF -#define class_addbang(x, y) class_addbang((x), (t_method)(y)) -#define class_addpointer(x, y) class_addpointer((x), (t_method)(y)) -#define class_addfloat(x, y) class_doaddfloat((x), (t_method)(y)) -#define class_addsymbol(x, y) class_addsymbol((x), (t_method)(y)) -#define class_addlist(x, y) class_addlist((x), (t_method)(y)) -#define class_addanything(x, y) class_addanything((x), (t_method)(y)) -#endif - -/* ------------ printing --------------------------------- */ -EXTERN void post(char *fmt, ...); -EXTERN void startpost(char *fmt, ...); -EXTERN void poststring(char *s); -EXTERN void postfloat(float f); -EXTERN void postatom(int argc, t_atom *argv); -EXTERN void endpost(void); -EXTERN void error(char *fmt, ...); -EXTERN void bug(char *fmt, ...); -EXTERN void pd_error(void *object, char *fmt, ...); -EXTERN void sys_logerror(char *object, char *s); -EXTERN void sys_unixerror(char *object); -EXTERN void sys_ouch(void); - -#ifdef __linux__ -EXTERN char* sys_get_path( void); -#endif -EXTERN void sys_addpath(const char* p); - - -/* ------------ system interface routines ------------------- */ -EXTERN int sys_isreadablefile(const char *name); -EXTERN void sys_bashfilename(const char *from, char *to); -EXTERN void sys_unbashfilename(const char *from, char *to); -EXTERN int open_via_path(const char *name, const char *ext, const char *dir, - char *dirresult, char **nameresult, unsigned int size, int bin); -EXTERN int sys_geteventno(void); -EXTERN double sys_getrealtime(void); - -/* --------------- signals ----------------------------------- */ - -typedef float t_sample; -#define MAXLOGSIG 32 -#define MAXSIGSIZE (1 << MAXLOGSIG) - -typedef struct _signal -{ - int s_n; /* number of points in the array */ - t_sample *s_vec; /* the array */ - float s_sr; /* sample rate */ - int s_refcount; /* number of times used */ - int s_isborrowed; /* whether we're going to borrow our array */ - struct _signal *s_borrowedfrom; /* signal to borrow it from */ - struct _signal *s_nextfree; /* next in freelist */ - struct _signal *s_nextused; /* next in used list */ -} t_signal; - - -typedef t_int *(*t_perfroutine)(t_int *args); - -EXTERN t_int *plus_perform(t_int *args); -EXTERN t_int *zero_perform(t_int *args); -EXTERN t_int *copy_perform(t_int *args); - -EXTERN void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n); -EXTERN void dsp_add_copy(t_sample *in, t_sample *out, int n); -EXTERN void dsp_add_scalarcopy(t_sample *in, t_sample *out, int n); -EXTERN void dsp_add_zero(t_sample *out, int n); - -EXTERN int sys_getblksize(void); -EXTERN float sys_getsr(void); -EXTERN int sys_get_inchannels(void); -EXTERN int sys_get_outchannels(void); - -EXTERN void dsp_add(t_perfroutine f, int n, ...); -EXTERN void dsp_addv(t_perfroutine f, int n, t_int *vec); -EXTERN void pd_fft(float *buf, int npoints, int inverse); -EXTERN int ilog2(int n); - -EXTERN void mayer_fht(float *fz, int n); -EXTERN void mayer_fft(int n, float *real, float *imag); -EXTERN void mayer_ifft(int n, float *real, float *imag); -EXTERN void mayer_realfft(int n, float *real); -EXTERN void mayer_realifft(int n, float *real); - -EXTERN float *cos_table; -#define LOGCOSTABSIZE 9 -#define COSTABSIZE (1<= 1400 /* Visual C++ 8.00 */ -#define _CRT_SECURE_NO_DEPRECATE -#endif /* _MSC_VER */ - -#include "pyusb.h" -#include -#include -#define DEFAULT_TIMEOUT 100 - -/* - * Necessary to compile successfully in python 2.3 - * Thanks to Mark Rages for the patch - */ -#ifndef Py_RETURN_NONE -#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None -#endif - -// PYUSB_STATIC char cvsid[] = "$Id: pyusb.c,v 1.24 2007/05/15 21:20:55 wander Exp $"; - -/* - * USBError - */ -PYUSB_STATIC PyObject *PyExc_USBError; - -#define PyUSB_Error() PyErr_SetString(PyExc_USBError, usb_strerror()) - -#define SUPPORT_NUMBER_PROTOCOL(_Arg) \ - (PyNumber_Check(_Arg) || PyString_Check(_Arg) || PyUnicode_Check(_Arg)) - -#if !defined(NDEBUG) -#define DUMP_PARAMS 1 -#else -#define DUMP_PARAMS 0 -#endif /* NDEBUG */ - -#ifndef NDEBUG - -/* - * Print a buffer of data - */ -PYUSB_STATIC void printBuffer( - const char *buffer, - int size - ) -{ - int i; - - if (!buffer) { - fputs("NULL\n", stderr); - return; - } - - for (i = 0; i < size; ++i) { - fprintf(stderr, "%2x ", buffer[i]); - if (i && !(i % 20)) fputc('\n', stderr); - } - - fputc('\n', stderr); -} - -#endif /* NDEBUG */ - -/* - * Converts a object with number procotol to int type - */ -PYUSB_STATIC int py_NumberAsInt( - PyObject *obj - ) -{ - PyObject *number = PyNumber_Int(obj); - if (number) { - int ret = PyInt_AS_LONG(number); - Py_DECREF(number); - return ret; - } else { - return 0; - } -} - -/* - * Gets a byte from a PyObject - * If the obj is a number, returns the number casted to a byte - * If it is a sequence, returns the first byte representation of the sequence - * If it is a mapping, returns the first byte representation of the first obj.values() - */ -PYUSB_STATIC u_int8_t getByte( - PyObject *obj - ) -{ - u_int8_t byte; - - if (PyNumber_Check(obj)) { - byte = (u_int8_t) py_NumberAsInt(obj); - } else if (PyString_Check(obj) || PyUnicode_Check(obj)) { - return (u_int8_t) PyString_AsString(obj)[0]; - } else if (PySequence_Check(obj)) { - PyObject *el0; - el0 = PySequence_GetItem(obj, 0); - if (!el0) return 0; - byte = getByte(el0); - Py_DECREF(el0); - } else if (PyMapping_Check(obj)) { - PyObject *vals; - vals = PyMapping_Values(obj); - if (!vals) return 0; - byte = getByte(vals); - Py_DECREF(vals); - } else { - byte = 0; - PyErr_BadArgument(); - } - - return byte; -} - -/* - * Gets a unsigned byte * representation of the obj - * If the obj is a sequence, returns the elements as a c byte array representation - * If it is a mapping, returns the c byte array representations of the obj.values() - */ -PYUSB_STATIC char *getBuffer( - PyObject *obj, - int *size - ) -{ - char *p = NULL; - - /* - * When the obj is a sequence type, we take the first byte from - * the each element of the sequence - */ - - /* ok, string is a sequence too, but let us optimize it */ - if (PyString_Check(obj) || PyUnicode_Check(obj)) { - char *tmp; - - if (-1 != PyString_AsStringAndSize(obj, &tmp, size)) { - p = (char *) PyMem_Malloc(*size); - if (p) memcpy(p, tmp, *size); - } - } else if (PySequence_Check(obj)) { - u_int32_t i, sz; - PyObject *el; - - sz = PySequence_Size(obj); - p = (char *) PyMem_Malloc(sz); - - for (i = 0; i < sz; ++i) { - el = PySequence_GetItem(obj, i); - p[i] = getByte(el); - Py_DECREF(el); - - if (!p[i] && PyErr_Occurred()) { - PyMem_Free(p); - return NULL; - } - } - - *size = sz; - } else if (PyMapping_Check(obj)) { - PyObject *values; - - values = PyMapping_Values(obj); - if (!values) return NULL; - - p = getBuffer(values, size); - Py_DECREF(values); - } else if (obj == Py_None) { - *size = 0; - return NULL; - } else { - PyErr_BadArgument(); - return NULL; - } - - return p; -} - -/* - * Build a numeric tuple from the buffer values - */ -PYUSB_STATIC PyObject *buildTuple( - char *buffer, - int size - ) -{ - PyObject *ret; - int i; - - ret = PyTuple_New(size); - - if (ret) { - for (i = 0; i < size; ++i) { - PyTuple_SET_ITEM(ret, i, PyInt_FromLong((u_int8_t) buffer[i])); - } - } - - return ret; -} - -/* - * Add a numeric constant to the dictionary - */ -PYUSB_STATIC void addConstant( - PyObject *dict, - const char *name, - long value) -{ - PyObject *val; - - val = PyInt_FromLong(value); - - if (val) { - PyDict_SetItemString(dict, name, val); - Py_DECREF(val); - } -} - -/* - * Add the module constants to the module dictionary - */ -PYUSB_STATIC void installModuleConstants( - PyObject *module - ) -{ - PyObject *dict; - - dict = PyModule_GetDict(module); - - addConstant(dict, "CLASS_PER_INTERFACE", USB_CLASS_PER_INTERFACE); - addConstant(dict, "CLASS_AUDIO", USB_CLASS_AUDIO); - addConstant(dict, "CLASS_COMM", USB_CLASS_COMM); - addConstant(dict, "CLASS_HID", USB_CLASS_HID); - addConstant(dict, "CLASS_PRINTER", USB_CLASS_PRINTER); - addConstant(dict, "CLASS_MASS_STORAGE", USB_CLASS_MASS_STORAGE); - addConstant(dict, "CLASS_HUB", USB_CLASS_HUB); - addConstant(dict, "CLASS_DATA", USB_CLASS_DATA); - addConstant(dict, "CLASS_VENDOR_SPEC", USB_CLASS_VENDOR_SPEC); - addConstant(dict, "DT_DEVICE", USB_DT_DEVICE); - addConstant(dict, "DT_CONFIG", USB_DT_CONFIG); - addConstant(dict, "DT_STRING", USB_DT_STRING); - addConstant(dict, "DT_INTERFACE", USB_DT_INTERFACE); - addConstant(dict, "DT_ENDPOINT", USB_DT_ENDPOINT); - addConstant(dict, "DT_HID", USB_DT_HID); - addConstant(dict, "DT_REPORT", USB_DT_REPORT); - addConstant(dict, "DT_PHYSICAL", USB_DT_PHYSICAL); - addConstant(dict, "DT_HUB", USB_DT_HUB); - addConstant(dict, "DT_DEVICE_SIZE", USB_DT_DEVICE_SIZE); - addConstant(dict, "DT_CONFIG_SIZE", USB_DT_CONFIG_SIZE); - addConstant(dict, "DT_INTERFACE_SIZE", USB_DT_INTERFACE_SIZE); - addConstant(dict, "DT_ENDPOINT_SIZE", USB_DT_ENDPOINT_SIZE); - addConstant(dict, "DT_ENDPOINT_AUDIO_SIZE", USB_DT_ENDPOINT_AUDIO_SIZE); - addConstant(dict, "DT_HUB_NONVAR_SIZE", USB_DT_HUB_NONVAR_SIZE); - addConstant(dict, "MAXENDPOINTS", USB_MAXENDPOINTS); - addConstant(dict, "ENDPOINT_ADDRESS_MASK", USB_ENDPOINT_ADDRESS_MASK); - addConstant(dict, "ENDPOINT_DIR_MASK", USB_ENDPOINT_DIR_MASK); - addConstant(dict, "ENDPOINT_TYPE_MASK", USB_ENDPOINT_TYPE_MASK); - addConstant(dict, "ENDPOINT_TYPE_CONTROL", USB_ENDPOINT_TYPE_CONTROL); - addConstant(dict, "ENDPOINT_TYPE_ISOCHRONOUS", USB_ENDPOINT_TYPE_ISOCHRONOUS); - addConstant(dict, "ENDPOINT_TYPE_BULK", USB_ENDPOINT_TYPE_BULK); - addConstant(dict, "ENDPOINT_TYPE_INTERRUPT", USB_ENDPOINT_TYPE_INTERRUPT); - addConstant(dict, "MAXINTERFACES", USB_MAXINTERFACES); - addConstant(dict, "MAXALTSETTING", USB_MAXALTSETTING); - addConstant(dict, "MAXCONFIG", USB_MAXCONFIG); - addConstant(dict, "REQ_GET_STATUS", USB_REQ_GET_STATUS); - addConstant(dict, "REQ_CLEAR_FEATURE", USB_REQ_CLEAR_FEATURE); - addConstant(dict, "REQ_SET_FEATURE", USB_REQ_SET_FEATURE); - addConstant(dict, "REQ_SET_ADDRESS", USB_REQ_SET_ADDRESS); - addConstant(dict, "REQ_GET_DESCRIPTOR", USB_REQ_GET_DESCRIPTOR); - addConstant(dict, "REQ_SET_DESCRIPTOR", USB_REQ_SET_DESCRIPTOR); - addConstant(dict, "REQ_GET_CONFIGURATION", USB_REQ_GET_CONFIGURATION); - addConstant(dict, "REQ_SET_CONFIGURATION", USB_REQ_SET_CONFIGURATION); - addConstant(dict, "REQ_GET_INTERFACE", USB_REQ_GET_INTERFACE); - addConstant(dict, "REQ_SET_INTERFACE", USB_REQ_SET_INTERFACE); - addConstant(dict, "REQ_SYNCH_FRAME", USB_REQ_SYNCH_FRAME); - addConstant(dict, "TYPE_STANDARD", USB_TYPE_STANDARD); - addConstant(dict, "TYPE_CLASS", USB_TYPE_CLASS); - addConstant(dict, "TYPE_VENDOR", USB_TYPE_VENDOR); - addConstant(dict, "TYPE_RESERVED", USB_TYPE_RESERVED); - addConstant(dict, "RECIP_DEVICE", USB_RECIP_DEVICE); - addConstant(dict, "RECIP_INTERFACE", USB_RECIP_INTERFACE); - addConstant(dict, "RECIP_ENDPOINT", USB_RECIP_ENDPOINT); - addConstant(dict, "RECIP_OTHER", USB_RECIP_OTHER); - addConstant(dict, "ENDPOINT_IN", USB_ENDPOINT_IN); - addConstant(dict, "ENDPOINT_OUT", USB_ENDPOINT_OUT); - addConstant(dict, "ERROR_BEGIN", USB_ERROR_BEGIN); -} - -/* - * Earlier versions of the PyUSB separate direction bit and - * endpoint address with direction and address fields... - * Windows version of the libusb does need direction - * bit in endpoint address to works fine. - * Thanks to Ray Schumacher. - */ -PYUSB_STATIC PyMemberDef Py_usb_Endpoint_Members[] = { - {"address", - T_UBYTE, - offsetof(Py_usb_Endpoint, address), - READONLY, - "Contains the endpoint address."}, - - {"type", - T_UBYTE, - offsetof(Py_usb_Endpoint, type), - READONLY, - "It contains one of the following values, \n" - "indicating the endpoint transfer type:\n" - "\tENDPOINT_TYPE_CONTROL\n" - "\tENDPOINT_TYPE_ISOCHRONOUS\n" - "\tENDPOINT_TYPE_BULK\n" - "\tENDPOINT_TYPE_INTERRUPT\n"}, - - {"maxPacketSize", - T_USHORT, - offsetof(Py_usb_Endpoint, maxPacketSize), - READONLY, - "The maximum number of data bytes the endpoint\n" - "can transfer in a transaction."}, - - {"interval", - T_UBYTE, - offsetof(Py_usb_Endpoint, interval), - READONLY, - "The maximum latency for polling interrupt endpoints, or\n" - "the interval for polling isochronous endpoints, or the maximum NAK\n" - "rate for high-speed bulk OUT or control endpoints."}, - - {NULL} -}; - -PYUSB_STATIC PyMethodDef Py_usb_Endpoint_Methods[] = { - {NULL, NULL} -}; - -PYUSB_STATIC PyTypeObject Py_usb_Endpoint_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "usb.Endpoint", /*tp_name*/ - sizeof(Py_usb_Endpoint), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "Endpoint descriptor object", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Py_usb_Endpoint_Methods, /* tp_methods */ - Py_usb_Endpoint_Members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, /* destructor */ -}; - -PYUSB_STATIC void set_Endpoint_fields( - Py_usb_Endpoint *endpoint, - struct usb_endpoint_descriptor *ep - ) -{ - endpoint->address = ep->bEndpointAddress; - endpoint->type = ep->bmAttributes & 3; - endpoint->maxPacketSize = ep->wMaxPacketSize; - endpoint->interval = ep->bInterval; - endpoint->refresh = ep->bRefresh; - // endpoint->synchAddress - ep->bSynchAddress; -} - -PYUSB_STATIC Py_usb_Endpoint *new_Endpoint( - struct usb_endpoint_descriptor *ep - ) -{ - Py_usb_Endpoint *endpoint; - - endpoint = PyObject_New(Py_usb_Endpoint, - &Py_usb_Endpoint_Type); - - if (endpoint && ep) - set_Endpoint_fields(endpoint, ep); - - return endpoint; -} - -PYUSB_STATIC PyMemberDef Py_usb_Interface_Members[] = { - {"interfaceNumber", - T_UBYTE, - offsetof(Py_usb_Interface, interfaceNumber), - READONLY, - "Identifies the interface."}, - - {"alternateSetting", - T_UBYTE, - offsetof(Py_usb_Interface, alternateSetting), - READONLY, - "Alternate setting number."}, - - {"interfaceClass", - T_UBYTE, - offsetof(Py_usb_Interface, interfaceClass), - READONLY, - "Similar to DeviceClass in the device descriptor, but\n" - "for devices with a class specified by the interface."}, - - {"interfaceSubClass", - T_UBYTE, - offsetof(Py_usb_Interface, interfaceSubClass), - READONLY, - "Similar to bDeviceSubClass in the device\n" - "descriptor, but for devices with a class defined by the interface."}, - - {"interfaceProtocol", - T_UBYTE, - offsetof(Py_usb_Interface, interfaceProtocol), - READONLY, - "Similar to bDeviceProtocol in the device\n" - "descriptor, but for devices whose class is defined by the interface."}, - - {"endpoints", - T_OBJECT, - offsetof(Py_usb_Interface, endpoints), - READONLY, - "Tuple with interface endpoints."}, - - {NULL} -}; - -PYUSB_STATIC void Py_usb_Interface_del( - PyObject *self - ) -{ - Py_XDECREF((PyObject *) ((Py_usb_Interface *) self)->endpoints); - PyObject_Del(self); -} - -PYUSB_STATIC PyMethodDef Py_usb_Interface_Methods[] = { - {NULL} -}; - -PYUSB_STATIC PyTypeObject Py_usb_Interface_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "usb.Interface", /*tp_name*/ - sizeof(Py_usb_Interface), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - Py_usb_Interface_del, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "Interface descriptor object", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Py_usb_Interface_Methods, /* tp_methods */ - Py_usb_Interface_Members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 /* destructor */ -}; - -PYUSB_STATIC void set_Interface_fields( - Py_usb_Interface *interface, - struct usb_interface_descriptor *i - ) -{ - u_int8_t index; - - interface->interfaceNumber = i->bInterfaceNumber; - interface->alternateSetting = i->bAlternateSetting; - interface->interfaceClass = i->bInterfaceClass; - interface->interfaceSubClass = i->bInterfaceSubClass; - interface->interfaceProtocol = i->bInterfaceProtocol; - interface->iInterface = i->iInterface; - - interface->endpoints = PyTuple_New(i->bNumEndpoints); - - if (!interface->endpoints) { - return; - } - - for (index = 0; index < i->bNumEndpoints; ++index) - PyTuple_SET_ITEM(interface->endpoints, index, - (PyObject *) new_Endpoint(i->endpoint+index)); -} - -PYUSB_STATIC Py_usb_Interface *new_Interface( - struct usb_interface_descriptor *i - ) -{ - Py_usb_Interface *interface; - - interface = PyObject_NEW(Py_usb_Interface, &Py_usb_Interface_Type); - - if (interface) { - set_Interface_fields(interface, i); - - if (PyErr_Occurred()) { - Py_XDECREF((PyObject *) interface); - return NULL; - } - } - - return interface; -} - -PYUSB_STATIC PyMemberDef Py_usb_Configuration_Members[] = { - {"totalLength", - T_USHORT, - offsetof(Py_usb_Configuration, totalLength), - READONLY, - "The number of data bytes that the device returns,\n" - "including the bytes for all of the configuration's interfaces and\n" - "endpoints."}, - - {"value", - T_UBYTE, - offsetof(Py_usb_Configuration, value), - READONLY, - "Identifies the configuration."}, - - {"selfPowered", - T_UBYTE, - offsetof(Py_usb_Configuration, selfPowered), - READONLY, - "True if the device is self powered."}, - - {"remoteWakeup", - T_UBYTE, - offsetof(Py_usb_Configuration, remoteWakeup), - READONLY, - "True if the device supports remote wakeup feature."}, - - {"maxPower", - T_UBYTE, - offsetof(Py_usb_Configuration, maxPower), - READONLY, - "Specifies the device current. This is the absolute value,\n" - "already multiplied by 2"}, - - {"interfaces", - T_OBJECT, - offsetof(Py_usb_Configuration, interfaces), - READONLY, - "Tuple with a tuple of the configuration interfaces.\n" - "Each element represents a sequence of the\n" - "alternate settings for each interface."}, - - {"iConfiguration", - T_UBYTE, - offsetof(Py_usb_Configuration, iConfiguration), - RO, - "Index to a string that describes the\n" - "configuration."}, - - {NULL} -}; - -PYUSB_STATIC PyMethodDef Py_usb_Configuration_Methods[] = { - {NULL, NULL} -}; - -PYUSB_STATIC void Py_usb_Configuration_del( - PyObject *self - ) -{ - Py_XDECREF((PyObject *) ((Py_usb_Configuration *) self)->interfaces); - PyObject_Del(self);; -} - -PYUSB_STATIC PyTypeObject Py_usb_Configuration_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "usb.Configuration", /*tp_name*/ - sizeof(Py_usb_Configuration), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - Py_usb_Configuration_del, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "Configuration descriptor object", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Py_usb_Configuration_Methods, /* tp_methods */ - Py_usb_Configuration_Members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 /* destructor */ -}; - -PYUSB_STATIC void set_Configuration_fields( - Py_usb_Configuration *configuration, - struct usb_config_descriptor *config - ) -{ - u_int8_t i, j, k; - PyObject *t1; - - configuration->totalLength = config->wTotalLength; - configuration->value = config->bConfigurationValue; - configuration->iConfiguration = config->iConfiguration; - configuration->selfPowered = (config->bmAttributes >> 6) & 1; - configuration->remoteWakeup = (config->bmAttributes >> 5) & 1; - configuration->maxPower = config->MaxPower << 2; - - configuration->interfaces = PyTuple_New(config->bNumInterfaces); - - if (!configuration->interfaces) return; - - for (i = 0; i < config->bNumInterfaces; ++i) { - k = config->interface[i].num_altsetting; - t1 = PyTuple_New(k); - - if (!t1) return; - - for (j = 0; j < k; ++j) - PyTuple_SET_ITEM(t1, j, - (PyObject *) new_Interface(config->interface[i].altsetting+j)); - - PyTuple_SET_ITEM(configuration->interfaces, i, t1); - } -} - -PYUSB_STATIC Py_usb_Configuration *new_Configuration( - struct usb_config_descriptor *conf - ) -{ - Py_usb_Configuration *configuration; - - configuration = PyObject_NEW(Py_usb_Configuration, &Py_usb_Configuration_Type); - - if (configuration) { - set_Configuration_fields(configuration, conf); - - if (PyErr_Occurred()) { - Py_DECREF((PyObject *) configuration); - return NULL; - } - } - - return configuration; -} - -PYUSB_STATIC PyMemberDef Py_usb_Device_Members[] = { - {"usbVersion", - T_STRING_INPLACE, - offsetof(Py_usb_Device, usbVersion), - READONLY, - "String containing the USB specification number that\n" - "the device and its descriptors comply with."}, - - {"deviceClass", - T_UBYTE, - offsetof(Py_usb_Device, deviceClass), - READONLY, - "For devices that belong to a class, this field may\n" - "name the class."}, - - {"deviceSubClass", - T_UBYTE, - offsetof(Py_usb_Device, deviceSubClass), - READONLY, - "For devices that belong to a class, this field may\n" - "specify a subclass within the class."}, - - {"deviceProtocol", - T_UBYTE, - offsetof(Py_usb_Device, deviceProtocol), - READONLY, - "This field may specify a protocol defined by the\n" - "selected class or subclass."}, - - {"maxPacketSize", - T_UBYTE, - offsetof(Py_usb_Device, maxPacketSize), - READONLY, - "The maximum packet size for Endpoint 0."}, - - {"idVendor", - T_USHORT, - offsetof(Py_usb_Device, idVendor), - READONLY, - "Unique vendor identifier."}, - - {"idProduct", - T_USHORT, - offsetof(Py_usb_Device, idProduct), - READONLY, - "The manufacturer assigns a Product ID to identify the\n" - "device."}, - - {"deviceVersion", - T_STRING_INPLACE, - offsetof(Py_usb_Device, deviceVersion), - READONLY, - "String containing the device's release number."}, - - {"filename", - T_STRING_INPLACE, - offsetof(Py_usb_Device, filename), - READONLY, - ""}, - - {"configurations", - T_OBJECT, - offsetof(Py_usb_Device, configurations), - READONLY, - "Tuple with the device configurations."}, - - {"iManufacturer", - T_UBYTE, - offsetof(Py_usb_Device, iManufacturer), - RO, - "An index that points to a string describing the\n" - "manufacturer."}, - - {"iProduct", - T_UBYTE, - offsetof(Py_usb_Device, iProduct), - RO, - "An index that points to a string describing the product."}, - - {"iSerialNumber", - T_UBYTE, - offsetof(Py_usb_Device, iSerialNumber), - RO, - "An index that points to a string containing the\n" - "device's serial number."}, - - {NULL} -}; - -PYUSB_STATIC PyObject *Py_usb_Device_open( - PyObject *self, - PyObject *args - ) -{ - return (PyObject *) new_DeviceHandle((Py_usb_Device *) self); -} - -PYUSB_STATIC PyMethodDef Py_usb_Device_Methods[] = { - {"open", - Py_usb_Device_open, - METH_NOARGS, - "open() -> DeviceHandle\n\n" - "Open the device for use.\n" - "Returns a DeviceHandle object."}, - - {NULL, NULL} -}; - -PYUSB_STATIC void Py_usb_Device_del( - PyObject *self - ) -{ - Py_XDECREF(((Py_usb_Device *) self)->configurations); - PyObject_Del(self);; -} - -PYUSB_STATIC PyTypeObject Py_usb_Device_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "usb.Device", /*tp_name*/ - sizeof(Py_usb_Device), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - Py_usb_Device_del, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "Device descriptor object", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Py_usb_Device_Methods, /* tp_methods */ - Py_usb_Device_Members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 /* destructor */ -}; - -PYUSB_STATIC void set_Device_fields( - Py_usb_Device *device, - struct usb_device *dev - ) -{ - struct usb_device_descriptor *desc = &dev->descriptor; - u_int8_t i; - - device->usbVersion[0] = ((desc->bcdUSB >> 12) & 0xf) + '0'; - device->usbVersion[1] = ((desc->bcdUSB >> 8) & 0xf) + '0'; - device->usbVersion[2] = '.'; - device->usbVersion[3] = ((desc->bcdUSB >> 4) & 0xf) + '0'; - device->usbVersion[4] = (desc->bcdUSB & 0xf) + '0'; - device->usbVersion[5] = '\0'; - - device->deviceVersion[0] = ((desc->bcdDevice >> 12) & 0xf) + '0'; - device->deviceVersion[1] = ((desc->bcdDevice >> 8) & 0xf) + '0'; - device->deviceVersion[2] = '.'; - device->deviceVersion[3] = ((desc->bcdDevice >> 4) & 0xf) + '0'; - device->deviceVersion[4] = (desc->bcdDevice & 0xf) + '0'; - device->deviceVersion[5] = '\0'; - - device->deviceClass = desc->bDeviceClass; - device->deviceSubClass = desc->bDeviceSubClass; - device->deviceProtocol = desc->bDeviceProtocol; - device->maxPacketSize = desc->bMaxPacketSize0; - device->idVendor = desc->idVendor; - device->idProduct = desc->idProduct; - device->iManufacturer = desc->iManufacturer; - device->iProduct = desc->iProduct; - device->iSerialNumber = desc->iSerialNumber; - strcpy(device->filename, dev->filename); - device->dev = dev; - - if (!dev->config) { - device->configurations = PyTuple_New(0); - return; - } - - device->configurations = PyTuple_New(desc->bNumConfigurations); - - if (!device->configurations) return; - - for (i = 0; i < desc->bNumConfigurations; ++i) - PyTuple_SET_ITEM(device->configurations, i, (PyObject *) new_Configuration(dev->config+i)); -} - -PYUSB_STATIC Py_usb_Device *new_Device( - struct usb_device *dev - ) -{ - Py_usb_Device *device; - - device = PyObject_NEW(Py_usb_Device, &Py_usb_Device_Type); - - if (device) { - set_Device_fields(device, dev); - - if (PyErr_Occurred()) { - Py_DECREF((PyObject *) device); - return NULL; - } - } - - return device; -} - -PYUSB_STATIC PyMemberDef Py_usb_Bus_Members[] = { - {"dirname", - T_STRING_INPLACE, - offsetof(Py_usb_Bus, dirname), - READONLY, - ""}, - - {"location", - T_UINT, - offsetof(Py_usb_Bus, location), - READONLY, - ""}, - - {"devices", - T_OBJECT, - offsetof(Py_usb_Bus, devices), - READONLY, - "Tuple with the bus devices"}, - - {NULL} -}; - -PYUSB_STATIC PyMethodDef Py_usb_Bus_Methods[] = { - {NULL, NULL} -}; - -PYUSB_STATIC void Py_usb_Bus_del( - PyObject *self - ) -{ - Py_XDECREF(((Py_usb_Bus *) self)->devices); - PyObject_Del(self); -} - -PYUSB_STATIC PyTypeObject Py_usb_Bus_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "usb.Bus", /*tp_name*/ - sizeof(Py_usb_Bus), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - Py_usb_Bus_del, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "Bus object", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Py_usb_Bus_Methods, /* tp_methods */ - Py_usb_Bus_Members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 /* destructor */ -}; - -PYUSB_STATIC Py_usb_Bus *new_Bus( - struct usb_bus *b - ) -{ - Py_usb_Bus *bus; - u_int32_t i; - struct usb_device *dev; - - bus = PyObject_NEW(Py_usb_Bus, &Py_usb_Bus_Type); - - if (bus) { - bus->location = b->location; - strcpy(bus->dirname, b->dirname); - for(dev = b->devices, i = 0; dev; dev = dev->next) ++i; - bus->devices = PyTuple_New(i); - - if(!bus->devices) { - Py_DECREF((PyObject *) bus); - return NULL; - } - - for(dev = b->devices, i=0; dev; dev = dev->next, ++i) - PyTuple_SET_ITEM(bus->devices, i, (PyObject *) new_Device(dev)); - - if (PyErr_Occurred()) { - Py_DECREF((PyObject *) bus); - bus = NULL; - } - } - - return bus; -} - -PYUSB_STATIC PyMemberDef Py_usb_DeviceHandle_Members[] = { - {NULL} -}; - -/* - * def controlMsg(requestType, request, buffer, value = 0, index = 0, timeout = 100) - */ -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_controlMsg( - PyObject *self, - PyObject *args, - PyObject *kwds - ) -{ - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - int requestType; - int request; - int value = 0; - int index = 0; - char *bytes; - PyObject *data; - int size; - int timeout = DEFAULT_TIMEOUT; - int ret; - int as_read = 0; - - static char *kwlist[] = { - "requestType", - "request", - "buffer", - "value", - "index", - "timeout", - NULL - }; - - if (!PyArg_ParseTupleAndKeywords(args, - kwds, - "iiO|iii", - kwlist, - &requestType, - &request, - &data, - &value, - &index, - &timeout)) { - return NULL; - } - - /* - * If is a number, should be a read operation... - */ - if (PyNumber_Check(data)) { - size = py_NumberAsInt(data); - if (PyErr_Occurred()) return NULL; - bytes = (char *) PyMem_Malloc(size); - if (!bytes) return NULL; - as_read = 1; - } else { - bytes = (char *) getBuffer(data, &size); - if (PyErr_Occurred()) return NULL; - } - - -#if DUMP_PARAMS - - fprintf(stderr, "controlMsg params:\n" - "\trequestType: %d\n" - "\trequest: %d\n" - "\tvalue: %d\n" - "\tindex: %d\n" - "\ttimeout: %d\n", - requestType, - request, - value, - index, - timeout); - - if (as_read) { - fprintf(stderr, "\tbuffer: %d\n", size); - } else { - fprintf(stderr, "controlMsg buffer param:\n"); - printBuffer(bytes, size); - } - -#endif /* DUMP_PARAMS */ - - Py_BEGIN_ALLOW_THREADS - ret = usb_control_msg(_self->deviceHandle, - requestType, - request, - value, - index, - bytes, - size, - timeout); - Py_END_ALLOW_THREADS - - if (ret < 0) { - PyMem_Free(bytes); - PyUSB_Error(); - return NULL; - } else if (as_read) { - PyObject *retObj = buildTuple(bytes, ret); - PyMem_Free(bytes); - return retObj; - } else { - PyMem_Free(bytes); - return PyInt_FromLong(ret); - } -} - -/* - * def setConfiguration(configuration) - */ -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_setConfiguration( - PyObject *self, - PyObject *args - ) -{ - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - int configuration; - int ret; - - if (SUPPORT_NUMBER_PROTOCOL(args)) { - configuration = (int) PyInt_AS_LONG(args); - } else if (PyObject_TypeCheck(args, &Py_usb_Configuration_Type)) { - configuration = ((Py_usb_Configuration *) args)->value; - } else { - PyErr_BadArgument(); - return NULL; - } - -#if DUMP_PARAMS - - fprintf(stderr, - "setConfiguration params:\n\tconfiguration: %d\n", - configuration); - -#endif /* DUMP_PARAMS */ - - Py_BEGIN_ALLOW_THREADS - ret = usb_set_configuration(_self->deviceHandle, configuration); - Py_END_ALLOW_THREADS - - if (ret < 0) { - PyUSB_Error(); - return NULL; - } else { - Py_RETURN_NONE; - } -} - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_claimInterface( - PyObject *self, - PyObject *args - ) -{ - int interfaceNumber; - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - if (SUPPORT_NUMBER_PROTOCOL(args)) { - interfaceNumber = py_NumberAsInt(args); - if (PyErr_Occurred()) return NULL; - } else if (PyObject_TypeCheck(args, &Py_usb_Interface_Type)) { - interfaceNumber = ((Py_usb_Interface *) args)->interfaceNumber; - } else { - PyErr_BadArgument(); - return NULL; - } - -#if DUMP_PARAMS - - fprintf(stderr, - "claimInterface params:\n\tinterfaceNumber: %d\n", - interfaceNumber); - -#endif /* DUMP_PARAMS */ - - if (usb_claim_interface(_self->deviceHandle, interfaceNumber)) { - PyUSB_Error(); - return NULL; - } else { - _self->interfaceClaimed = interfaceNumber; - } - - Py_RETURN_NONE; -} - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_detachKernelDriver( - PyObject *self, - PyObject *args - ) -{ - int interfaceNumber; - int ret; - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - if (SUPPORT_NUMBER_PROTOCOL(args)) { - interfaceNumber = py_NumberAsInt(args); - if (PyErr_Occurred()) return NULL; - } else if (PyObject_TypeCheck(args, &Py_usb_Interface_Type)) { - interfaceNumber = ((Py_usb_Interface *) args)->interfaceNumber; - } else { - PyErr_BadArgument(); - return NULL; - } - -#if DUMP_PARAMS - - fprintf(stderr, - "detachKernelDriver params:\n\tinterfaceNumber: %d\n", - interfaceNumber); - -#endif /* DUMP_PARAMS */ - -#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP - Py_BEGIN_ALLOW_THREADS - ret = usb_detach_kernel_driver_np(_self->deviceHandle, interfaceNumber); - Py_END_ALLOW_THREADS - - if (ret) { - PyUSB_Error(); - return NULL; - } -#endif - - Py_RETURN_NONE; -} - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_releaseInterface( - PyObject *self, - PyObject *args - ) -{ - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - if (-1 != _self->interfaceClaimed) { - int ret; - Py_BEGIN_ALLOW_THREADS - ret = usb_release_interface(_self->deviceHandle, _self->interfaceClaimed); - Py_END_ALLOW_THREADS - - if (ret) { - PyUSB_Error(); - return NULL; - } else { - _self->interfaceClaimed = -1; - } - } else { - PyErr_SetString(PyExc_ValueError, "No interface claimed"); - return NULL; - } - - Py_RETURN_NONE; -} - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_setAltInterface( - PyObject *self, - PyObject *args - ) -{ - int altInterface, ret; - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - if (SUPPORT_NUMBER_PROTOCOL(args)) { - altInterface = (int) py_NumberAsInt(args); - if (PyErr_Occurred()) return NULL; - } else if (PyObject_TypeCheck(args, &Py_usb_Interface_Type)) { - altInterface = ((Py_usb_Interface *) args)->alternateSetting; - } else { - PyErr_BadArgument(); - return NULL; - } - -#if DUMP_PARAMS - - fprintf(stderr, - "setAltInterface params:\n\taltInterface: %d\n", - altInterface); - -#endif /* DUMP_PARAMS */ - - Py_BEGIN_ALLOW_THREADS - ret = usb_set_altinterface(_self->deviceHandle, altInterface); - Py_END_ALLOW_THREADS - - if (ret < 0) { - PyUSB_Error(); - return NULL; - } else { - Py_RETURN_NONE; - } -} - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_bulkWrite( - PyObject *self, - PyObject *args - ) -{ - int endpoint; - int timeout = DEFAULT_TIMEOUT; - char *data; - int size; - PyObject *bytes; - int ret; - PyObject *retObj; - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - if (!PyArg_ParseTuple(args, - "iO|i", - &endpoint, - &bytes, - &timeout)) { - return NULL; - } - - data = getBuffer(bytes, &size); - if (PyErr_Occurred()) return NULL; - -#if DUMP_PARAMS - - fprintf(stderr, - "bulkWrite params:\n" - "\tendpoint: %d\n" - "\ttimeout: %d\n", - endpoint, - timeout); - - fprintf(stderr, "bulkWrite buffer param:\n"); - printBuffer(data, size); - -#endif /* DUMP_PARAMS */ - - Py_BEGIN_ALLOW_THREADS - ret = usb_bulk_write(_self->deviceHandle, endpoint, data, size, timeout); - Py_END_ALLOW_THREADS - - PyMem_Free(data); - - if (ret < 0) { - PyUSB_Error(); - return NULL; - } else { - retObj = PyInt_FromLong(ret); - } - - return retObj; -} - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_bulkRead( - PyObject *self, - PyObject *args - ) -{ - int endpoint; - int timeout = DEFAULT_TIMEOUT; - char *buffer; - int size; - PyObject *ret; - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - if (!PyArg_ParseTuple(args, - "ii|i", - &endpoint, - &size, - &timeout)) { - return NULL; - } - -#if DUMP_PARAMS - - fprintf(stderr, - "bulkRead params:\n" - "\tendpoint: %d\n" - "\tsize: %d\n" - "\ttimeout: %d\n", - endpoint, - size, - timeout); - -#endif /* DUMP_PARAMS */ - - buffer = (char *) PyMem_Malloc(size); - if (!buffer) return NULL; - - Py_BEGIN_ALLOW_THREADS - size = usb_bulk_read(_self->deviceHandle, endpoint, buffer, size, timeout); - Py_END_ALLOW_THREADS - - if (size < 0) { - PyMem_Free(buffer); - PyUSB_Error(); - return NULL; - } else { - ret = buildTuple(buffer, size); - PyMem_Free(buffer); - } - - return ret; -} - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_interruptWrite( - PyObject *self, - PyObject *args - ) -{ - int endpoint; - int timeout = DEFAULT_TIMEOUT; - char *data; - int size; - PyObject *bytes; - int ret; - PyObject *retObj; - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - if (!PyArg_ParseTuple(args, - "iO|i", - &endpoint, - &bytes, - &timeout)) { - return NULL; - } - - data = getBuffer(bytes, &size); - if (PyErr_Occurred()) return NULL; - -#if DUMP_PARAMS - - fprintf(stderr, - "interruptWrite params:\n" - "\tendpoint: %d\n" - "\ttimeout: %d\n", - endpoint, - timeout); - - fprintf(stderr, "interruptWrite buffer param:\n"); - printBuffer(data, size); - -#endif /* DUMP_PARAMS */ - - Py_BEGIN_ALLOW_THREADS - ret = usb_interrupt_write(_self->deviceHandle, endpoint, data, size, timeout); - Py_END_ALLOW_THREADS - - PyMem_Free(data); - - if (ret < 0) { - PyUSB_Error(); - return NULL; - } else { - retObj = PyInt_FromLong(ret); - } - - return retObj; -} - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_interruptRead( - PyObject *self, - PyObject *args - ) -{ - int endpoint; - int timeout = DEFAULT_TIMEOUT; - char *buffer; - int size; - PyObject *ret; - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - if (!PyArg_ParseTuple(args, - "ii|i", - &endpoint, - &size, - &timeout)) { - return NULL; - } - -#if DUMP_PARAMS - - fprintf(stderr, - "interruptRead params:\n" - "\tendpoint: %d\n" - "\tsize: %d\n" - "\ttimeout: %d\n", - endpoint, - size, - timeout); - -#endif /* DUMP_PARAMS */ - - buffer = (char *) PyMem_Malloc(size); - if (!buffer) return NULL; - - Py_BEGIN_ALLOW_THREADS - size = usb_interrupt_read(_self->deviceHandle, endpoint, buffer, size, timeout); - Py_END_ALLOW_THREADS - - if (size < 0) { - PyMem_Free(buffer); - PyUSB_Error(); - return NULL; - } else { - ret = buildTuple(buffer, size); - PyMem_Free(buffer); - } - - return ret; -} - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_resetEndpoint( - PyObject *self, - PyObject *args - ) -{ - int endpoint, ret; - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - endpoint = py_NumberAsInt(args); - if (PyErr_Occurred()) return NULL; - -#if DUMP_PARAMS - - fprintf(stderr, - "resetEndpoint params:\n" - "\tendpoint: %d\n", - endpoint); - -#endif /* DUMP_PARAMS */ - Py_BEGIN_ALLOW_THREADS - ret = usb_resetep(_self->deviceHandle, endpoint); - Py_END_ALLOW_THREADS - - if (ret) { - PyUSB_Error(); - return NULL; - } else { - Py_RETURN_NONE; - } -} - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_reset( - PyObject *self, - PyObject *args - ) -{ - int ret; - - Py_BEGIN_ALLOW_THREADS - ret = usb_reset(((Py_usb_DeviceHandle *) self)->deviceHandle); - Py_END_ALLOW_THREADS - - if (ret) { - PyUSB_Error(); - return NULL; - } else { - Py_RETURN_NONE; - } -} - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_clearHalt( - PyObject *self, - PyObject *args - ) -{ - int endpoint, ret; - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - endpoint = py_NumberAsInt(args); - if (PyErr_Occurred()) return NULL; - -#if DUMP_PARAMS - - fprintf(stderr, - "clearHalt params:\n" - "\tendpoint: %d\n", - endpoint); - -#endif /* DUMP_PARAMS */ - - Py_BEGIN_ALLOW_THREADS - ret = usb_clear_halt(_self->deviceHandle, endpoint); - Py_END_ALLOW_THREADS - - if (ret) { - PyUSB_Error(); - return NULL; - } else { - Py_RETURN_NONE; - } -} - -/* - * def getString(index, len, langid = -1) - */ -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_getString( - PyObject *self, - PyObject *args - ) -{ - int langid=-1, index; - unsigned long len; - PyObject *retStr; - char *buffer; - int ret; - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - if (!PyArg_ParseTuple(args, - "ik|i", - &index, - &len, - &langid)) { - return NULL; - } - -#if DUMP_PARAMS - - fprintf(stderr, - "getString params:\n" - "\tindex: %d\n" - "\tlen: %lu\n" - "\tlangid: %d\n", - index, - len, - langid); - -#endif /* DUMP_PARAMS */ - - ++len; /* for NULL termination */ - buffer = (char *) PyMem_Malloc(len); - if (!buffer) return NULL; - - Py_BEGIN_ALLOW_THREADS - - if (-1 == langid) { - ret = usb_get_string_simple(_self->deviceHandle, index, buffer, len); - } else { - ret = usb_get_string(_self->deviceHandle, index, langid, buffer, len); - } - - Py_END_ALLOW_THREADS - - if (ret < 0) { - PyMem_Free(buffer); - PyUSB_Error(); - return NULL; - } - - retStr = PyString_FromStringAndSize(buffer, ret); - PyMem_Free(buffer); - return retStr; -} - -/* - * def getDescriptor(type, index, len, endpoint = -1) - */ -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_getDescriptor( - PyObject *self, - PyObject *args - ) -{ - int endpoint=-1, type, index; - int len; - PyObject *retSeq; - char *buffer; - int ret; - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - - if (!PyArg_ParseTuple(args, - "iii|i", - &type, - &index, - &len, - &endpoint)) { - return NULL; - } - -#if DUMP_PARAMS - - fprintf(stderr, - "getDescriptor params:\n" - "ttype: %d\n" - "\tindex: %d\n" - "\tlen: %d\n" - "\tendpoint: %d\n", - type, - index, - len, - endpoint); - -#endif /* DUMP_PARAMS */ - - buffer = (char *) PyMem_Malloc(len); - if (!buffer) return NULL; - - Py_BEGIN_ALLOW_THREADS - - if (-1 == endpoint) { - ret = usb_get_descriptor(_self->deviceHandle, type, index, buffer, len); - } else { - ret = usb_get_descriptor_by_endpoint(_self->deviceHandle, endpoint, type, index, buffer, len); - } - - Py_END_ALLOW_THREADS - - if (ret < 0) { - PyMem_Free(buffer); - PyUSB_Error(); - return NULL; - } - - retSeq = buildTuple(buffer, ret); - PyMem_Free(buffer); - return retSeq; -} - -PYUSB_STATIC PyMethodDef Py_usb_DeviceHandle_Methods[] = { - {"controlMsg", - (PyCFunction) Py_usb_DeviceHandle_controlMsg, - METH_VARARGS | METH_KEYWORDS, - "controlMsg(requestType, request, buffer, value=0, index=0, timeout=100) -> bytesWritten|buffer\n\n" - "Performs a control request to the default control pipe on a device.\n" - "Arguments:\n" - "\trequestType: specifies the direction of data flow, the type\n" - "\t of request, and the recipient.\n" - "\trequest: specifies the request.\n" - "\tbuffer: if the transfer is a write transfer, buffer is a sequence \n" - "\t with the transfer data, otherwise, buffer is the number of\n" - "\t bytes to read.\n" - "\tvalue: specific information to pass to the device. (default: 0)\n" - "\tindex: specific information to pass to the device. (default: 0)\n" - "\ttimeout: operation timeout in miliseconds. (default: 100)\n" - "Returns the number of bytes written."}, - - {"setConfiguration", - Py_usb_DeviceHandle_setConfiguration, - METH_O, - "setConfiguration(configuration) -> None\n\n" - "Sets the active configuration of a device.\n" - "Arguments:\n" - "\tconfiguration: a configuration value or a Configuration object."}, - - {"claimInterface", - Py_usb_DeviceHandle_claimInterface, - METH_O, - "claimInterface(interface) -> None\n\n" - "Claims the interface with the Operating System.\n" - "Arguments:\n" - "\tinterface: interface number or an Interface object."}, - - {"detachKernelDriver", - Py_usb_DeviceHandle_detachKernelDriver, - METH_O, - "detachKernelDriver(interface) -> None\n\n" - "Detaches a kernel driver from the interface (if one is attached,\n" - "we have permission and the operation is supported by the OS)\n" - "Arguments:\n" - "\tinterface: interface number or an Interface object."}, - - {"releaseInterface", - Py_usb_DeviceHandle_releaseInterface, - METH_NOARGS, - "releaseInterface() -> None\n\n" - "Releases an interface previously claimed with claimInterface."}, - - {"setAltInterface", - Py_usb_DeviceHandle_setAltInterface, - METH_O, - "setAltInterface(alternate) -> None\n\n" - "Sets the active alternate setting of the current interface.\n" - "Arguments:\n" - "\talternate: an alternate setting number or an Interface object."}, - - {"bulkWrite", - Py_usb_DeviceHandle_bulkWrite, - METH_VARARGS, - "bulkWrite(endpoint, buffer, timeout=100) -> bytesWritten\n\n" - "Performs a bulk write request to the endpoint specified.\n" - "Arguments:\n" - "\tendpoint: endpoint number.\n" - "\tbuffer: sequence data buffer to write.\n" - "\t This parameter can be any sequence type\n" - "\ttimeout: operation timeout in miliseconds. (default: 100)\n" - "Returns the number of bytes written."}, - - {"bulkRead", - Py_usb_DeviceHandle_bulkRead, - METH_VARARGS, - "bulkRead(endpoint, size, timeout=100) -> buffer\n\n" - "Performs a bulk read request to the endpoint specified.\n" - "Arguments:\n" - "\tendpoint: endpoint number.\n" - "\tsize: number of bytes to read.\n" - "\ttimeout: operation timeout in miliseconds. (default: 100)\n" - "Returns a tuple with the data read."}, - - {"interruptWrite", - Py_usb_DeviceHandle_interruptWrite, - METH_VARARGS, - "interruptWrite(endpoint, buffer, timeout=100) -> bytesWritten\n\n" - "Performs a interrupt write request to the endpoint specified.\n" - "Arguments:\n" - "\tendpoint: endpoint number.\n" - "\tbuffer: sequence data buffer to write.\n" - "\t This parameter can be any sequence type\n" - "\ttimeout: operation timeout in miliseconds. (default: 100)\n" - "Returns the number of bytes written."}, - - {"interruptRead", - Py_usb_DeviceHandle_interruptRead, - METH_VARARGS, - "interruptRead(endpoint, size, timeout=100) -> buffer\n\n" - "Performs a interrupt read request to the endpoint specified.\n" - "Arguments:\n" - "\tendpoint: endpoint number.\n" - "\tsize: number of bytes to read.\n" - "\ttimeout: operation timeout in miliseconds. (default: 100)\n" - "Returns a tuple with the data read."}, - - {"resetEndpoint", - Py_usb_DeviceHandle_resetEndpoint, - METH_O, - "resetEndpoint(endpoint) -> None\n\n" - "Resets all state (like toggles) for the specified endpoint.\n" - "Arguments:\n" - "\tendpoint: endpoint number.\n"}, - - {"reset", - Py_usb_DeviceHandle_reset, - METH_NOARGS, - "reset() -> None\n\n" - "Resets the specified device by sending a RESET\n" - "down the port it is connected to.\n"}, - - {"clearHalt", - Py_usb_DeviceHandle_clearHalt, - METH_O, - "clearHalt(endpoint) -> None\n\n" - "Clears any halt status on the specified endpoint.\n" - "Arguments:\n" - "\tendpoint: endpoint number.\n"}, - - {"getString", - Py_usb_DeviceHandle_getString, - METH_VARARGS, - "getString(index, len, langid = -1) -> string\n\n" - "Retrieves the string descriptor specified by index\n" - "and langid from a device.\n" - "Arguments:\n" - "\tindex: index of descriptor in the device.\n" - "\tlen: number of bytes of the string\n" - "\tlangid: Language ID. If it is omittedi, will be\n" - "\t used the first language.\n"}, - - {"getDescriptor", - Py_usb_DeviceHandle_getDescriptor, - METH_VARARGS, - "getDescriptor(type, index, len, endpoint = -1) -> descriptor\n\n" - "Retrieves a descriptor from the device identified by the type\n" - "and index of the descriptor.\n" - "Arguments:\n" - "\ttype: descriptor type.\n" - "\tindex: index of the descriptor.\n" - "\tlen: descriptor length.\n" - "\tendpoint: endpoint number from descriptor is read. If it is\n" - "\t omitted, the descriptor is read from default control pipe.\n"}, - - {NULL, NULL} -}; - -PYUSB_STATIC void Py_usb_DeviceHandle_del( - PyObject *self - ) -{ - Py_usb_DeviceHandle *_self = (Py_usb_DeviceHandle *) self; - struct usb_dev_handle *h = _self->deviceHandle; - - if (h) { - if (-1 != _self->interfaceClaimed) { - usb_release_interface(_self->deviceHandle, - _self->interfaceClaimed); - } - - usb_close(_self->deviceHandle); - } - - PyObject_Del(self); -} - -PYUSB_STATIC PyTypeObject Py_usb_DeviceHandle_Type = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "usb.DeviceHandle", /*tp_name*/ - sizeof(Py_usb_DeviceHandle), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - Py_usb_DeviceHandle_del, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "DeviceHandle object", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Py_usb_DeviceHandle_Methods, /* tp_methods */ - Py_usb_DeviceHandle_Members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 /* destructor */ -}; - -PYUSB_STATIC Py_usb_DeviceHandle *new_DeviceHandle( - Py_usb_Device *device - ) -{ - Py_usb_DeviceHandle *dh; - struct usb_dev_handle *h; - - dh = PyObject_NEW(Py_usb_DeviceHandle, &Py_usb_DeviceHandle_Type); - - if (dh) { - h = usb_open(device->dev); - - if (!h) { - PyUSB_Error(); - Py_DECREF((PyObject *) dh); - return NULL; - } - - dh->deviceHandle = h; - dh->interfaceClaimed = -1; - } - - return dh; -} - -/* - * Global functions - */ - -PYUSB_STATIC PyObject *busses( - PyObject *self, - PyObject *args - ) -{ - PyObject *tuple; - struct usb_bus *bus, *b; - u_int32_t i; - - if (usb_find_busses() < 0) { - PyUSB_Error(); - return NULL; - } - - if (usb_find_devices() < 0) { - PyUSB_Error(); - return NULL; - } - - bus = usb_get_busses(); - - if (!bus) { - PyUSB_Error(); - return NULL; - } - - for(i=0,b=bus;b;b=b->next) ++i; - tuple = PyTuple_New(i); - if (!tuple) return NULL; - - for(b=bus,i=0;b;++i,b=b->next) - PyTuple_SET_ITEM(tuple, i, (PyObject *) new_Bus(b)); - - if (PyErr_Occurred()) { - Py_DECREF(tuple); - return NULL; - } - - return tuple; -} - -PYUSB_STATIC PyMethodDef usb_Methods[] = { - {"busses", busses, METH_NOARGS, "Returns a tuple with the usb busses"}, - {NULL, NULL} -}; - -#ifndef PyMODINIT_FUNC -#define PyMODINIT_FUNC void -#endif /* PyMODINIT_FUNC */ - -/* - * Entry point for the module - */ -PyMODINIT_FUNC initusb(void) -{ - PyObject *module; - - module = Py_InitModule3("usb", usb_Methods,"USB access module"); - if (!module) return; - - PyExc_USBError = PyErr_NewException("usb.USBError", PyExc_IOError, NULL); - if (!PyExc_USBError) return; - PyModule_AddObject(module, "USBError", PyExc_USBError); - Py_INCREF(PyExc_USBError); - - if (PyType_Ready(&Py_usb_Endpoint_Type) < 0) return; - Py_INCREF(&Py_usb_Endpoint_Type); - PyModule_AddObject(module, "Endpoint", (PyObject *) &Py_usb_Endpoint_Type); - - if (PyType_Ready(&Py_usb_Interface_Type) < 0) return; - Py_INCREF(&Py_usb_Interface_Type); - PyModule_AddObject(module, "Interface", (PyObject *) &Py_usb_Interface_Type); - - if (PyType_Ready(&Py_usb_Configuration_Type) < 0) return; - Py_INCREF(&Py_usb_Configuration_Type); - PyModule_AddObject(module, "Configuration", (PyObject *) &Py_usb_Configuration_Type); - - if (PyType_Ready(&Py_usb_Device_Type) < 0) return; - Py_INCREF(&Py_usb_Device_Type); - PyModule_AddObject(module, "Device", (PyObject *) &Py_usb_Device_Type); - - if (PyType_Ready(&Py_usb_Bus_Type) < 0) return; - Py_INCREF(&Py_usb_Bus_Type); - PyModule_AddObject(module, "Bus", (PyObject *) &Py_usb_Bus_Type); - - if (PyType_Ready(&Py_usb_DeviceHandle_Type) < 0) return; - Py_INCREF(&Py_usb_DeviceHandle_Type); - PyModule_AddObject(module, "DeviceHandle", (PyObject *) &Py_usb_DeviceHandle_Type); - - installModuleConstants(module); - - usb_init(); -} - -/* - * vim:ts=4 - */ diff --git a/tools/pyusb/pyusb.h b/tools/pyusb/pyusb.h deleted file mode 100644 index 785198e..0000000 --- a/tools/pyusb/pyusb.h +++ /dev/null @@ -1,248 +0,0 @@ -#ifndef __pyusb_h__ -#define __pyusb_h__ - -#include -#include -#include -#ifdef unix -#include -#include -#endif /* unix */ -#if 0 /* defined _WIN32 */ -/* - * I were having many problems trying compile with windows.h - * because the Visual C++ .NET language extensions - */ -#include -#endif /* _WIN32 */ - -#define STRING_ARRAY_SIZE 256 - -#define PYUSB_STATIC static - -#if defined _WIN32 && !defined unix - -#ifndef u_int8_t -typedef unsigned char u_int8_t; -#endif /* u_int8_t */ - -#ifndef u_int16_t -typedef unsigned short int u_int16_t; -#endif /* u_int16_t */ - -#ifndef u_int32_t -typedef unsigned long u_int32_t; -#endif /* u_int32_t */ - -#ifndef PATH_MAX -#define PATH_MAX 255 -#endif /* PATH_MAX */ - -#endif /* _WIN32 */ - -/* - * EndpointDescriptor object - */ -typedef struct _Py_usb_Endpoint { - PyObject_HEAD - u_int8_t address; - u_int8_t type; - u_int16_t maxPacketSize; - u_int8_t interval; - u_int8_t refresh; -} Py_usb_Endpoint; - - -/* - * Interface Object - */ -typedef struct _Py_usb_Interface { - PyObject_HEAD - u_int8_t interfaceNumber; - u_int8_t alternateSetting; - u_int8_t interfaceClass; - u_int8_t interfaceSubClass; - u_int8_t interfaceProtocol; - u_int8_t iInterface; - PyObject *endpoints; -} Py_usb_Interface; - -/* - * Configuration object - */ -typedef struct _Py_usb_Configuration { - PyObject_HEAD - u_int16_t totalLength; - u_int8_t value; - u_int8_t iConfiguration; - u_int8_t selfPowered; - u_int8_t remoteWakeup; - u_int16_t maxPower; - PyObject *interfaces; -} Py_usb_Configuration; - -/* - * Device object - */ -typedef struct _Py_usb_Device { - PyObject_HEAD - char usbVersion[STRING_ARRAY_SIZE]; - u_int8_t deviceClass; - u_int8_t deviceSubClass; - u_int8_t deviceProtocol; - u_int8_t maxPacketSize; - u_int16_t idVendor; - u_int16_t idProduct; - char deviceVersion[STRING_ARRAY_SIZE]; - u_int8_t iManufacturer; - u_int8_t iProduct; - u_int8_t iSerialNumber; - char filename[PATH_MAX + 1]; - PyObject *configurations; - struct usb_device *dev; // necessary for usb_open -} Py_usb_Device; - -/* - * Bus Object - */ -typedef struct _Py_usb_Bus { - PyObject_HEAD - char dirname[PATH_MAX + 1]; - u_int32_t location; - PyObject *devices; -} Py_usb_Bus; - -/* - * DeviceHandle object - */ -typedef struct _Py_usb_DeviceHandle { - PyObject_HEAD - usb_dev_handle *deviceHandle; - int interfaceClaimed; -} Py_usb_DeviceHandle; - -/* - * Functions prototypes - */ - -PYUSB_STATIC void set_Endpoint_fields( - Py_usb_Endpoint *endpoint, - struct usb_endpoint_descriptor *ep - ); - -PYUSB_STATIC Py_usb_Endpoint *new_Endpoint( - struct usb_endpoint_descriptor *ep - ); - -PYUSB_STATIC void set_Interface_fields( - Py_usb_Interface *interface, - struct usb_interface_descriptor *i - ); - -PYUSB_STATIC Py_usb_Interface *new_Interface( - struct usb_interface_descriptor *i - ); - -PYUSB_STATIC void set_Configuration_fields( - Py_usb_Configuration *configuration, - struct usb_config_descriptor *config - ); - -PYUSB_STATIC Py_usb_Configuration *new_Configuration( - struct usb_config_descriptor *conf - ); - -PYUSB_STATIC PyObject *Py_usb_Device_open( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC void set_Device_fields( - Py_usb_Device *device, - struct usb_device *dev - ); - -PYUSB_STATIC Py_usb_Device *new_Device( - struct usb_device *dev - ); - -PYUSB_STATIC Py_usb_Bus *new_Bus( - struct usb_bus *b - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_controlMsg( - PyObject *self, - PyObject *args, - PyObject *kwds - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_setConfiguration( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_claimInterface( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_detachKernelDriver( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_releaseInterface( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_setAltInterface( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_bulkWrite( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_bulkRead( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_interruptWrite( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_interruptRead( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_resetEndpoint( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_reset( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC PyObject *Py_usb_DeviceHandle_clearHalt( - PyObject *self, - PyObject *args - ); - -PYUSB_STATIC Py_usb_DeviceHandle *new_DeviceHandle( - Py_usb_Device *device - ); - -PYUSB_STATIC PyObject *busses( - PyObject *self, - PyObject *args - ); - -#endif /* __pyusb_h__ */ diff --git a/tools/pyusb/pyusb.sln b/tools/pyusb/pyusb.sln deleted file mode 100644 index c5ff699..0000000 --- a/tools/pyusb/pyusb.sln +++ /dev/null @@ -1,19 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyusb", "pyusb.vcproj", "{D59C735D-D69F-42BD-8664-3CA8BC1CED3C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D59C735D-D69F-42BD-8664-3CA8BC1CED3C}.Debug|Win32.ActiveCfg = Debug|Win32 - {D59C735D-D69F-42BD-8664-3CA8BC1CED3C}.Debug|Win32.Build.0 = Debug|Win32 - {D59C735D-D69F-42BD-8664-3CA8BC1CED3C}.Release|Win32.ActiveCfg = Release|Win32 - {D59C735D-D69F-42BD-8664-3CA8BC1CED3C}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/tools/pyusb/samples/usbenum.py b/tools/pyusb/samples/usbenum.py deleted file mode 100644 index 6f3972a..0000000 --- a/tools/pyusb/samples/usbenum.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -# -# Enumerate usb devices -# -#Copyright 2005 - 2007 Wander Lairson Costa - -import usb - -busses = usb.busses() - -for bus in busses: - devices = bus.devices - for dev in devices: - print "Device:", dev.filename - print " Device class:",dev.deviceClass - print " Device sub class:",dev.deviceSubClass - print " Device protocol:",dev.deviceProtocol - print " Max packet size:",dev.maxPacketSize - print " idVendor:",dev.idVendor - print " idProduct:",dev.idProduct - print " Device Version:",dev.deviceVersion - for config in dev.configurations: - print " Configuration:", config.value - print " Total length:", config.totalLength - print " selfPowered:", config.selfPowered - print " remoteWakeup:", config.remoteWakeup - print " maxPower:", config.maxPower - for intf in config.interfaces: - print " Interface:",intf[0].interfaceNumber - for alt in intf: - print " Alternate Setting:",alt.alternateSetting - print " Interface class:",alt.interfaceClass - print " Interface sub class:",alt.interfaceSubClass - print " Interface protocol:",alt.interfaceProtocol - for ep in alt.endpoints: - print " Endpoint:",hex(ep.address) - print " Type:",ep.type - print " Max packet size:",ep.maxPacketSize - print " Interval:",ep.interval - diff --git a/tools/pyusb/samples/usbprint.py b/tools/pyusb/samples/usbprint.py deleted file mode 100644 index 04ee7c0..0000000 --- a/tools/pyusb/samples/usbprint.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python - -""" -Provides an interface to USB Printer Class devices. -""" - -import usb -import types - -PRINTER_CLASS = 0x07 -PRINTER_SUBCLASS = 0x01 -UNIDIRECTIONAL_PROTOCOL = 0x01 -BIDIRECTIONAL_PROTOCOL = 0x02 -IEEE1284_4_PROTOCOL = 0x03 -VENDOR_PROTOCOL = 0xff - -class Printer: - def __init__(self, device, configuration, interface): - """ - __init__(device, configuration, interface) -> None - - Initialize the device. - device: printer usb.Device object. - configuration: printer usb.Configuration object of the Device or configuration number. - interface: printer usb.Interface object representing the - interface and altenate setting. - - """ - if PRINTER_CLASS != interface.interfaceClass: - raise TypeError, "Wrong interface class" - - self.__devhandle = device.open() - self.__devhandle.setConfiguration(configuration) - self.__devhandle.claimInterface(interface) - self.__devhandle.setAltInterface(interface) - - self.__intf = interface.interfaceNumber - self.__alt = interface.alternateSetting - - self.__conf = (type(configuration) == types.IntType \ - or type(configuration) == types.LongType) and \ - configuration or \ - configuration.value - - # initialize members - # TODO: automatic endpoints detection - self.__bulkout = 1 - self.__bulkin = 0x82 - - def __del__(self): - try: - self.__devhandle.releaseInterface(self.__intf) - del self.__devhandle - except: - pass - - def getDeviceID(self, maxlen, timeout = 100): - """ - getDeviceID(maxlen, timeout = 100) -> device_id - - Get the device capabilities information. - maxlen: maxlength of the buffer. - timeout: operation timeout. - """ - return self.__devhandle.controlMsg(requestType = 0xa1, - request = 0, - value = self.__conf - 1, - index = self.__alt + (self.__intf << 8), - buffer = maxlen, - timeout = timeout) - - def getPortStatus(self, timeout = 100): - """ - getPortStatus(timeout = 100) -> status - - Get the port status. - timeout: operation timeout. - """ - return self.__devhandle.controlMsg(requestType = 0xa1, - request = 1, - value = 0, - index = self.__intf, - buffer = 1, - timeout = timeout)[0] - - def softReset(self, timeout = 100): - """ - softReset(timeout = 100) -> None - - Request flushes all buffers and resets the Bulk OUT - and Bulk IN pipes to their default states. - timeout: the operation timeout. - """ - self.__devhandle.controlMsg(requestType = 0x21, - request = 2, - value = 0, - index = self.__intf, - buffer = 0) - - - def write(self, buffer, timeout = 100): - """ - write(buffer, timeout = 100) -> written - - Write data to printer. - buffer: data buffer. - timeout: operation timeout. - """ - return self.__devhandle.bulkWrite(self.__bulkout, - buffer, - timeout) - - def read(self, numbytes, timeout = 100): - """ - read(numbytes, timeout = 100) -> data - - Read data from printer. - numbytes: number of bytes to read. - timeout: operation timeout. - """ - return self.__devhandle.bulkRead(self.__bulkin, - numbytes, - timeout) - - diff --git a/tools/pyusb/setup.py b/tools/pyusb/setup.py deleted file mode 100644 index 7ea5ce2..0000000 --- a/tools/pyusb/setup.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -# PyUSB setup script -# -# Copyright 2005 - 2007 Wander Lairson Costa - -from distutils.core import setup, Extension -import sys - -extra_link_args = [] -extra_compile_args = [] -platform = sys.platform.lower() -libraries = ["usb"] - -# necessary to work fine in MacOS -# many thanks to Damian Staniforth! :-) -if -1 != platform.find("mac"): - extra_link_args = ['-framework', - 'CoreFoundation', - '-framework', - 'IOKit'] -elif -1 != platform.find("win32"): - libraries = ["libusb"] -# necessary to work fine in darwin -# Many thanks to James Barabas! -elif -1 != platform.find("darwin"): - extra_link_args = ['-framework', - 'CoreFoundation', - '-framework', - 'IOKit', - '-L/opt/local/lib'] - extra_compile_args = ['-I/opt/local/include'] -# Juha Torkkel has reported problems compiling on freebsd -# when libusb is in /usr/local tree. I don't know on freebsd, but -# on Linux the paths to usr/local are in $PATH. -# Thanks Juha... ;) -elif -1 != platform.find("freebsd"): - extra_link_args = ['-L/usr/local/lib'] - extra_compile_args = ['-I/usr/local/include'] - - -usbmodule = Extension(name = 'usb', - libraries = libraries, - sources = ['pyusb.c'], - extra_link_args = extra_link_args, - extra_compile_args = extra_compile_args, - depends = ['pyusb.h']) - -setup(name = 'pyusb', - version = '0.4.1', - description = "USB access extension module", - long_description = - """ - PyUSB provides easy USB access to python. - The module contains classes and methods to - support the most USB operations. - """, - author = 'Wander Lairson Costa', - author_email = 'wander.lairson@gmail.com', - url = 'http://pyusb.berlios.de', - license = 'BSD', - ext_modules = [usbmodule]) - -# vim:ts=4