summaryrefslogtreecommitdiffstats
path: root/firmware/usbdrv
diff options
context:
space:
mode:
authorcpldcpu <cpldcpu@gmail.com>2013-11-04 00:22:17 +0100
committercpldcpu <cpldcpu@gmail.com>2013-11-04 00:22:17 +0100
commitf3456ea1cfc56ebfa1fcea33be93856c0a71df37 (patch)
tree40fdff10bbd1bb0229cbb27062790ea87a18c041 /firmware/usbdrv
parent5b7617bfb1763f14a9e1e8792447d75cd076d2fa (diff)
downloadmicronucleus-f3456ea1cfc56ebfa1fcea33be93856c0a71df37.tar.gz
micronucleus-f3456ea1cfc56ebfa1fcea33be93856c0a71df37.tar.bz2
micronucleus-f3456ea1cfc56ebfa1fcea33be93856c0a71df37.zip
Updated USB Driver, nanite, oscal
Diffstat (limited to 'firmware/usbdrv')
-rw-r--r--firmware/usbdrv/Changelog.txt21
-rw-r--r--firmware/usbdrv/CommercialLicense.txt10
-rw-r--r--firmware/usbdrv/USB-ID-FAQ.txt6
-rw-r--r--firmware/usbdrv/USB-IDs-for-free.txt16
-rw-r--r--firmware/usbdrv/asmcommon.inc1
-rw-r--r--firmware/usbdrv/oddebug.c1
-rw-r--r--firmware/usbdrv/oddebug.h1
-rw-r--r--firmware/usbdrv/usbconfig-prototype.h10
-rw-r--r--firmware/usbdrv/usbdrv.c31
-rw-r--r--firmware/usbdrv/usbdrv.h37
-rw-r--r--firmware/usbdrv/usbdrvasm.S50
-rw-r--r--firmware/usbdrv/usbdrvasm.asm1
-rw-r--r--firmware/usbdrv/usbdrvasm12.inc45
-rw-r--r--firmware/usbdrv/usbdrvasm128.inc1
-rw-r--r--firmware/usbdrv/usbdrvasm15.inc1
-rw-r--r--firmware/usbdrv/usbdrvasm16.inc1
-rw-r--r--firmware/usbdrv/usbdrvasm165.inc43
-rw-r--r--firmware/usbdrv/usbdrvasm18-crc.inc1
-rw-r--r--firmware/usbdrv/usbdrvasm20.inc1
-rw-r--r--firmware/usbdrv/usbportability.h1
20 files changed, 119 insertions, 160 deletions
diff --git a/firmware/usbdrv/Changelog.txt b/firmware/usbdrv/Changelog.txt
index 5c6354a..79b5215 100644
--- a/firmware/usbdrv/Changelog.txt
+++ b/firmware/usbdrv/Changelog.txt
@@ -306,3 +306,24 @@ Scroll down to the bottom to see the most recent changes.
endpoint now.
* Release 2010-07-15
+
+ - Fixed bug in usbDriverSetup() which prevented descriptor sizes above 255
+ bytes.
+ - Avoid a compiler warning for unused parameter in usbHandleResetHook() when
+ compiler option -Wextra is enabled.
+ - Fixed wrong hex value for some IDs in USB-IDs-for-free.txt.
+ - Keep a define for USBATTR_BUSPOWER, although the flag does not exist
+ in USB 1.1 any more. Set it to 0. This is for backward compatibility.
+
+* Release 2012-01-09
+
+ - Define a separate (defined) type for usbMsgPtr so that projects using a
+ tiny memory model can define it to an 8 bit type in usbconfig.h. This
+ change also saves a couple of bytes when using a scalar 16 bit type.
+ - Inserted "const" keyword for all PROGMEM declarations because new GCC
+ requires it.
+ - Fixed problem with dependence of usbportability.h on usbconfig.h. This
+ problem occurred with IAR CC only.
+ - Prepared repository for github.com.
+
+* Release 2012-12-06 \ No newline at end of file
diff --git a/firmware/usbdrv/CommercialLicense.txt b/firmware/usbdrv/CommercialLicense.txt
index 11d07d9..de1a2b0 100644
--- a/firmware/usbdrv/CommercialLicense.txt
+++ b/firmware/usbdrv/CommercialLicense.txt
@@ -1,5 +1,5 @@
V-USB Driver Software License Agreement
-Version 2009-08-03
+Version 2012-07-09
THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN
ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING
@@ -37,10 +37,10 @@ Product ID(s), sent to you in e-mail. These Product IDs are reserved
exclusively for you. OBJECTIVE DEVELOPMENT has obtained USB Product ID
ranges under the Vendor ID 5824 from Wouter van Ooijen (Van Ooijen
Technische Informatica, www.voti.nl) and under the Vendor ID 8352 from
-Jason Kotzin (Clay Logic, www.claylogic.com). Both owners of the Vendor IDs
-have obtained these IDs from the USB Implementers Forum, Inc.
-(www.usb.org). OBJECTIVE DEVELOPMENT disclaims all liability which might
-arise from the assignment of USB IDs.
+Jason Kotzin (now flirc.tv, Inc.). Both owners of the Vendor IDs have
+obtained these IDs from the USB Implementers Forum, Inc. (www.usb.org).
+OBJECTIVE DEVELOPMENT disclaims all liability which might arise from the
+assignment of USB IDs.
2.5 USB Certification. Although not part of this agreement, we want to make
it clear that you cannot become USB certified when you use V-USB or a USB
diff --git a/firmware/usbdrv/USB-ID-FAQ.txt b/firmware/usbdrv/USB-ID-FAQ.txt
index d1de8fb..a4a6bd6 100644
--- a/firmware/usbdrv/USB-ID-FAQ.txt
+++ b/firmware/usbdrv/USB-ID-FAQ.txt
@@ -1,4 +1,4 @@
-Version 2009-08-22
+Version 2012-07-09
==========================
WHY DO WE NEED THESE IDs?
@@ -107,8 +107,8 @@ WHO IS THE OWNER OF THE VENDOR-ID?
Objective Development has obtained ranges of USB Product-IDs under two
Vendor-IDs: Under Vendor-ID 5824 from Wouter van Ooijen (Van Ooijen
Technische Informatica, www.voti.nl) and under Vendor-ID 8352 from Jason
-Kotzin (Clay Logic, www.claylogic.com). Both VID owners have received their
-Vendor-ID directly from usb.org.
+Kotzin (now flirc.tv, Inc.). Both VID owners have received their Vendor-ID
+directly from usb.org.
=========================================================================
diff --git a/firmware/usbdrv/USB-IDs-for-free.txt b/firmware/usbdrv/USB-IDs-for-free.txt
index 2f4d59a..d46517d 100644
--- a/firmware/usbdrv/USB-IDs-for-free.txt
+++ b/firmware/usbdrv/USB-IDs-for-free.txt
@@ -86,8 +86,9 @@ If you use one of the IDs listed below, your device and host-side software
must conform to these rules:
(1) The USB device MUST provide a textual representation of the serial
-number. The serial number string MUST be available at least in USB language
-0x0409 (English/US).
+number, unless ONLY the operating system's default class driver is used.
+The serial number string MUST be available at least in USB language 0x0409
+(English/US).
(2) The serial number MUST start with either an Internet domain name (e.g.
"mycompany.com") registered and owned by you, or an e-mail address under your
@@ -108,6 +109,11 @@ driver for Vendor Class devices is needed, this driver must be libusb or
libusb-win32 (see http://libusb.org/ and
http://libusb-win32.sourceforge.net/).
+(7) If ONLY the operating system's default class driver is used, e.g. for
+mice, keyboards, joysticks, CDC or MIDI devices and no discrimination by an
+application is needed, the serial number may be omitted.
+
+
Table if IDs for discrimination by serial number string:
PID dec (hex) | VID dec (hex) | Description of use
@@ -121,11 +127,11 @@ PID dec (hex) | VID dec (hex) | Description of use
---------------+---------------+-------------------------------------------
10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards
---------------+---------------+-------------------------------------------
-10204 (0x27db) | 5824 (0x16c0) | For USB Joysticks
+10204 (0x27dc) | 5824 (0x16c0) | For USB Joysticks
---------------+---------------+-------------------------------------------
-10205 (0x27dc) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
+10205 (0x27dd) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
---------------+---------------+-------------------------------------------
-10206 (0x27dd) | 5824 (0x16c0) | For MIDI class devices
+10206 (0x27de) | 5824 (0x16c0) | For MIDI class devices
---------------+---------------+-------------------------------------------
diff --git a/firmware/usbdrv/asmcommon.inc b/firmware/usbdrv/asmcommon.inc
index 07d692b..d2a4f7c 100644
--- a/firmware/usbdrv/asmcommon.inc
+++ b/firmware/usbdrv/asmcommon.inc
@@ -5,7 +5,6 @@
* 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
diff --git a/firmware/usbdrv/oddebug.c b/firmware/usbdrv/oddebug.c
index 945457c..19bf142 100644
--- a/firmware/usbdrv/oddebug.c
+++ b/firmware/usbdrv/oddebug.c
@@ -5,7 +5,6 @@
* 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.c 692 2008-11-07 15:07:40Z cs $
*/
#include "oddebug.h"
diff --git a/firmware/usbdrv/oddebug.h b/firmware/usbdrv/oddebug.h
index d61309d..851f84d 100644
--- a/firmware/usbdrv/oddebug.h
+++ b/firmware/usbdrv/oddebug.h
@@ -5,7 +5,6 @@
* 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__
diff --git a/firmware/usbdrv/usbconfig-prototype.h b/firmware/usbdrv/usbconfig-prototype.h
index 847710e..93721c2 100644
--- a/firmware/usbdrv/usbconfig-prototype.h
+++ b/firmware/usbdrv/usbconfig-prototype.h
@@ -5,7 +5,6 @@
* 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: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
*/
#ifndef __usbconfig_h_included__
@@ -356,6 +355,15 @@ section at the end of this file).
#define USB_CFG_DESCR_PROPS_HID_REPORT 0
#define USB_CFG_DESCR_PROPS_UNKNOWN 0
+
+#define usbMsgPtr_t unsigned short
+/* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We define it to
+ * a scalar type here because gcc generates slightly shorter code for scalar
+ * arithmetics than for pointer arithmetics. Remove this define for backward
+ * type compatibility or define it to an 8 bit type if you use data in RAM only
+ * and all RAM is below 256 bytes (tiny memory model in IAR CC).
+ */
+
/* ----------------------- Optional MCU Description ------------------------ */
/* The following configurations have working defaults in usbdrv.h. You
diff --git a/firmware/usbdrv/usbdrv.c b/firmware/usbdrv/usbdrv.c
index 21ed554..d838935 100644
--- a/firmware/usbdrv/usbdrv.c
+++ b/firmware/usbdrv/usbdrv.c
@@ -5,10 +5,8 @@
* 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.c 791 2010-07-15 15:56:13Z cs $
*/
-#include "usbportability.h"
#include "usbdrv.h"
#include "oddebug.h"
@@ -45,7 +43,7 @@ uchar usbCurrentDataToken;/* when we check data toggling to ignore duplica
#endif
/* USB status registers / not shared with asm code */
-uchar *usbMsgPtr; /* data to transmit next -- ROM or RAM address */
+usbMsgPtr_t usbMsgPtr; /* data to transmit next -- ROM or RAM address */
static usbMsgLen_t usbMsgLen = USB_NO_MSG; /* remaining number of bytes */
static uchar usbMsgFlags; /* flag values see below */
@@ -67,7 +65,7 @@ optimizing hints:
#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 */
+PROGMEM const char usbDescriptorString0[] = { /* language descriptor */
4, /* sizeof(usbDescriptorString0): length of descriptor in bytes */
3, /* descriptor type */
0x09, 0x04, /* language index (0x0409 = US-English) */
@@ -77,7 +75,7 @@ PROGMEM char usbDescriptorString0[] = { /* language descriptor */
#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[] = {
+PROGMEM const int usbDescriptorStringVendor[] = {
USB_STRING_DESCRIPTOR_HEADER(USB_CFG_VENDOR_NAME_LEN),
USB_CFG_VENDOR_NAME
};
@@ -86,7 +84,7 @@ PROGMEM int usbDescriptorStringVendor[] = {
#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[] = {
+PROGMEM const int usbDescriptorStringDevice[] = {
USB_STRING_DESCRIPTOR_HEADER(USB_CFG_DEVICE_NAME_LEN),
USB_CFG_DEVICE_NAME
};
@@ -95,7 +93,7 @@ PROGMEM int usbDescriptorStringDevice[] = {
#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[] = {
+PROGMEM const int usbDescriptorStringSerialNumber[] = {
USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LEN),
USB_CFG_SERIAL_NUMBER
};
@@ -108,7 +106,7 @@ PROGMEM int usbDescriptorStringSerialNumber[] = {
#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 */
+PROGMEM const char usbDescriptorDevice[] = { /* USB device descriptor */
18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */
USBDESCR_DEVICE, /* descriptor type */
0x10, 0x01, /* USB version supported */
@@ -139,7 +137,7 @@ PROGMEM char usbDescriptorDevice[] = { /* USB device descriptor */
#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 */
+PROGMEM const char usbDescriptorConfiguration[] = { /* USB configuration descriptor */
9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */
USBDESCR_CONFIG, /* descriptor type */
18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT3 +
@@ -301,7 +299,7 @@ USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len)
len = usbFunctionDescriptor(rq); \
}else{ \
len = USB_PROP_LENGTH(cfgProp); \
- usbMsgPtr = (uchar *)(staticName); \
+ usbMsgPtr = (usbMsgPtr_t)(staticName); \
} \
}
@@ -361,7 +359,8 @@ uchar flags = USB_FLG_MSGPTR_IS_ROM;
*/
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 */
+usbMsgLen_t len = 0;
+uchar *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];
@@ -408,7 +407,7 @@ uchar index = rq->wIndex.bytes[0];
SWITCH_DEFAULT /* 7=SET_DESCRIPTOR, 12=SYNC_FRAME */
/* Should we add an optional hook here? */
SWITCH_END
- usbMsgPtr = dataPtr;
+ usbMsgPtr = (usbMsgPtr_t)dataPtr;
skipMsgPtrAssignment:
return len;
}
@@ -498,7 +497,8 @@ static uchar usbDeviceRead(uchar *data, uchar len)
}else
#endif
{
- uchar i = len, *r = usbMsgPtr;
+ uchar i = len;
+ usbMsgPtr_t 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 */
@@ -507,7 +507,8 @@ static uchar usbDeviceRead(uchar *data, uchar len)
}while(--i);
}else{ /* RAM data */
do{
- *data++ = *r++;
+ *data++ = *((uchar *)r);
+ r++;
}while(--i);
}
usbMsgPtr = r;
@@ -557,6 +558,8 @@ uchar isReset = !notResetState;
USB_RESET_HOOK(isReset);
wasReset = isReset;
}
+#else
+ notResetState = notResetState; // avoid compiler warning
#endif
}
diff --git a/firmware/usbdrv/usbdrv.h b/firmware/usbdrv/usbdrv.h
index d8a4a16..3fe84d5 100644
--- a/firmware/usbdrv/usbdrv.h
+++ b/firmware/usbdrv/usbdrv.h
@@ -5,7 +5,6 @@
* 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 793 2010-07-15 15:58:11Z cs $
*/
#ifndef __usbdrv_h_included__
@@ -122,7 +121,7 @@ USB messages, even if they address another (low-speed) device on the same bus.
/* --------------------------- Module Interface ---------------------------- */
/* ------------------------------------------------------------------------- */
-#define USBDRV_VERSION 20100715
+#define USBDRV_VERSION 20121206
/* 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
@@ -163,6 +162,17 @@ USB messages, even if they address another (low-speed) device on the same bus.
*/
#define USB_NO_MSG ((usbMsgLen_t)-1) /* constant meaning "no message" */
+#ifndef usbMsgPtr_t
+#define usbMsgPtr_t uchar *
+#endif
+/* Making usbMsgPtr_t a define allows the user of this library to define it to
+ * an 8 bit type on tiny devices. This reduces code size, especially if the
+ * compiler supports a tiny memory model.
+ * The type can be a pointer or scalar type, casts are made where necessary.
+ * Although it's paradoxical, Gcc 4 generates slightly better code for scalar
+ * types than for pointers.
+ */
+
struct usbRequest; /* forward declaration */
USB_PUBLIC void usbInit(void);
@@ -178,7 +188,7 @@ USB_PUBLIC void usbPoll(void);
* Please note that debug outputs through the UART take ~ 0.5ms per byte
* at 19200 bps.
*/
-extern uchar *usbMsgPtr;
+extern usbMsgPtr_t 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.
@@ -210,7 +220,7 @@ USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8]);
* 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);
+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
@@ -390,13 +400,13 @@ extern volatile schar usbRxLen;
* about the various methods to define USB descriptors. If you do nothing,
* the default descriptors will be used.
*/
-#define USB_PROP_IS_DYNAMIC (1 << 14)
+#define USB_PROP_IS_DYNAMIC (1u << 14)
/* If this property is set for a descriptor, usbFunctionDescriptor() will be
* used to obtain the particular descriptor. Data directly returned via
* usbMsgPtr are FLASH data by default, combine (OR) with USB_PROP_IS_RAM to
* return RAM data.
*/
-#define USB_PROP_IS_RAM (1 << 15)
+#define USB_PROP_IS_RAM (1u << 15)
/* If this property is set for a descriptor, the data is read from RAM
* memory instead of Flash. The property is used for all methods to provide
* external descriptors.
@@ -450,43 +460,43 @@ extern volatile schar usbRxLen;
#ifndef __ASSEMBLER__
extern
#if !(USB_CFG_DESCR_PROPS_DEVICE & USB_PROP_IS_RAM)
-PROGMEM
+PROGMEM const
#endif
char usbDescriptorDevice[];
extern
#if !(USB_CFG_DESCR_PROPS_CONFIGURATION & USB_PROP_IS_RAM)
-PROGMEM
+PROGMEM const
#endif
char usbDescriptorConfiguration[];
extern
#if !(USB_CFG_DESCR_PROPS_HID_REPORT & USB_PROP_IS_RAM)
-PROGMEM
+PROGMEM const
#endif
char usbDescriptorHidReport[];
extern
#if !(USB_CFG_DESCR_PROPS_STRING_0 & USB_PROP_IS_RAM)
-PROGMEM
+PROGMEM const
#endif
char usbDescriptorString0[];
extern
#if !(USB_CFG_DESCR_PROPS_STRING_VENDOR & USB_PROP_IS_RAM)
-PROGMEM
+PROGMEM const
#endif
int usbDescriptorStringVendor[];
extern
#if !(USB_CFG_DESCR_PROPS_STRING_PRODUCT & USB_PROP_IS_RAM)
-PROGMEM
+PROGMEM const
#endif
int usbDescriptorStringDevice[];
extern
#if !(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER & USB_PROP_IS_RAM)
-PROGMEM
+PROGMEM const
#endif
int usbDescriptorStringSerialNumber[];
@@ -719,6 +729,7 @@ typedef struct usbRequest{
#define USBDESCR_HID_PHYS 0x23
//#define USBATTR_BUSPOWER 0x80 // USB 1.1 does not define this value any more
+#define USBATTR_BUSPOWER 0
#define USBATTR_SELFPOWER 0x40
#define USBATTR_REMOTEWAKE 0x20
diff --git a/firmware/usbdrv/usbdrvasm.S b/firmware/usbdrv/usbdrvasm.S
index 45fcf18..b03b709 100644
--- a/firmware/usbdrv/usbdrvasm.S
+++ b/firmware/usbdrv/usbdrvasm.S
@@ -5,7 +5,6 @@
* 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 785 2010-05-30 17:57:07Z cs $
*/
/*
@@ -285,7 +284,7 @@ usbCrc16Append:
#if USB_CFG_HAVE_MEASURE_FRAME_LENGTH
#ifdef __IAR_SYSTEMS_ASM__
-/* Register assignments for usbMeasureFrameLength on IAR cc */
+/* Register assignments for usbMeasureFrameLengthDecreasing 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)
@@ -314,33 +313,28 @@ usbCrc16Append:
#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
+; extern int usbMeasurePacketLengthDecreasing(int);
+; input: timer start value
+; return: counts down time between two idle strobes in multiples of 5 CPU clocks
+.global usbMeasureFrameLengthDecreasing
+usbMeasureFrameLengthDecreasing:
+
+#if resL != cnt16L
+ mov cnt16L, resL
+ mov cnt16H, resH
+#endif
+
+usbDFWaitStrobe: ; first wait for D- == 0 (idle strobe)
+ sbic USBIN, USBMINUS ;
+ rjmp usbDFWaitStrobe ;
+usbDFWaitIdle: ; 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:
+ rjmp usbDFWaitIdle ;2
+usbDFWaitLoop:
+ sbiw cnt16,1 ;[0] [5]
+ sbic USBIN, USBMINUS ;[2]
+ rjmp usbDFWaitLoop ;[3]
+
#if resL != cnt16L
mov resL, cnt16L
mov resH, cnt16H
diff --git a/firmware/usbdrv/usbdrvasm.asm b/firmware/usbdrv/usbdrvasm.asm
index 9cc4e4d..fb66934 100644
--- a/firmware/usbdrv/usbdrvasm.asm
+++ b/firmware/usbdrv/usbdrvasm.asm
@@ -5,7 +5,6 @@
* 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$
*/
/*
diff --git a/firmware/usbdrv/usbdrvasm12.inc b/firmware/usbdrv/usbdrvasm12.inc
index 78a14e0..d3bd056 100644
--- a/firmware/usbdrv/usbdrvasm12.inc
+++ b/firmware/usbdrv/usbdrvasm12.inc
@@ -5,7 +5,6 @@
* 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
@@ -41,50 +40,8 @@ DATAx (rx) to ACK/NAK/STALL (tx) 2 7.5 16-60
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]
-
- in YL, TIMSK
- cpi YL, 0
- breq compare2 ; don't go to app if equal (possible bootloader)
-
- ; prep and jump to app vector
- pop YL
- out SREG, YL
- pop YL
- rjmp __vectors - 2
-
-compare2:
- in YL, TCNT2
- cpi YL, 0xFF
- breq bootloaderExt0 ; don't go to app if equal (bootloader)
-
- ; prep and jump to app vector
- pop YL
- out SREG, YL
- pop YL
-
- ; some errors with 1 nop
- ;nop
- ;nop
- ;nop
- ;nop
- ;nop
- ;nop
- ;nop
- ;nop
- ;nop
- ;nop
-
-
- rjmp __vectors - 2
-
-
-bootloaderExt0:
- ldi YL, 0
-
-
;----------------------------------------------------------------------------
; Synchronize with sync pattern:
;----------------------------------------------------------------------------
@@ -432,4 +389,4 @@ skipAddrAssign:
out USBOUT, x1 ;[16] <-- out J (idle) -- end of SE0 (EOP signal)
out USBDDR, x2 ;[17] <-- release bus now
out USBOUT, x3 ;[18] <-- ensure no pull-up resistors are active
- rjmp doReturn \ No newline at end of file
+ rjmp doReturn
diff --git a/firmware/usbdrv/usbdrvasm128.inc b/firmware/usbdrv/usbdrvasm128.inc
index bcd6621..8f67bcc 100644
--- a/firmware/usbdrv/usbdrvasm128.inc
+++ b/firmware/usbdrv/usbdrvasm128.inc
@@ -5,7 +5,6 @@
* Tabsize: 4
* Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
- * This Revision: $Id: usbdrvasm128.inc 758 2009-08-06 10:12:54Z cs $
*/
/* Do not link this file! Link usbdrvasm.S instead, which includes the
diff --git a/firmware/usbdrv/usbdrvasm15.inc b/firmware/usbdrv/usbdrvasm15.inc
index 401b7f8..33bcf0e 100644
--- a/firmware/usbdrv/usbdrvasm15.inc
+++ b/firmware/usbdrv/usbdrvasm15.inc
@@ -5,7 +5,6 @@
* 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
diff --git a/firmware/usbdrv/usbdrvasm16.inc b/firmware/usbdrv/usbdrvasm16.inc
index 207b6e4..25b84e6 100644
--- a/firmware/usbdrv/usbdrvasm16.inc
+++ b/firmware/usbdrv/usbdrvasm16.inc
@@ -5,7 +5,6 @@
* 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: usbdrvasm16.inc 760 2009-08-09 18:59:43Z cs $
*/
/* Do not link this file! Link usbdrvasm.S instead, which includes the
diff --git a/firmware/usbdrv/usbdrvasm165.inc b/firmware/usbdrv/usbdrvasm165.inc
index 450d2fd..ae91588 100644
--- a/firmware/usbdrv/usbdrvasm165.inc
+++ b/firmware/usbdrv/usbdrvasm165.inc
@@ -4,9 +4,7 @@
* Creation Date: 2007-04-22
* Tabsize: 4
* Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
- * Portions Copyright: (c) 2012 Louis Beaudoin
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
- * Revision: $Id: usbdrvasm165.inc 740 2009-04-13 18:23:31Z cs $
*/
/* Do not link this file! Link usbdrvasm.S instead, which includes the
@@ -36,41 +34,12 @@ of CPU cycles, but even an exact number of cycles!
; Numbers in brackets are clocks counted from center of last sync bit
; when instruction starts
-; the code enabled by TINY85MODE is inteded only for use with the tiny85-compatible USBaspLoader
-; project.
-; with TINY85MODE set, the beginning of the ISR checks for a magic word "B007" at the very bottom of the stack
-; and jumps to the application's ISR if the magic word isn't present
-; the max allowable interrupt latency is lower given this additional code before getting to the
-; USB-specific portion of the ISR.
USB_INTR_VECTOR:
;order of registers pushed: YL, SREG [sofError], r0, YH, shift, x1, x2, x3, x4, cnt
- push YL ; push only what is necessary to sync with edge ASAP
- in YL, SREG ;
- push YL ;
-
-#ifdef TINY85MODE
-; look for magic word "B007" at the bottom of the stack
- lds YL, RAMEND
- cpi YL, 0xB0
- brne cleanupAndJumpToApp
-
- lds YL, RAMEND-1
- cpi YL, 0x07
- breq cleanupBootloaderIntStack
-
-cleanupAndJumpToApp:
-; magic word was not found, put registers back to where they were before this ISR ran, and jump to application ISR
- pop YL
- out SREG, YL
- pop YL
-
- rjmp __vectors - TINYVECTOR_USBPLUS_OFFSET
-
-cleanupBootloaderIntStack:
-; magic word was found, put registers
- CLR YL ; [-19] ensure we meet below requirements for YL < 0x80
-#endif
+ push YL ;[-23] push only what is necessary to sync with edge ASAP
+ in YL, SREG ;[-21]
+ push YL ;[-20]
;----------------------------------------------------------------------------
; Synchronize with sync pattern:
;----------------------------------------------------------------------------
@@ -80,9 +49,9 @@ cleanupBootloaderIntStack:
;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 ; [-18]
- sbis USBIN, USBMINUS ; [-17]
- brne waitForJ ; [-16] just make sure we have ANY timeout
+ 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]
diff --git a/firmware/usbdrv/usbdrvasm18-crc.inc b/firmware/usbdrv/usbdrvasm18-crc.inc
index f83347d..0ff2f42 100644
--- a/firmware/usbdrv/usbdrvasm18-crc.inc
+++ b/firmware/usbdrv/usbdrvasm18-crc.inc
@@ -5,7 +5,6 @@
* Tabsize: 4
* Copyright: (c) 2008 by Lukas Schrittwieser and OBJECTIVE DEVELOPMENT Software GmbH
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
- * Revision: $Id: usbdrvasm18-crc.inc 740 2009-04-13 18:23:31Z cs $
*/
/* Do not link this file! Link usbdrvasm.S instead, which includes the
diff --git a/firmware/usbdrv/usbdrvasm20.inc b/firmware/usbdrv/usbdrvasm20.inc
index 303abaf..5027edd 100644
--- a/firmware/usbdrv/usbdrvasm20.inc
+++ b/firmware/usbdrv/usbdrvasm20.inc
@@ -6,7 +6,6 @@
* 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
diff --git a/firmware/usbdrv/usbportability.h b/firmware/usbdrv/usbportability.h
index 476184d..0a861d0 100644
--- a/firmware/usbdrv/usbportability.h
+++ b/firmware/usbdrv/usbportability.h
@@ -5,7 +5,6 @@
* Tabsize: 4
* Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
- * This Revision: $Id: usbportability.h 785 2010-05-30 17:57:07Z cs $
*/
/*