diff options
author | Zach Eveland <zeveland@blacklabel-development.com> | 2011-11-09 14:04:59 -0500 |
---|---|---|
committer | Zach Eveland <zeveland@blacklabel-development.com> | 2011-11-09 14:04:59 -0500 |
commit | 4b7771a8159f47891311bbac6d97eac33868bc65 (patch) | |
tree | 729f0940bad89ec074aeb4cdb189f1b2839e744a /bootloaders/diskloader/src/Platform.h | |
parent | bca358b9739c8bf7e4dd9808b97acc90cf0b6ab3 (diff) |
restored original non-interrupt-driven DiskLoader
Interrupt-driven version was a dead-end - too many bugs with that approach.
Diffstat (limited to 'bootloaders/diskloader/src/Platform.h')
-rw-r--r-- | bootloaders/diskloader/src/Platform.h | 63 |
1 files changed, 23 insertions, 40 deletions
diff --git a/bootloaders/diskloader/src/Platform.h b/bootloaders/diskloader/src/Platform.h index d1f884c..6acbf39 100644 --- a/bootloaders/diskloader/src/Platform.h +++ b/bootloaders/diskloader/src/Platform.h @@ -1,9 +1,3 @@ -/* - * Platform.h - */ - -#ifndef __PLATFORM_H__ -#define __PLATFORM_H__ #include <inttypes.h> #include <avr/io.h> @@ -17,50 +11,39 @@ #include <stdlib.h> #include <string.h> -#ifdef __cplusplus -extern "C"{ -#endif - typedef unsigned char u8; typedef unsigned short u16; typedef unsigned long u32; -#define USB_PID_LEONARDO 0x0032 -#define USB_PID_MICRO 0x0033 -#define USB_VID 0x2341 // arduino LLC vid -#define USB_PID ARDUINO_MODEL_PID // passed in by Makefile - 0x0032 for Leonardo, 0x0033 for Micro - -#define min(a,b) ((a)<(b)?(a):(b)) #define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) -#define DISABLE_JTAG() MCUCR = (1 << JTD) | (1 << IVCE) | (0 << PUD); MCUCR = (1 << JTD) | (0 << IVSEL) | (0 << IVCE) | (0 << PUD) +#define DISABLE_JTAG() MCUCR = (1 << JTD) | (1 << IVCE) | (0 << PUD); MCUCR = (1 << JTD) | (0 << IVSEL) | (0 << IVCE) | (0 << PUD); -#define BOARD_INIT() DDRC |= (1<<7); DDRB |= (1<<0); DDRE |= (1<<6); CPU_PRESCALE(0); DISABLE_JTAG(); // for XXX-series boards -//#define BOARD_INIT() DDRC |= (1<<7); DDRB |= (1<<0); DDRD |= (1<<5); CPU_PRESCALE(0); DISABLE_JTAG(); // for non-XXX boards +#define USB_PID_LEONARDO 0x0034 +#define USB_PID_MICRO 0x0035 +#define USB_VID 0x2341 // arduino LLC vid +#define USB_PID ARDUINO_MODEL_PID // passed in by Makefile - 0x0034 for Leonardo, 0x0035 for MIcro + +#define OEM_NAME 'l','e','o','n','a','r','d','o' // 8 chars +#define BOARD_INIT() DDRC |= (1<<7); DDRB |= (1<<0); DDRD |= (1<<5); CPU_PRESCALE(0); DISABLE_JTAG(); +#define LED0 PORTC &= ~(1<<7) +#define LED1 PORTC |= (1<<7) +#define TXLED0 PORTD |= (1<<5) +#define TXLED1 PORTD &= ~(1<<5) +#define RXLED0 PORTB |= (1<<0) +#define RXLED1 PORTB &= ~(1<<0) -// for XXX-series boards -#define TX_LED_OFF() PORTE |= (1<<6) -#define TX_LED_ON() PORTE &= ~(1<<6) -#define RX_LED_OFF() PORTB |= (1<<0) -#define RX_LED_ON() PORTB &= ~(1<<0) -#define L_LED_OFF() PORTC &= ~(1<<7) -#define L_LED_ON() PORTC |= (1<<7) -#define L_LED_TOGGLE() PORTC ^= (1<<7) +#define TRANSFER_PGM 0x80 +#define TRANSFER_RELEASE 0x40 +#define TRANSFER_ZERO 0x20 -// these for non-XXX boards -//#define LED0 PORTC &= ~(1<<7) -//#define LED1 PORTC |= (1<<7) -//#define TXLED0 PORTD |= (1<<5) -//#define TXLED1 PORTD &= ~(1<<5) -//#define RXLED0 PORTB |= (1<<0) -//#define RXLED1 PORTB &= ~(1<<0) +void Transfer(u8 ep, const u8* data, int len); +void Recv(u8 ep, u8* dst, u8 len); +void Program(u8 ep, u16 page, u8 count); -#ifdef __cplusplus -} /* extern "C"{ */ -#endif +#define CDC_ENABLED +#include "USBCore.h" #include "USBDesc.h" -#include "USBCore.h" -#include "USBAPI.h" -#endif /* __PLATFORM_H__ */ + |