Statistics
| Branch: | Revision:

root / arduino-1.0 / hardware / arduino / bootloaders / diskloader / src / Platform.h @ 58d82c77

History | View | Annotate | Download (1.38 KB)

1

    
2
#include <inttypes.h>
3
#include <avr/io.h>
4
#include <avr/pgmspace.h>
5
#include <avr/boot.h>
6
#include <util/delay.h>
7
#include <avr/interrupt.h>
8
#include <avr/wdt.h>
9

    
10
#include <stdio.h>
11
#include <stdlib.h>
12
#include <string.h>
13

    
14
typedef unsigned char u8;
15
typedef unsigned short u16;
16
typedef unsigned long u32;
17

    
18

    
19
#define CPU_PRESCALE(n)        (CLKPR = 0x80, CLKPR = (n))
20
#define DISABLE_JTAG()  MCUCR = (1 << JTD) | (1 << IVCE) | (0 << PUD); MCUCR = (1 << JTD) | (0 << IVSEL) | (0 << IVCE) | (0 << PUD);
21

    
22
#define USB_PID_LEONARDO 0x0034
23
#define USB_PID_MICRO 0x0035
24
#define USB_VID 0x2341        // arduino LLC vid
25
#define USB_PID ARDUINO_MODEL_PID        // passed in by Makefile - 0x0034 for Leonardo, 0x0035 for MIcro
26

    
27
#define USB_SERIAL_STRING        '0','0','0','0','0','0','0','0','1','7','0','1'
28

    
29
#define OEM_NAME                'l','e','o','n','a','r','d','o'                                        // 8 chars
30
#define BOARD_INIT()        DDRC |= (1<<7); DDRB |= (1<<0); DDRD |= (1<<5); CPU_PRESCALE(0); DISABLE_JTAG();
31
#define LED0                        PORTC &= ~(1<<7)
32
#define LED1                        PORTC |= (1<<7)
33
#define TXLED0                        PORTD |= (1<<5)
34
#define TXLED1                        PORTD &= ~(1<<5)
35
#define RXLED0                        PORTB |= (1<<0)
36
#define RXLED1                        PORTB &= ~(1<<0)
37

    
38
#define TRANSFER_PGM                0x80
39
#define TRANSFER_RELEASE        0x40
40
#define TRANSFER_ZERO                0x20
41

    
42
void Transfer(u8 ep, const u8* data, int len);
43
void Recv(u8 ep, u8* dst, u8 len);
44
void Program(u8 ep, u16 page, u8 count);
45

    
46
#define CDC_ENABLED
47

    
48
#include "USBCore.h"
49
#include "USBDesc.h"
50

    
51