Compare commits

...

23 Commits

Author SHA1 Message Date
Jack Humbert
21c2324c3e Merge branch 'master' into planck_thk 2019-08-01 09:09:26 -04:00
noroadsleft
039129ac3e Update keyboards/planck/thk/rules.mk
Co-Authored-By: jackhumbert <jack.humb@gmail.com>
2018-11-02 13:52:39 -04:00
Jack Humbert
d581848c13 merge conditional read 2018-11-02 12:51:07 -04:00
Jack Humbert
adc8bc1747 sandwich if statement 2018-11-02 12:48:58 -04:00
Jack Humbert
bd71649248 fix encoder docs 2018-10-26 23:21:08 -04:00
Jack Humbert
3a64a9c55e use encoders for thk 2018-10-26 20:21:20 -04:00
Jack Humbert
44e7bdf52b Merge branch 'atmega32a_matrix' of github.com:qmk/qmk_firmware into planck_thk 2018-10-26 20:05:52 -04:00
Jack Humbert
f39a21cae1 merge 2018-10-26 17:45:28 -04:00
Jack Humbert
1a875d6091 fix typo in pindef 2018-10-22 12:25:59 -04:00
Jack Humbert
47e350f5ea last changes 2018-10-01 09:25:55 -04:00
Jack Humbert
d2e3e527d5 consolodate options, add 646 2018-09-28 22:03:04 -04:00
Jack Humbert
4caf9eade0 exclude assembler in config.h includes 2018-09-28 21:29:28 -04:00
Jack Humbert
6650bd222d remove avr include from config 2018-09-28 20:56:34 -04:00
Jack Humbert
4b194472be add atmega16 chips, link to references 2018-09-28 20:20:33 -04:00
Jack Humbert
8c5b2bf470 doc typo 2018-09-28 20:13:51 -04:00
Jack Humbert
7289b847db update for atmega32a 2018-09-28 20:12:29 -04:00
Jack Humbert
12672aca8b add computed pins from mcu type 2018-09-28 13:24:27 -04:00
Jack Humbert
bf63363c1d update matrix 2018-09-22 23:07:53 -04:00
Jack Humbert
7443da28ae add audio for atmega32a 2018-09-22 22:50:41 -04:00
Jack Humbert
0236f6a8ac encoder, dip update, adds bootloader 2018-09-21 01:09:05 -04:00
Jack Humbert
d24132ce71 add encoder and dip 2018-09-20 01:11:53 -04:00
Jack Humbert
cd4a01d296 better matrix 2018-09-20 00:09:05 -04:00
Jack Humbert
c49e7e01ab config 1 2018-09-19 23:27:13 -04:00
38 changed files with 8885 additions and 41 deletions

View File

@ -48,4 +48,4 @@ or `keymap.c`:
## Hardware
The A an B lines of the encoders should be wired directly to the MCU, and the C/common lines should be wired to ground.
The A and B lines of the encoders should be wired directly to the MCU, and the C/common lines should be wired to ground.

View File

