From 0ab2cb1c698017e4a81ec17d8677de09553e8683 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Thu, 27 Oct 2011 10:45:13 -0400 Subject: removed old comments and unused USB core code --- bootloaders/diskloader/src/CDC.cpp | 77 ---------------------------------- bootloaders/diskloader/src/Platform.h | 4 -- bootloaders/diskloader/src/USBAPI.h | 21 +--------- bootloaders/diskloader/src/USBCore.cpp | 19 +-------- bootloaders/diskloader/src/USBCore.h | 49 ---------------------- bootloaders/diskloader/src/USBDesc.h | 22 ---------- 6 files changed, 2 insertions(+), 190 deletions(-) diff --git a/bootloaders/diskloader/src/CDC.cpp b/bootloaders/diskloader/src/CDC.cpp index cc798b4..a542d3c 100644 --- a/bootloaders/diskloader/src/CDC.cpp +++ b/bootloaders/diskloader/src/CDC.cpp @@ -23,13 +23,6 @@ #if defined(USBCON) #ifdef CDC_ENABLED -void Reboot() -{ - USB.detach(); - cli(); - asm volatile("jmp 0x7800"); // jump to bootloader - DiskLoader takes up last 2 kB -} - typedef struct { u32 dwDTERate; @@ -92,8 +85,6 @@ bool WEAK CDC_Setup(Setup& setup) if (CDC_SET_CONTROL_LINE_STATE == r) { -// if (0 != _usbLineInfo.lineState && 1200 == _usbLineInfo.dwDTERate) // auto-reset is triggered when the port, already open at 1200 bps, is closed -// Reboot(); _usbLineInfo.lineState = setup.wValueL; return true; } @@ -101,73 +92,5 @@ bool WEAK CDC_Setup(Setup& setup) return false; } -/* -int _serialPeek = -1; -void Serial_::begin(uint16_t baud_count) -{ -} - -void Serial_::end(void) -{ -} - -int Serial_::available(void) -{ - u8 avail = USB_Available(CDC_RX); - if (_serialPeek != -1) - avail++; - return avail; -} - -// peek is nasty -int Serial_::peek(void) -{ - if (_serialPeek == -1) - _serialPeek = read(); - return _serialPeek; -} - -int Serial_::read(void) -{ - int c; - if (_serialPeek != -1) - { - c = _serialPeek; - _serialPeek = -1; - } else { - c = USB_Recv(CDC_RX); - } - return c; -} - - - -void Serial_::flush(void) -{ - USB_Flush(CDC_TX); -} - -size_t Serial_::write(uint8_t c) -{ - - // TODO - ZE - check behavior on different OSes and test what happens if an - // open connection isn't broken cleanly (cable is yanked out, host dies - // or locks up, or host virtual serial port hangs) - if (_usbLineInfo.lineState > 0) { - int r = USB_Send(CDC_TX,&c,1); - if (r > 0) { - return r; - } else { -// setWriteError(); - return 0; - } - } -// setWriteError(); - return 0; -} - -Serial_ Serial; -*/ - #endif #endif /* if defined(USBCON) */ \ No newline at end of file diff --git a/bootloaders/diskloader/src/Platform.h b/bootloaders/diskloader/src/Platform.h index 4b58f9f..9416c47 100644 --- a/bootloaders/diskloader/src/Platform.h +++ b/bootloaders/diskloader/src/Platform.h @@ -32,10 +32,6 @@ typedef unsigned long u32; #define USB_VID 0x2341 // arduino LLC vid #define USB_PID ARDUINO_MODEL_PID // passed in by Makefile - 0x0034 for Leonardo, 0x0035 for MIcro -//#include "USBDesc.h" -//#include "../../../cores/arduino/USBCore.h" - - #define min(a,b) ((a)<(b)?(a):(b)) #define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) diff --git a/bootloaders/diskloader/src/USBAPI.h b/bootloaders/diskloader/src/USBAPI.h index 1724ce1..f8d71c8 100644 --- a/bootloaders/diskloader/src/USBAPI.h +++ b/bootloaders/diskloader/src/USBAPI.h @@ -21,24 +21,6 @@ public: }; extern USB_ USB; -//================================================================================ -//================================================================================ -// Serial over CDC (Serial1 is the physical port) - -class Serial_ -{ -public: - void begin(uint16_t baud_count); - void end(void); - - virtual int available(void); - virtual int peek(void); - virtual int read(void); - virtual void flush(void); - virtual size_t write(uint8_t); -}; -extern Serial_ Serial; - //================================================================================ //================================================================================ // Low level API @@ -79,5 +61,4 @@ int USB_Recv(uint8_t ep); // non-blocking void USB_Flush(uint8_t ep); #endif - -#endif /* if defined(USBCON) */ \ No newline at end of file +#endif /* if defined(USBCON) */ diff --git a/bootloaders/diskloader/src/USBCore.cpp b/bootloaders/diskloader/src/USBCore.cpp index 56944e5..4771181 100644 --- a/bootloaders/diskloader/src/USBCore.cpp +++ b/bootloaders/diskloader/src/USBCore.cpp @@ -1,5 +1,4 @@ - /* Copyright (c) 2010, Peter Barrett ** ** Permission to use, copy, modify, and/or distribute this software for @@ -219,7 +218,6 @@ u8 USB_Available(u8 ep) void USB_Recv_block(u8 ep, u8* dst, int len) { -// SetEP(ep & 7); LockEP lock(ep); while (len--) { @@ -277,16 +275,11 @@ int USB_Send(u8 ep, const void* d, int len) int r = len; const u8* data = (const u8*)d; -// u8 zero = ep & TRANSFER_ZERO; - u8 timeout = 250; // 250ms timeout on send? TODO while (len) { u8 n = USB_SendSpace(ep); if (n == 0) { -// if (!(--timeout)) -// return -1; -// delay(1); _delay_ms(1); continue; } @@ -333,10 +326,6 @@ const u8 _initEndpoints[] = EP_TYPE_BULK_OUT, // CDC_ENDPOINT_OUT EP_TYPE_BULK_IN, // CDC_ENDPOINT_IN #endif - -#ifdef HID_ENABLED - EP_TYPE_INTERRUPT_IN // HID_ENDPOINT_INT -#endif }; #define EP_SINGLE_64 0x32 // EP0 @@ -469,10 +458,6 @@ bool SendDescriptor(Setup& setup) return SendConfiguration(setup.wLength); InitControl(setup.wLength); -#ifdef HID_ENABLED - if (HID_REPORT_DESCRIPTOR_TYPE == t) - return HID_GetDescriptor(t); -#endif u8 desc_length = 0; const u8* desc_addr = 0; @@ -607,9 +592,7 @@ ISR(USB_GEN_vect) // Start of Frame - happens every millisecond so we use it for TX and RX LED one-shot timing, too if (udint & (1<