From 0ed2d3c95309ecf5905ec06624fc68955fdbd2d0 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Tue, 10 Jan 2012 16:29:47 -0500 Subject: renamed DiskLoader to Caterina (after Leonardo's mom) --- bootloaders/caterina/src/Platform.h | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 bootloaders/caterina/src/Platform.h (limited to 'bootloaders/caterina/src/Platform.h') diff --git a/bootloaders/caterina/src/Platform.h b/bootloaders/caterina/src/Platform.h new file mode 100644 index 0000000..9d18e80 --- /dev/null +++ b/bootloaders/caterina/src/Platform.h @@ -0,0 +1,49 @@ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#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 USB_PID_LEONARDO_BOOTLOADER 0x0030 +#define USB_PID_MICRO_BOOTLOADER 0x0031 +#define USB_VID 0x2341 // arduino LLC vid +#define USB_PID ARDUINO_MODEL_PID // passed in by Makefile - 0x0034 for Leonardo, 0x0035 for MIcro + +#define USB_SERIAL_STRING '0','0','0','0','0','0','0','0','1','7','0','1' + +#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 L_LED_OFF() PORTC &= ~(1<<7) +#define L_LED_ON() PORTC |= (1<<7) +#define TX_LED_OFF() PORTD |= (1<<5) +#define TX_LED_ON() PORTD &= ~(1<<5) +#define RX_LED_OFF() PORTB |= (1<<0) +#define RX_LED_ON() PORTB &= ~(1<<0) + +#define TRANSFER_PGM 0x80 +#define TRANSFER_RELEASE 0x40 +#define TRANSFER_ZERO 0x20 + +void Transfer(uint8_t ep, const uint8_t* data, int len); +void Recv(uint8_t ep, uint8_t* dst, uint8_t len); +void Program(uint8_t ep, uint16_t page, uint8_t count); + +/* HID is not fully-supported in the bootloader - can be enabled + for testing, but note the descriptor report and other parts are + not complete */ +//#define HID_ENABLED + +#include "USBCore.h" +#include "USBDesc.h" + + -- cgit v1.2.3-18-g5258