@ -256,7 +256,7 @@ uint16_t muse_counter = 0;
uint8_t muse_offset = 70;
uint16_t muse_tempo = 50;
void encoder_update(bool clockwise) {
void encoder_update_user(uint8_t index, bool clockwise) {
if (muse_mode) {
if (IS_LAYER_ON(_RAISE)) {
if (clockwise) {

View File

@ -13,7 +13,7 @@ const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
__attribute__ ((weak))
void matrix_init_kb(void) {
// Turn status LED on
#ifdef __AVR__
#if defined(__AVR__) && defined(DDRE)
DDRE |= (1<<6);
PORTE |= (1<<6);
#endif
@ -26,4 +26,4 @@ const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = LAYOUT_planck_grid(
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
);
);

View File

@ -77,6 +77,7 @@ void matrix_init(void) {
__attribute__ ((weak))
void dip_update(uint8_t index, bool active) { }
bool last_dip_switch[4] = {0};
uint8_t matrix_scan(void) {

View File

@ -0,0 +1,3 @@
# Planck Through Hole Kit
Fuses I used are `-U lfuse:w:0xcf:m -U hfuse:w:0x90:m`, and I hit the ESC to bootup normally (just a work-around right now).

View File

@ -0,0 +1,124 @@
/* Name: bootloaderconfig.h
* Project: AVR bootloader HID
* Author: Christian Starkjohann
* Creation Date: 2007-03-19
* Tabsize: 4
* Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
* License: GNU GPL v2 (see License.txt)
* This Revision: $Id$
*/
#ifndef __bootloaderconfig_h_included__
#define __bootloaderconfig_h_included__
/*
General Description:
This file (together with some settings in Makefile) configures the boot loader
according to the hardware.
This file contains (besides the hardware configuration normally found in
usbconfig.h) two functions or macros: bootLoaderInit() and
bootLoaderCondition(). Whether you implement them as macros or as static
inline functions is up to you, decide based on code size and convenience.
bootLoaderInit() is called as one of the first actions after reset. It should
be a minimum initialization of the hardware so that the boot loader condition
can be read. This will usually consist of activating a pull-up resistor for an
external jumper which selects boot loader mode. You may call leaveBootloader()
from this function if you know that the main code should run.
bootLoaderCondition() is called immediately after initialization and in each
main loop iteration. If it returns TRUE, the boot loader will be active. If it
returns FALSE, the boot loader jumps to address 0 (the loaded application)
immediately.
For compatibility with Thomas Fischl's avrusbboot, we also support the macro
names BOOTLOADER_INIT and BOOTLOADER_CONDITION for this functionality. If
these macros are defined, the boot loader usees them.
*/
/* ---------------------------- 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 3
/* 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 2
/* 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! [You can also use other interrupts, see section
* "Optional MCU Description" below, or you can connect D- to the interrupt, as
* it is required if you use the USB_COUNT_SOF feature. If you use D- for the
* interrupt, the USB interrupt will also be triggered at Start-Of-Frame
* markers every millisecond.]
*/
#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
/* Clock rate of the AVR in MHz. Legal values are 12000, 12800, 15000, 16000,
* 16500 and 20000. The 12.8 MHz and 16.5 MHz versions of the code require no
* crystal, they tolerate +/- 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 4 */
/* 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 BOOTLOADER_CAN_EXIT 1
/* If this macro is defined to 1, the boot loader command line utility can
* initiate a reboot after uploading the FLASH when the "-r" command line
* option is given. If you define it to 0 or leave it undefined, the "-r"
* option won't work and you save a couple of bytes in the boot loader. This
* may be of advantage if you compile with gcc 4 instead of gcc 3 because it
* generates slightly larger code.
* If you need to save even more memory, consider using your own vector table.
* Since only the reset vector and INT0 (the first two vectors) are used,
* this saves quite a bit of flash. See Alexander Neumann's boot loader for
* an example: http://git.lochraster.org:2080/?p=fd0/usbload;a=tree
*/
/* ------------------------------------------------------------------------- */
/* Example configuration: Port D bit 3 is connected to a jumper which ties
* this pin to GND if the boot loader is requested. Initialization allows
* several clock cycles for the input voltage to stabilize before
* bootLoaderCondition() samples the value.
* We use a function for bootLoaderInit() for convenience and a macro for
* bootLoaderCondition() for efficiency.
*/
#ifndef __ASSEMBLER__ /* assembler cannot parse function definitions */
#include <util/delay.h>
static inline void bootLoaderInit(void)
{
DDRA |= (1 << 6);
PORTA &= ~(1 << 6); /* activate pull-up for key */
DDRD &= ~(1 << 7);
PORTD |= (1 << 7);
_delay_us(10); /* wait for levels to stabilize */
}
#define bootLoaderCondition() ((PIND & (1 << 7)) != 0) /* True if jumper is set */
#endif
/* ------------------------------------------------------------------------- */
#endif /* __bootloader_h_included__ */

View File

@ -0,0 +1,250 @@
/* Name: main.c
* Project: AVR bootloader HID
* Author: Christian Starkjohann
* Creation Date: 2007-03-19
* Tabsize: 4
* Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
* License: GNU GPL v2 (see License.txt)
* This Revision: $Id$
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/wdt.h>
#include <avr/boot.h>
#include <string.h>
#include <util/delay.h>
static void leaveBootloader() __attribute__((__noreturn__));
#include "bootloaderconfig.h"
#include "usbdrv.c"
/* ------------------------------------------------------------------------ */
#ifndef ulong
# define ulong unsigned long
#endif
#ifndef uint
# define uint unsigned int
#endif
#if (FLASHEND) > 0xffff /* we need long addressing */
# define addr_t ulong
#else
# define addr_t uint
#endif
static addr_t currentAddress; /* in bytes */
static uchar offset; /* data already processed in current transfer */
#if BOOTLOADER_CAN_EXIT
static uchar exitMainloop;
#endif
const PROGMEM char usbHidReportDescriptor[33] = {
0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x85, 0x01, // REPORT_ID (1)
0x95, 0x06, // REPORT_COUNT (6)
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0x85, 0x02, // REPORT_ID (2)
0x95, 0x83, // REPORT_COUNT (131)
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0xc0 // END_COLLECTION
};
/* allow compatibility with avrusbboot's bootloaderconfig.h: */
#ifdef BOOTLOADER_INIT
# define bootLoaderInit() BOOTLOADER_INIT
#endif
#ifdef BOOTLOADER_CONDITION
# define bootLoaderCondition() BOOTLOADER_CONDITION
#endif
/* compatibility with ATMega88 and other new devices: */
#ifndef TCCR0
#define TCCR0 TCCR0B
#endif
#ifndef GICR
#define GICR MCUCR
#endif
static void (*nullVector)(void) __attribute__((__noreturn__));
static void leaveBootloader()
{
DBG1(0x01, 0, 0);
cli();
boot_rww_enable();
USB_INTR_ENABLE = 0;
USB_INTR_CFG = 0; /* also reset config bits */
#if F_CPU == 12800000
TCCR0 = 0; /* default value */
#endif
GICR = (1 << IVCE); /* enable change of interrupt vectors */
GICR = (0 << IVSEL); /* move interrupts to application flash section */
/* We must go through a global function pointer variable instead of writing
* ((void (*)(void))0)();
* because the compiler optimizes a constant 0 to "rcall 0" which is not
* handled correctly by the assembler.
*/
nullVector();
}
uchar usbFunctionSetup(uchar data[8])
{
usbRequest_t *rq = (void *)data;
static uchar replyBuffer[7] = {
1, /* report ID */
SPM_PAGESIZE & 0xff,
SPM_PAGESIZE >> 8,
((long)FLASHEND + 1) & 0xff,
(((long)FLASHEND + 1) >> 8) & 0xff,
(((long)FLASHEND + 1) >> 16) & 0xff,
(((long)FLASHEND + 1) >> 24) & 0xff
};
if(rq->bRequest == USBRQ_HID_SET_REPORT){
if(rq->wValue.bytes[0] == 2){
offset = 0;
return USB_NO_MSG;
}
#if BOOTLOADER_CAN_EXIT
else{
exitMainloop = 1;
}
#endif
}else if(rq->bRequest == USBRQ_HID_GET_REPORT){
usbMsgPtr = (usbMsgPtr_t)replyBuffer;
return 7;
}
return 0;
}
uchar usbFunctionWrite(uchar *data, uchar len)
{
union {
addr_t l;
uint s[sizeof(addr_t)/2];
uchar c[sizeof(addr_t)];
} address;
uchar isLast;
address.l = currentAddress;
if(offset == 0){
DBG1(0x30, data, 3);
address.c[0] = data[1];
address.c[1] = data[2];
#if (FLASHEND) > 0xffff /* we need long addressing */
address.c[2] = data[3];
address.c[3] = 0;
#endif
data += 4;
len -= 4;
}
DBG1(0x31, (void *)&currentAddress, 4);
offset += len;
isLast = offset & 0x80; /* != 0 if last block received */
do{
addr_t prevAddr;
#if SPM_PAGESIZE > 256
uint pageAddr;
#else
uchar pageAddr;
#endif
DBG1(0x32, 0, 0);
pageAddr = address.s[0] & (SPM_PAGESIZE - 1);
if(pageAddr == 0){ /* if page start: erase */
DBG1(0x33, 0, 0);
#ifndef TEST_MODE
cli();
boot_page_erase(address.l); /* erase page */
sei();
boot_spm_busy_wait(); /* wait until page is erased */
#endif
}
cli();
boot_page_fill(address.l, *(short *)data);
sei();
prevAddr = address.l;
address.l += 2;
data += 2;
/* write page when we cross page boundary */
pageAddr = address.s[0] & (SPM_PAGESIZE - 1);
if(pageAddr == 0){
DBG1(0x34, 0, 0);
#ifndef TEST_MODE
cli();
boot_page_write(prevAddr);
sei();
boot_spm_busy_wait();
#endif
}
len -= 2;
}while(len);
currentAddress = address.l;
DBG1(0x35, (void *)&currentAddress, 4);
return isLast;
}
static void initForUsbConnectivity(void)
{
uchar i = 0;
#if F_CPU == 12800000
TCCR0 = 3; /* 1/64 prescaler */
#endif
usbInit();
/* enforce USB re-enumerate: */
usbDeviceDisconnect(); /* do this while interrupts are disabled */
do{ /* fake USB disconnect for > 250 ms */
wdt_reset();
_delay_ms(1);
}while(--i);
usbDeviceConnect();
sei();
}
int __attribute__((noreturn)) main(void)
{
/* initialize hardware */
bootLoaderInit();
odDebugInit();
DBG1(0x00, 0, 0);
/* jump to application if jumper is set */
if(bootLoaderCondition()){
uchar i = 0, j = 0;
#ifndef TEST_MODE
GICR = (1 << IVCE); /* enable change of interrupt vectors */
GICR = (1 << IVSEL); /* move interrupts to boot flash section */
#endif
initForUsbConnectivity();
do{ /* main event loop */
wdt_reset();
usbPoll();
#if BOOTLOADER_CAN_EXIT
if(exitMainloop){
#if F_CPU == 12800000
break; /* memory is tight at 12.8 MHz, save exit delay below */
#endif
if(--i == 0){
if(--j == 0)
break;
}
}
#endif
}while(bootLoaderCondition());
}
leaveBootloader();
}

View File

@ -0,0 +1,275 @@
/* Name: usbconfig.h
* Project: AVR USB driver
* Author: Christian Starkjohann
* Creation Date: 2007-03-13
* Tabsize: 4
* Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
* License: GNU GPL v2 (see License.txt)
* This Revision: $Id$
*/
#ifndef __usbconfig_h_included__
#define __usbconfig_h_included__
/*
General Description:
This file contains the configuration options for the USB driver.
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.
*/
/* Fetch the hardware configuration from bootloaderconfig.h so that we have a
* single file where hardware settings are stored.
* Do not edit the functional settings below.
*/
#include "bootloaderconfig.h"
#define USB_PUBLIC static
/* Use the define above if you #include usbdrv.c instead of linking against it.
* This technique saves a couple of bytes in flash memory.
*/
/* --------------------------- Functional Range ---------------------------- */
#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
/* 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_SUPPRESS_INTR_CODE 1
/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
* want to send any data over them. If this macro is defined to 1, functions
* usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
* you need the interrupt-in endpoints in order to comply to an interface
* (e.g. HID), but never want to send any data. This option saves a couple
* of bytes in flash memory and the transmit buffers in RAM.
*/
#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 200
/* 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 100
/* 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 1
/* 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 TIMER0_PRESCALING 64 /* must match the configuration for TIMER0 in main */
#define TOLERATED_DEVIATION_PPT 5 /* max clock deviation before we tune in 1/10 % */
/* derived constants: */
#define EXPECTED_TIMER0_INCREMENT ((F_CPU / (1000 * TIMER0_PRESCALING)) & 0xff)
#define TOLERATED_DEVIATION (TOLERATED_DEVIATION_PPT * F_CPU / (1000000 * TIMER0_PRESCALING))
#ifdef __ASSEMBLER__
macro tuneOsccal
push YH ;[0]
clr YH ;[2]
in YL, TCNT0 ;[3]
out TCNT0, YH ;[4]
subi YL, EXPECTED_TIMER0_INCREMENT ;[5]
#if OSCCAL > 0x3f
lds YH, OSCCAL ;[6]
#else
in YH, OSCCAL ;[6]
#endif
cpi YL, TOLERATED_DEVIATION + 1 ;[7]
brmi notTooHigh ;[8]
subi YH, 1 ;[9] clock rate was too high
rjmp osctuneDone ;[10]
notTooHigh:
cpi YL, -TOLERATED_DEVIATION ;[10]
brpl osctuneDone ;[11] not too low
inc YH ;[12] clock rate was too low
osctuneDone:
#if OSCCAL > 0x3f
sts OSCCAL, YH ;[12-13] store tuned value
#else
out OSCCAL, YH ;[12-13] store tuned value
#endif
tuningOverflow:
pop YH ;[14]
endm ;[16] max number of cycles
#endif
#if F_CPU == 12800000
# define USB_SOF_HOOK tuneOsccal
#endif
/* This macro (if defined) is executed in the assembler module when a
* Start Of Frame condition is detected. It is recommended to define it to
* the name of an assembler macro which is defined here as well so that more
* than one assembler instruction can be used. The macro may use the register
* YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
* immediately after an SOF pulse may be lost and must be retried by the host.
* What can you do with this hook? Since the SOF signal occurs exactly every
* 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
* designs running on the internal RC oscillator.
* Please note that Start Of Frame detection works only if D- is wired to the
* interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
*/
/* -------------------------- Device Description --------------------------- */
#define USB_CFG_VENDOR_ID 0xc0, 0x16
/* 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 0xdf, 0x05
/* This is the ID of the product, low byte first. It is interpreted in the
* scope of the vendor ID. If you have registered your own VID with usb.org
* or if you have licensed a PID from somebody else, define it here. Otherwise
* 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 'o', 'b', 'd', 'e', 'v', '.', 'a', 't'
#define USB_CFG_VENDOR_NAME_LEN 8
/* 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 'H', 'I', 'D', 'B', 'o', 'o', 't'
#define USB_CFG_DEVICE_NAME_LEN 7
/* 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 if you
* use a shared VID/PID.
*/
/*#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 0
#define USB_CFG_DEVICE_SUBCLASS 0
/* See USB specification if you want to conform to an existing device class.
*/
#define USB_CFG_INTERFACE_CLASS 3 /* HID */
#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 33 /* 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
#define usbMsgPtr_t unsigned short /* Use scalar type in order to save a couple of bytes */
/* ----------------------- 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__ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,166 @@
V-USB Driver Software License Agreement
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
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. 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 (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
Product ID assigned by OBJECTIVE DEVELOPMENT. AVR microcontrollers don't
meet the electrical specifications required by the USB specification and
the USB Implementers Forum certifies only members who bought a Vendor ID of
their own.
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.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,172 @@
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.
USB-ID-FAQ.txt ......... General infos about USB Product- and Vendor-IDs.
USB-IDs-for-free.txt ... List and terms of use for free shared PIDs.
(*) ... 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 usbconfig.h.
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
USB-IDs-for-free.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
and 4. 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.
Gcc version 3 produces smaller code than version 4 due to new optimizing
capabilities which don't always improve things on 8 bit CPUs. The code size
generated by gcc 4 can be reduced with the compiler options
-fno-move-loop-invariants, -fno-tree-scev-cprop and
-fno-inline-small-functions in addition to -Os. On devices with more than
8k of flash memory, we also recommend the linker option --relax (written as
-Wl,--relax for gcc) to convert absolute calls into relative where possible.
For more information about optimizing options see:
http://www.tty1.net/blog/2008-04-29-avr-gcc-optimisations_en.html
These optimizations are good for gcc 4.x. Version 3.x of gcc does not support
most of these options and produces good code anyway.
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.

View File

@ -0,0 +1,149 @@
Version 2012-07-09
==========================
WHY DO WE NEED THESE IDs?
==========================
USB is more than a low level protocol for data transport. It also defines a
common set of requests which must be understood by all devices. And as part
of these common requests, the specification defines data structures, the
USB Descriptors, which are used to describe the properties of the device.
From the perspective of an operating system, it is therefore possible to find
out basic properties of a device (such as e.g. the manufacturer and the name
of the device) without a device-specific driver. This is essential because
the operating system can choose a driver to load based on this information
(Plug-And-Play).
Among the most important properties in the Device Descriptor are the USB
Vendor- and Product-ID. Both are 16 bit integers. The most simple form of
driver matching is based on these IDs. The driver announces the Vendor- and
Product-IDs of the devices it can handle and the operating system loads the
appropriate driver when the device is connected.
It is obvious that this technique only works if the pair Vendor- plus
Product-ID is unique: Only devices which require the same driver can have the
same pair of IDs.
=====================================================
HOW DOES THE USB STANDARD ENSURE THAT IDs ARE UNIQUE?
=====================================================
Since it is so important that USB IDs are unique, the USB Implementers Forum,
Inc. (usb.org) needs a way to enforce this legally. It is not forbidden by
law to build a device and assign it any random numbers as IDs. Usb.org
therefore needs an agreement to regulate the use of USB IDs. The agreement
binds only parties who agreed to it, of course. Everybody else is free to use
any numbers for their IDs.
So how can usb.org ensure that every manufacturer of USB devices enters into
an agreement with them? They do it via trademark licensing. Usb.org has
registered the trademark "USB", all associated logos and related terms. If
you want to put an USB logo on your product or claim that it is USB
compliant, you must license these trademarks from usb.org. And this is where
you enter into an agreement. See the "USB-IF Trademark License Agreement and
Usage Guidelines for the USB-IF Logo" at
http://www.usb.org/developers/logo_license/.
Licensing the USB trademarks requires that you buy a USB Vendor-ID from
usb.org (one-time fee of ca. 2,000 USD), that you become a member of usb.org
(yearly fee of ca. 4,000 USD) and that you meet all the technical
specifications from the USB spec.
This means that most hobbyists and small companies will never be able to
become USB compliant, just because membership is so expensive. And you can't
be compliant with a driver based on V-USB anyway, because the AVR's port pins
don't meet the electrical specifications for USB. So, in principle, all
hobbyists and small companies are free to choose any random numbers for their
IDs. They have nothing to lose...
There is one exception worth noting, though: If you use a sub-component which
implements USB, the vendor of the sub-components may guarantee USB
compliance. This might apply to some or all of FTDI's solutions.
=======================================================================
WHY SHOULD YOU OBTAIN USB IDs EVEN IF YOU DON'T LICENSE USB TRADEMARKS?
=======================================================================
You have learned in the previous section that you are free to choose any
numbers for your IDs anyway. So why not do exactly this? There is still the
technical issue. If you choose IDs which are already in use by somebody else,
operating systems will load the wrong drivers and your device won't work.
Even if you choose IDs which are not currently in use, they may be in use in
the next version of the operating system or even after an automatic update.
So what you need is a pair of Vendor- and Product-IDs for which you have the
guarantee that no USB compliant product uses them. This implies that no
operating system will ever ship with drivers responsible for these IDs.
==============================================
HOW DOES OBJECTIVE DEVELOPMENT HANDLE USB IDs?
==============================================
Objective Development gives away pairs of USB-IDs with their V-USB licenses.
In order to ensure that these IDs are unique, Objective Development has an
agreement with the company/person who has bought the USB Vendor-ID from
usb.org. This agreement ensures that a range of USB Product-IDs is reserved
for assignment by Objective Development and that the owner of the Vendor-ID
won't give it to anybody else.
This means that you have to trust three parties to ensure uniqueness of
your IDs:
- Objective Development, that they don't give the same PID to more than
one person.
- The owner of the Vendor-ID that they don't assign PIDs from the range
assigned to Objective Development to anybody else.
- Usb.org that they don't assign the same Vendor-ID a second time.
==================================
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 (now flirc.tv, Inc.). Both VID owners have received their Vendor-ID
directly from usb.org.
=========================================================================
CAN I USE USB-IDs FROM OBJECTIVE DEVELOPMENT WITH OTHER DRIVERS/HARDWARE?
=========================================================================
The short answer is: Yes. All you get is a guarantee that the IDs are never
assigned to anybody else. What more do you need?
============================
WHAT ABOUT SHARED ID PAIRS?
============================
Objective Development has reserved some PID/VID pairs for shared use. You
have no guarantee of uniqueness for them, except that no USB compliant device
uses them. In order to avoid technical problems, we must ensure that all
devices with the same pair of IDs use the same driver on kernel level. For
details, see the file USB-IDs-for-free.txt.
======================================================
I HAVE HEARD THAT SUB-LICENSING OF USB-IDs IS ILLEGAL?
======================================================
A 16 bit integer number cannot be protected by copyright laws. It is not
sufficiently complex. And since none of the parties involved entered into the
USB-IF Trademark License Agreement, we are not bound by this agreement. So
there is no reason why it should be illegal to sub-license USB-IDs.
=============================================
WHO IS LIABLE IF THERE ARE INCOMPATIBILITIES?
=============================================
Objective Development disclaims all liabilities which might arise from the
assignment of IDs. If you guarantee product features to your customers
without proper disclaimer, YOU are liable for that.

View File

@ -0,0 +1,154 @@
Version 2009-08-22
===========================
FREE USB-IDs FOR SHARED USE
===========================
Objective Development has reserved a set of USB Product-IDs for use according
to the guidelines outlined below. For more information about the concept of
USB IDs please see the file USB-ID-FAQ.txt. Objective Development guarantees
that the IDs listed below are not used by any USB compliant devices.
====================
MECHANISM OF SHARING
====================
From a technical point of view, two different devices can share the same USB
Vendor- and Product-ID if they require the same driver on operating system
level. We make use of this fact by assigning separate IDs for various device
classes. On application layer, devices must be distinguished by their textual
name or serial number. We offer separate sets of IDs for discrimination by
textual name and for serial number.
Examples for shared use of USB IDs are included with V-USB in the "examples"
subdirectory.
======================================
IDs FOR DISCRIMINATION BY TEXTUAL NAME
======================================
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 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) Application side device look-up MUST be based on the textual manufacturer
and product identification in addition to VID/PID matching. The driver
matching MUST be a comparison of the entire strings, NOT a sub-string match.
(6) For devices which implement a particular USB device class (e.g. HID), the
operating system's default class driver MUST be used. If an operating system
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/).
Table if IDs for discrimination by textual name:
PID dec (hex) | VID dec (hex) | Description of use
==============+===============+============================================
1500 (0x05dc) | 5824 (0x16c0) | For Vendor Class devices with libusb
--------------+---------------+--------------------------------------------
1503 (0x05df) | 5824 (0x16c0) | For generic HID class devices (which are
| | NOT mice, keyboards or joysticks)
--------------+---------------+--------------------------------------------
1505 (0x05e1) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
--------------+---------------+--------------------------------------------
1508 (0x05e4) | 5824 (0x16c0) | For MIDI class devices
--------------+---------------+--------------------------------------------
Note that Windows caches the textual product- and vendor-description for
mice, keyboards and joysticks. Name-bsed discrimination is therefore not
recommended for these device classes.
=======================================
IDs FOR DISCRIMINATION BY SERIAL NUMBER
=======================================
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, 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
control (e.g. "myname@gmx.net"), both terminated with a colon (":") character.
You MAY append any string you like for further discrimination of your devices.
(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.
(5) Application side device look-up MUST be based on the serial number string
in addition to VID/PID matching. The matching must start at the first
character of the serial number string and include the colon character
terminating your domain or e-mail address. It MAY stop anywhere after that.
(6) For devices which implement a particular USB device class (e.g. HID), the
operating system's default class driver MUST be used. If an operating system
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
===============+===============+===========================================
10200 (0x27d8) | 5824 (0x16c0) | For Vendor Class devices with libusb
---------------+---------------+-------------------------------------------
10201 (0x27d9) | 5824 (0x16c0) | For generic HID class devices (which are
| | NOT mice, keyboards or joysticks)
---------------+---------------+-------------------------------------------
10202 (0x27da) | 5824 (0x16c0) | For USB Mice
---------------+---------------+-------------------------------------------
10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards
---------------+---------------+-------------------------------------------
10204 (0x27dc) | 5824 (0x16c0) | For USB Joysticks
---------------+---------------+-------------------------------------------
10205 (0x27dd) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
---------------+---------------+-------------------------------------------
10206 (0x27de) | 5824 (0x16c0) | For MIDI class devices
---------------+---------------+-------------------------------------------
=================
ORIGIN OF USB-IDs
=================
OBJECTIVE DEVELOPMENT Software GmbH has obtained all VID/PID pairs listed
here 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".
==========
DISCLAIMER
==========
OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any
problems which are caused by the shared use of these VID/PID pairs.

View File

@ -0,0 +1,187 @@
/* 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)
*/
/* 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<<USB_INTR_PENDING_BIT
USB_STORE_PENDING(x2) ; clear any pending interrupts
ignorePacket:
clr token
rjmp storeTokenAndReturn
;----------------------------------------------------------------------------
; 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.
se0:
subi cnt, USB_BUFSIZE ;[5]
neg cnt ;[6]
sub YL, cnt ;[7]
sbci YH, 0 ;[8]
ldi x2, 1<<USB_INTR_PENDING_BIT ;[9]
USB_STORE_PENDING(x2) ;[10] clear pending intr and check flag later. SE0 should be over.
ld token, y ;[11]
cpi token, USBPID_DATA0 ;[13]
breq handleData ;[14]
cpi token, USBPID_DATA1 ;[15]
breq handleData ;[16]
lds shift, usbDeviceAddr;[17]
ldd x2, y+1 ;[19] ADDR and 1 bit endpoint number
lsl x2 ;[21] shift out 1 bit endpoint number
cpse x2, shift ;[22]
rjmp ignorePacket ;[23]
/* only compute endpoint number in x3 if required later */
#if USB_CFG_HAVE_INTRIN_ENDPOINT || USB_CFG_IMPLEMENT_FN_WRITEOUT
ldd x3, y+2 ;[24] endpoint number + crc
rol x3 ;[26] shift in LSB of endpoint
#endif
cpi token, USBPID_IN ;[27]
breq handleIn ;[28]
cpi token, USBPID_SETUP ;[29]
breq handleSetupOrOut ;[30]
cpi token, USBPID_OUT ;[31]
brne ignorePacket ;[32] must be ack, nak or whatever
; rjmp handleSetupOrOut ; fallthrough
;Setup and Out are followed by a data packet two bit times (16 cycles) after
;the end of SE0. The sync code allows up to 40 cycles delay from the start of
;the sync pattern until the first bit is sampled. That's a total of 56 cycles.
handleSetupOrOut: ;[32]
#if USB_CFG_IMPLEMENT_FN_WRITEOUT /* if we have data for endpoint != 0, set usbCurrentTok to address */
andi x3, 0xf ;[32]
breq storeTokenAndReturn ;[33]
mov token, x3 ;[34] indicate that this is endpoint x OUT
#endif
storeTokenAndReturn:
sts usbCurrentTok, token;[35]
doReturn:
POP_STANDARD ;[37] 12...16 cycles
USB_LOAD_PENDING(YL) ;[49]
sbrc YL, USB_INTR_PENDING_BIT;[50] check whether data is already arriving
rjmp waitForJ ;[51] save the pops and pushes -- a new interrupt is already pending
sofError:
POP_RETI ;macro call
reti
handleData:
#if USB_CFG_CHECK_CRC
CRC_CLEANUP_AND_CHECK ; jumps to ignorePacket if CRC error
#endif
lds shift, usbCurrentTok;[18]
tst shift ;[20]
breq doReturn ;[21]
lds x2, usbRxLen ;[22]
tst x2 ;[24]
brne sendNakAndReti ;[25]
; 2006-03-11: The following two lines fix a problem where the device was not
; recognized if usbPoll() was called less frequently than once every 4 ms.
cpi cnt, 4 ;[26] zero sized data packets are status phase only -- ignore and ack
brmi sendAckAndReti ;[27] keep rx buffer clean -- we must not NAK next SETUP
#if USB_CFG_CHECK_DATA_TOGGLING
sts usbCurrentDataToken, token ; store for checking by C code
#endif
sts usbRxLen, cnt ;[28] store received data, swap buffers
sts usbRxToken, shift ;[30]
lds x2, usbInputBufOffset;[32] swap buffers
ldi cnt, USB_BUFSIZE ;[34]
sub cnt, x2 ;[35]
sts usbInputBufOffset, cnt;[36] buffers now swapped
rjmp sendAckAndReti ;[38] 40 + 17 = 57 until SOP
handleIn:
;We don't send any data as long as the C code has not processed the current
;input data and potentially updated the output data. That's more efficient
;in terms of code size than clearing the tx buffers when a packet is received.
lds x1, usbRxLen ;[30]
cpi x1, 1 ;[32] negative values are flow control, 0 means "buffer free"
brge sendNakAndReti ;[33] unprocessed input packet?
ldi x1, USBPID_NAK ;[34] prepare value for usbTxLen
#if USB_CFG_HAVE_INTRIN_ENDPOINT
andi x3, 0xf ;[35] x3 contains endpoint
#if USB_CFG_SUPPRESS_INTR_CODE
brne sendNakAndReti ;[36]
#else
brne handleIn1 ;[36]
#endif
#endif
lds cnt, usbTxLen ;[37]
sbrc cnt, 4 ;[39] all handshake tokens have bit 4 set
rjmp sendCntAndReti ;[40] 42 + 16 = 58 until SOP
sts usbTxLen, x1 ;[41] x1 == USBPID_NAK from above
ldi YL, lo8(usbTxBuf) ;[43]
ldi YH, hi8(usbTxBuf) ;[44]
rjmp usbSendAndReti ;[45] 57 + 12 = 59 until SOP
; Comment about when to set usbTxLen to USBPID_NAK:
; We should set it back when we receive the ACK from the host. This would
; be simple to implement: One static variable which stores whether the last
; tx was for endpoint 0 or 1 and a compare in the receiver to distinguish the
; ACK. However, we set it back immediately when we send the package,
; assuming that no error occurs and the host sends an ACK. We save one byte
; RAM this way and avoid potential problems with endless retries. The rest of
; the driver assumes error-free transfers anyway.
#if !USB_CFG_SUPPRESS_INTR_CODE && USB_CFG_HAVE_INTRIN_ENDPOINT /* placed here due to relative jump range */
handleIn1: ;[38]
#if USB_CFG_HAVE_INTRIN_ENDPOINT3
; 2006-06-10 as suggested by O.Tamura: support second INTR IN / BULK IN endpoint
cpi x3, USB_CFG_EP3_NUMBER;[38]
breq handleIn3 ;[39]
#endif
lds cnt, usbTxLen1 ;[40]
sbrc cnt, 4 ;[42] all handshake tokens have bit 4 set
rjmp sendCntAndReti ;[43] 47 + 16 = 63 until SOP
sts usbTxLen1, x1 ;[44] x1 == USBPID_NAK from above
ldi YL, lo8(usbTxBuf1) ;[46]
ldi YH, hi8(usbTxBuf1) ;[47]
rjmp usbSendAndReti ;[48] 50 + 12 = 62 until SOP
#if USB_CFG_HAVE_INTRIN_ENDPOINT3
handleIn3:
lds cnt, usbTxLen3 ;[41]
sbrc cnt, 4 ;[43]
rjmp sendCntAndReti ;[44] 49 + 16 = 65 until SOP
sts usbTxLen3, x1 ;[45] x1 == USBPID_NAK from above
ldi YL, lo8(usbTxBuf3) ;[47]
ldi YH, hi8(usbTxBuf3) ;[48]
rjmp usbSendAndReti ;[49] 51 + 12 = 63 until SOP
#endif
#endif

View File

@ -0,0 +1,49 @@
/* 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), GNU GPL v3 or proprietary (CommercialLicense.txt)
*/
#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

View File

@ -0,0 +1,122 @@
/* 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)
*/
#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<<ODDBG_TXEN);
ODDBG_UBRR = F_CPU / (19200 * 16L) - 1;
}
#else
# define odDebugInit()
#endif
/* ------------------------------------------------------------------------- */
#endif /* __oddebug_h_included__ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
/* 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)
*/
/*
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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,143 @@
/* Name: usbportability.h
* Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
* Author: Christian Starkjohann
* Creation Date: 2008-06-17
* Tabsize: 4
* Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
*/
/*
General Description:
This header is intended to contain all (or at least most of) the compiler
and library dependent stuff. The C code is written for avr-gcc and avr-libc.
The API of other development environments is converted to gcc's and avr-libc's
API by means of defines.
This header also contains all system includes since they depend on the
development environment.
Thanks to Oleg Semyonov for his help with the IAR tools port!
*/
#ifndef __usbportability_h_INCLUDED__
#define __usbportability_h_INCLUDED__
/* We check explicitly for IAR and CodeVision. Default is avr-gcc/avr-libc. */
/* ------------------------------------------------------------------------- */
#if defined __IAR_SYSTEMS_ICC__ || defined __IAR_SYSTEMS_ASM__ /* check for IAR */
/* ------------------------------------------------------------------------- */
#ifndef ENABLE_BIT_DEFINITIONS
# define ENABLE_BIT_DEFINITIONS 1 /* Enable bit definitions */
#endif
/* Include IAR headers */
#include <ioavr.h>
#ifndef __IAR_SYSTEMS_ASM__
# include <inavr.h>
#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 <io.h>
#include <delay.h>
#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 <avr/io.h>
#ifdef __ASSEMBLER__
# define _VECTOR(N) __vector_ ## N /* io.h does not define this for asm */
#else
# include <avr/pgmspace.h>
#endif
#if USB_CFG_DRIVER_FLASH_PAGE
# define USB_READ_FLASH(addr) pgm_read_byte_far(((long)USB_CFG_DRIVER_FLASH_PAGE << 16) | (long)(addr))
#else
# define USB_READ_FLASH(addr) pgm_read_byte(addr)
#endif
#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__ */

Some files were not shown because too many files have changed in this diff Show More