From cf4575b94a3c65e6535a159fc71fc885aebc2620 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 2 Aug 2019 14:02:40 -0700 Subject: Fix the LUFA lib to use a submodule instead of just files (#6245) * Remove LUFA files * Update descriptions for newer version of LUFA * Create PR6245.md * Fix CDC(Serial) type errors * Fix missed merge conflict for AUDIO_DTYPE_CSInterface --- lib/lufa/Bootloaders/Printer/BootloaderAPI.c | 75 - lib/lufa/Bootloaders/Printer/BootloaderAPI.h | 56 - lib/lufa/Bootloaders/Printer/BootloaderAPITable.S | 91 - lib/lufa/Bootloaders/Printer/BootloaderPrinter.c | 487 ---- lib/lufa/Bootloaders/Printer/BootloaderPrinter.h | 108 - lib/lufa/Bootloaders/Printer/BootloaderPrinter.txt | 202 -- lib/lufa/Bootloaders/Printer/Config/LUFAConfig.h | 93 - lib/lufa/Bootloaders/Printer/Descriptors.c | 194 -- lib/lufa/Bootloaders/Printer/Descriptors.h | 96 - lib/lufa/Bootloaders/Printer/asf.xml | 159 -- lib/lufa/Bootloaders/Printer/doxyfile | 2396 -------------------- lib/lufa/Bootloaders/Printer/makefile | 62 - 12 files changed, 4019 deletions(-) delete mode 100644 lib/lufa/Bootloaders/Printer/BootloaderAPI.c delete mode 100644 lib/lufa/Bootloaders/Printer/BootloaderAPI.h delete mode 100644 lib/lufa/Bootloaders/Printer/BootloaderAPITable.S delete mode 100644 lib/lufa/Bootloaders/Printer/BootloaderPrinter.c delete mode 100644 lib/lufa/Bootloaders/Printer/BootloaderPrinter.h delete mode 100644 lib/lufa/Bootloaders/Printer/BootloaderPrinter.txt delete mode 100644 lib/lufa/Bootloaders/Printer/Config/LUFAConfig.h delete mode 100644 lib/lufa/Bootloaders/Printer/Descriptors.c delete mode 100644 lib/lufa/Bootloaders/Printer/Descriptors.h delete mode 100644 lib/lufa/Bootloaders/Printer/asf.xml delete mode 100644 lib/lufa/Bootloaders/Printer/doxyfile delete mode 100644 lib/lufa/Bootloaders/Printer/makefile (limited to 'lib/lufa/Bootloaders/Printer') diff --git a/lib/lufa/Bootloaders/Printer/BootloaderAPI.c b/lib/lufa/Bootloaders/Printer/BootloaderAPI.c deleted file mode 100644 index 2be1568082..0000000000 --- a/lib/lufa/Bootloaders/Printer/BootloaderAPI.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Bootloader user application API functions. - */ - -#include "BootloaderAPI.h" - -void BootloaderAPI_ErasePage(const uint32_t Address) -{ - boot_page_erase_safe(Address); - boot_spm_busy_wait(); - boot_rww_enable(); -} - -void BootloaderAPI_WritePage(const uint32_t Address) -{ - boot_page_write_safe(Address); - boot_spm_busy_wait(); - boot_rww_enable(); -} - -void BootloaderAPI_FillWord(const uint32_t Address, const uint16_t Word) -{ - boot_page_fill_safe(Address, Word); -} - -uint8_t BootloaderAPI_ReadSignature(const uint16_t Address) -{ - return boot_signature_byte_get(Address); -} - -uint8_t BootloaderAPI_ReadFuse(const uint16_t Address) -{ - return boot_lock_fuse_bits_get(Address); -} - -uint8_t BootloaderAPI_ReadLock(void) -{ - return boot_lock_fuse_bits_get(GET_LOCK_BITS); -} - -void BootloaderAPI_WriteLock(const uint8_t LockBits) -{ - boot_lock_bits_set_safe(LockBits); -} diff --git a/lib/lufa/Bootloaders/Printer/BootloaderAPI.h b/lib/lufa/Bootloaders/Printer/BootloaderAPI.h deleted file mode 100644 index c2d9b4a188..0000000000 --- a/lib/lufa/Bootloaders/Printer/BootloaderAPI.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Header file for BootloaderAPI.c. - */ - -#ifndef _BOOTLOADER_API_H_ -#define _BOOTLOADER_API_H_ - - /* Includes: */ - #include - #include - #include - - #include - - /* Function Prototypes: */ - void BootloaderAPI_ErasePage(const uint32_t Address); - void BootloaderAPI_WritePage(const uint32_t Address); - void BootloaderAPI_FillWord(const uint32_t Address, const uint16_t Word); - uint8_t BootloaderAPI_ReadSignature(const uint16_t Address); - uint8_t BootloaderAPI_ReadFuse(const uint16_t Address); - uint8_t BootloaderAPI_ReadLock(void); - void BootloaderAPI_WriteLock(const uint8_t LockBits); - -#endif - diff --git a/lib/lufa/Bootloaders/Printer/BootloaderAPITable.S b/lib/lufa/Bootloaders/Printer/BootloaderAPITable.S deleted file mode 100644 index d8358c31ce..0000000000 --- a/lib/lufa/Bootloaders/Printer/BootloaderAPITable.S +++ /dev/null @@ -1,91 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -; Trampolines to actual API implementations if the target address is outside the -; range of a rjmp instruction (can happen with large bootloader sections) -.section .apitable_trampolines, "ax" -.global BootloaderAPI_Trampolines -BootloaderAPI_Trampolines: - - BootloaderAPI_ErasePage_Trampoline: - jmp BootloaderAPI_ErasePage - BootloaderAPI_WritePage_Trampoline: - jmp BootloaderAPI_WritePage - BootloaderAPI_FillWord_Trampoline: - jmp BootloaderAPI_FillWord - BootloaderAPI_ReadSignature_Trampoline: - jmp BootloaderAPI_ReadSignature - BootloaderAPI_ReadFuse_Trampoline: - jmp BootloaderAPI_ReadFuse - BootloaderAPI_ReadLock_Trampoline: - jmp BootloaderAPI_ReadLock - BootloaderAPI_WriteLock_Trampoline: - jmp BootloaderAPI_WriteLock - BootloaderAPI_UNUSED1: - ret - BootloaderAPI_UNUSED2: - ret - BootloaderAPI_UNUSED3: - ret - BootloaderAPI_UNUSED4: - ret - BootloaderAPI_UNUSED5: - ret - - - -; API function jump table -.section .apitable_jumptable, "ax" -.global BootloaderAPI_JumpTable -BootloaderAPI_JumpTable: - - rjmp BootloaderAPI_ErasePage_Trampoline - rjmp BootloaderAPI_WritePage_Trampoline - rjmp BootloaderAPI_FillWord_Trampoline - rjmp BootloaderAPI_ReadSignature_Trampoline - rjmp BootloaderAPI_ReadFuse_Trampoline - rjmp BootloaderAPI_ReadLock_Trampoline - rjmp BootloaderAPI_WriteLock_Trampoline - rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1 - rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2 - rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3 - rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4 - rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5 - - - -; Bootloader table signatures and information -.section .apitable_signatures, "ax" -.global BootloaderAPI_Signatures -BootloaderAPI_Signatures: - - .long BOOT_START_ADDR ; Start address of the bootloader - .word 0xDF20 ; Signature for the Printer class bootloader - .word 0xDCFB ; Signature for a LUFA class bootloader diff --git a/lib/lufa/Bootloaders/Printer/BootloaderPrinter.c b/lib/lufa/Bootloaders/Printer/BootloaderPrinter.c deleted file mode 100644 index 9021f998f7..0000000000 --- a/lib/lufa/Bootloaders/Printer/BootloaderPrinter.c +++ /dev/null @@ -1,487 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Main source file for the Printer class bootloader. This file contains the complete bootloader logic. - */ - -#include "BootloaderPrinter.h" - -/** LUFA Printer Class driver interface configuration and state information. This structure is - * passed to all Printer Class driver functions, so that multiple instances of the same class - * within a device can be differentiated from one another. - */ -USB_ClassInfo_PRNT_Device_t TextOnly_Printer_Interface = - { - .Config = - { - .InterfaceNumber = INTERFACE_ID_Printer, - .DataINEndpoint = - { - .Address = PRINTER_IN_EPADDR, - .Size = PRINTER_IO_EPSIZE, - .Banks = 1, - }, - .DataOUTEndpoint = - { - .Address = PRINTER_OUT_EPADDR, - .Size = PRINTER_IO_EPSIZE, - .Banks = 1, - }, - .IEEE1284String = - "MFG:Generic;" - "MDL:Generic_/_Text_Only;" - "CMD:1284.4;" - "CLS:PRINTER", - }, - }; - -/** Intel HEX parser state machine state information, to track the contents of - * a HEX file streamed in as a sequence of arbitrary bytes. - */ -struct -{ - /** Current HEX parser state machine state. */ - uint8_t ParserState; - /** Previously decoded numerical byte of data. */ - uint8_t PrevData; - /** Currently decoded numerical byte of data. */ - uint8_t Data; - /** Indicates if both bytes that correspond to a single decoded numerical - * byte of data (HEX encodes values in ASCII HEX, two characters per byte) - * have been read. - */ - bool ReadMSB; - /** Intel HEX record type of the current Intel HEX record. */ - uint8_t RecordType; - /** Numerical bytes of data remaining to be read in the current record. */ - uint8_t DataRem; - /** Checksum of the current record received so far. */ - uint8_t Checksum; - /** Starting address of the last addressed FLASH page. */ - uint32_t PageStartAddress; - /** Current 32-bit byte extended base address in FLASH being targeted. */ - uint32_t CurrBaseAddress; - /** Current 32-bit byte address in FLASH being targeted. */ - uint32_t CurrAddress; -} HEXParser; - -/** Indicates if there is data waiting to be written to a physical page of - * memory in FLASH. - */ -static bool PageDirty = false; - -/** Flag to indicate if the bootloader should be running, or should exit and allow the application code to run - * via a soft reset. When cleared, the bootloader will abort, the USB interface will shut down and the application - * started via a forced watchdog reset. - */ -static bool RunBootloader = true; - -/** Magic lock for forced application start. If the HWBE fuse is programmed and BOOTRST is unprogrammed, the bootloader - * will start if the /HWB line of the AVR is held low and the system is reset. However, if the /HWB line is still held - * low when the application attempts to start via a watchdog reset, the bootloader will re-start. If set to the value - * \ref MAGIC_BOOT_KEY the special init function \ref Application_Jump_Check() will force the application to start. - */ -uint16_t MagicBootKey ATTR_NO_INIT; - - -/** Special startup routine to check if the bootloader was started via a watchdog reset, and if the magic application - * start key has been loaded into \ref MagicBootKey. If the bootloader started via the watchdog and the key is valid, - * this will force the user application to start via a software jump. - */ -void Application_Jump_Check(void) -{ - bool JumpToApplication = false; - - #if (BOARD == BOARD_LEONARDO) - /* Enable pull-up on the IO13 pin so we can use it to select the mode */ - PORTC |= (1 << 7); - Delay_MS(10); - - /* If IO13 is not jumpered to ground, start the user application instead */ - JumpToApplication = ((PINC & (1 << 7)) != 0); - - /* Disable pull-up after the check has completed */ - PORTC &= ~(1 << 7); - #elif ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)) - /* Disable JTAG debugging */ - JTAG_DISABLE(); - - /* Enable pull-up on the JTAG TCK pin so we can use it to select the mode */ - PORTF |= (1 << 4); - Delay_MS(10); - - /* If the TCK pin is not jumpered to ground, start the user application instead */ - JumpToApplication = ((PINF & (1 << 4)) != 0); - - /* Re-enable JTAG debugging */ - JTAG_ENABLE(); - #else - /* Check if the device's BOOTRST fuse is set */ - if (boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS) & FUSE_BOOTRST) - { - /* If the reset source was not an external reset or the key is correct, clear it and jump to the application */ - if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY)) - JumpToApplication = true; - - /* Clear reset source */ - MCUSR &= ~(1 << EXTRF); - } - else - { - /* If the reset source was the bootloader and the key is correct, clear it and jump to the application; - * this can happen in the HWBE fuse is set, and the HBE pin is low during the watchdog reset */ - if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY)) - JumpToApplication = true; - - /* Clear reset source */ - MCUSR &= ~(1 << WDRF); - } - #endif - - /* Don't run the user application if the reset vector is blank (no app loaded) */ - bool ApplicationValid = (pgm_read_word_near(0) != 0xFFFF); - - /* If a request has been made to jump to the user application, honor it */ - if (JumpToApplication && ApplicationValid) - { - /* Turn off the watchdog */ - MCUSR &= ~(1 << WDRF); - wdt_disable(); - - /* Clear the boot key and jump to the user application */ - MagicBootKey = 0; - - // cppcheck-suppress constStatement - ((void (*)(void))0x0000)(); - } -} - -/** - * Converts a given input byte of data from an ASCII encoded HEX value to an integer value. - * - * \note Input HEX bytes are expected to be in uppercase only. - * - * \param[in] Byte ASCII byte of data to convert - * - * \return Integer converted value of the input ASCII encoded HEX byte of data, or -1 if the - * input is not valid ASCII encoded HEX. - */ -static int8_t HexToDecimal(const char Byte) -{ - if ((Byte >= 'A') && (Byte <= 'F')) - return (10 + (Byte - 'A')); - else if ((Byte >= '0') && (Byte <= '9')) - return (Byte - '0'); - - return -1; -} - -/** - * Flushes a partially written page of data to physical FLASH, if a page - * boundary has been crossed. - * - * \note If a page flush occurs the global HEX parser state is updated. - */ -static void FlushPageIfRequired(void) -{ - /* Abort if no data has been buffered for writing to the current page */ - if (!PageDirty) - return; - - /* Flush the FLASH page to physical memory if we are crossing a page boundary */ - uint32_t NewPageStartAddress = (HEXParser.CurrAddress & ~(SPM_PAGESIZE - 1)); - if (HEXParser.PageStartAddress != NewPageStartAddress) - { - boot_page_write(HEXParser.PageStartAddress); - boot_spm_busy_wait(); - - HEXParser.PageStartAddress = NewPageStartAddress; - - PageDirty = false; - } -} - -/** - * Parses an input Intel HEX formatted stream one character at a time, loading - * the data contents into the device's internal FLASH memory. - * - * \param[in] ReadCharacter Next input ASCII byte of data to parse - */ -static void ParseIntelHEXByte(const char ReadCharacter) -{ - /* Reset the line parser while waiting for a new line to start */ - if ((HEXParser.ParserState == HEX_PARSE_STATE_WAIT_LINE) || (ReadCharacter == ':')) - { - HEXParser.Checksum = 0; - HEXParser.CurrAddress = HEXParser.CurrBaseAddress; - HEXParser.ReadMSB = false; - - /* ASCII ':' indicates the start of a new HEX record */ - if (ReadCharacter == ':') - HEXParser.ParserState = HEX_PARSE_STATE_BYTE_COUNT; - - return; - } - - /* Only allow ASCII HEX encoded digits, ignore all other characters */ - int8_t ReadCharacterDec = HexToDecimal(ReadCharacter); - if (ReadCharacterDec < 0) - return; - - /* Read and convert the next nibble of data from the current character */ - HEXParser.Data = (HEXParser.Data << 4) | ReadCharacterDec; - HEXParser.ReadMSB = !HEXParser.ReadMSB; - - /* Only process further when a full byte (two nibbles) have been read */ - if (HEXParser.ReadMSB) - return; - - /* Intel HEX checksum is for all fields except starting character and the - * checksum itself - */ - if (HEXParser.ParserState != HEX_PARSE_STATE_CHECKSUM) - HEXParser.Checksum += HEXParser.Data; - - switch (HEXParser.ParserState) - { - case HEX_PARSE_STATE_BYTE_COUNT: - HEXParser.DataRem = HEXParser.Data; - HEXParser.ParserState = HEX_PARSE_STATE_ADDRESS_HIGH; - break; - - case HEX_PARSE_STATE_ADDRESS_HIGH: - HEXParser.CurrAddress += ((uint16_t)HEXParser.Data << 8); - HEXParser.ParserState = HEX_PARSE_STATE_ADDRESS_LOW; - break; - - case HEX_PARSE_STATE_ADDRESS_LOW: - HEXParser.CurrAddress += HEXParser.Data; - HEXParser.ParserState = HEX_PARSE_STATE_RECORD_TYPE; - break; - - case HEX_PARSE_STATE_RECORD_TYPE: - HEXParser.RecordType = HEXParser.Data; - HEXParser.ParserState = (HEXParser.DataRem ? HEX_PARSE_STATE_READ_DATA : HEX_PARSE_STATE_CHECKSUM); - break; - - case HEX_PARSE_STATE_READ_DATA: - /* Track the number of read data bytes in the record */ - HEXParser.DataRem--; - - /* Protect the bootloader against being written to */ - if (HEXParser.CurrAddress >= BOOT_START_ADDR) - { - HEXParser.ParserState = HEX_PARSE_STATE_WAIT_LINE; - PageDirty = false; - return; - } - - /* Wait for a machine word (two bytes) of data to be read */ - if (HEXParser.DataRem & 0x01) - { - HEXParser.PrevData = HEXParser.Data; - break; - } - - /* Convert the last two received data bytes into a 16-bit word */ - uint16_t NewDataWord = ((uint16_t)HEXParser.Data << 8) | HEXParser.PrevData; - - switch (HEXParser.RecordType) - { - case HEX_RECORD_TYPE_Data: - /* If we are writing to a new page, we need to erase it first */ - if (!(PageDirty)) - { - boot_page_erase(HEXParser.PageStartAddress); - boot_spm_busy_wait(); - - PageDirty = true; - } - - /* Fill the FLASH memory buffer with the new word of data */ - boot_page_fill(HEXParser.CurrAddress, NewDataWord); - HEXParser.CurrAddress += 2; - - /* Flush the FLASH page to physical memory if we are crossing a page boundary */ - FlushPageIfRequired(); - break; - - case HEX_RECORD_TYPE_ExtendedSegmentAddress: - /* Extended address data - store the upper 12-bits of the new address */ - HEXParser.CurrBaseAddress = ((uint32_t)NewDataWord << 4); - break; - - case HEX_RECORD_TYPE_ExtendedLinearAddress: - /* Extended address data - store the upper 16-bits of the new address */ - HEXParser.CurrBaseAddress = ((uint32_t)NewDataWord << 16); - break; - } - - if (!HEXParser.DataRem) - HEXParser.ParserState = HEX_PARSE_STATE_CHECKSUM; - break; - - case HEX_PARSE_STATE_CHECKSUM: - /* Verify checksum of the completed record */ - if (HEXParser.Data != ((~HEXParser.Checksum + 1) & 0xFF)) - break; - - /* Flush the FLASH page to physical memory if we are crossing a page boundary */ - FlushPageIfRequired(); - - /* If end of the HEX file reached, the bootloader should exit at next opportunity */ - if (HEXParser.RecordType == HEX_RECORD_TYPE_EndOfFile) - RunBootloader = false; - - break; - - default: - HEXParser.ParserState = HEX_PARSE_STATE_WAIT_LINE; - break; - } -} - -/** Main program entry point. This routine configures the hardware required by the application, then - * enters a loop to run the application tasks in sequence. - */ -int main(void) -{ - SetupHardware(); - - LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); - GlobalInterruptEnable(); - - while (RunBootloader) - { - uint8_t BytesReceived = PRNT_Device_BytesReceived(&TextOnly_Printer_Interface); - - if (BytesReceived) - { - LEDs_SetAllLEDs(LEDMASK_USB_BUSY); - - while (BytesReceived--) - { - int16_t ReceivedByte = PRNT_Device_ReceiveByte(&TextOnly_Printer_Interface); - - /* Feed the next byte of data to the HEX parser */ - ParseIntelHEXByte(ReceivedByte); - } - - LEDs_SetAllLEDs(LEDMASK_USB_READY); - } - - PRNT_Device_USBTask(&TextOnly_Printer_Interface); - USB_USBTask(); - } - - /* Disconnect from the host - USB interface will be reset later along with the AVR */ - USB_Detach(); - - /* Unlock the forced application start mode of the bootloader if it is restarted */ - MagicBootKey = MAGIC_BOOT_KEY; - - /* Enable the watchdog and force a timeout to reset the AVR */ - wdt_enable(WDTO_250MS); - - for (;;); -} - -/** Configures the board hardware and chip peripherals for the demo's functionality. */ -static void SetupHardware(void) -{ - /* Disable watchdog if enabled by bootloader/fuses */ - MCUSR &= ~(1 << WDRF); - wdt_disable(); - - /* Disable clock division */ - clock_prescale_set(clock_div_1); - - /* Relocate the interrupt vector table to the bootloader section */ - MCUCR = (1 << IVCE); - MCUCR = (1 << IVSEL); - - /* Hardware Initialization */ - LEDs_Init(); - USB_Init(); - - /* Bootloader active LED toggle timer initialization */ - TIMSK1 = (1 << TOIE1); - TCCR1B = ((1 << CS11) | (1 << CS10)); -} - -/** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */ -ISR(TIMER1_OVF_vect, ISR_BLOCK) -{ - LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2); -} - -/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */ -void EVENT_USB_Device_Connect(void) -{ - /* Indicate USB enumerating */ - LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); -} - -/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via - * the status LEDs and stops the Printer management task. - */ -void EVENT_USB_Device_Disconnect(void) -{ - /* Indicate USB not ready */ - LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); -} - -/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration - * of the USB device after enumeration - the device endpoints are configured and the Mass Storage management task started. - */ -void EVENT_USB_Device_ConfigurationChanged(void) -{ - bool ConfigSuccess = true; - - /* Setup Printer Data Endpoints */ - ConfigSuccess &= PRNT_Device_ConfigureEndpoints(&TextOnly_Printer_Interface); - - /* Reset the HEX parser upon successful connection to a host */ - HEXParser.ParserState = HEX_PARSE_STATE_WAIT_LINE; - - /* Indicate endpoint configuration success or failure */ - LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); -} - -/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to - * the device from the USB host before passing along unhandled control requests to the library for processing - * internally. - */ -void EVENT_USB_Device_ControlRequest(void) -{ - PRNT_Device_ProcessControlRequest(&TextOnly_Printer_Interface); -} diff --git a/lib/lufa/Bootloaders/Printer/BootloaderPrinter.h b/lib/lufa/Bootloaders/Printer/BootloaderPrinter.h deleted file mode 100644 index 8bc1a68799..0000000000 --- a/lib/lufa/Bootloaders/Printer/BootloaderPrinter.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Header file for BootloaderPrinter.c. - */ - -#ifndef _BOOTLOADER_PRINTER_H_ -#define _BOOTLOADER_PRINTER_H_ - - /* Includes: */ - #include - #include - #include - #include - - #include "Descriptors.h" - - #include - #include - #include - - /* Preprocessor Checks: */ - #if !defined(__OPTIMIZE_SIZE__) - #error This bootloader requires that it be optimized for size, not speed, to fit into the target device. Change optimization settings and try again. - #endif - - /* Macros: */ - /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ - #define LEDMASK_USB_NOTREADY LEDS_LED1 - - /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ - #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) - - /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ - #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) - - /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ - #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) - - /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ - #define LEDMASK_USB_BUSY LEDS_LED2 - - /** Magic bootloader key to unlock forced application start mode. */ - #define MAGIC_BOOT_KEY 0xDC42 - - /* Enums: */ - /** Intel HEX parser state machine states. */ - enum HEX_Parser_States_t - { - HEX_PARSE_STATE_WAIT_LINE, /**< Parser is waiting for a HEX Start of Line character. */ - HEX_PARSE_STATE_BYTE_COUNT, /**< Parser is waiting for a record byte count. */ - HEX_PARSE_STATE_ADDRESS_HIGH, /**< Parser is waiting for the MSB of a record address. */ - HEX_PARSE_STATE_ADDRESS_LOW, /**< Parser is waiting for the LSB of a record address. */ - HEX_PARSE_STATE_RECORD_TYPE, /**< Parser is waiting for the record type. */ - HEX_PARSE_STATE_READ_DATA, /**< Parser is waiting for more data in the current record. */ - HEX_PARSE_STATE_CHECKSUM, /**< Parser is waiting for the checksum of the current record. */ - }; - - /** Intel HEX record types, used to indicate the type of record contained in a line of a HEX file. */ - enum HEX_Record_Types_t - { - HEX_RECORD_TYPE_Data = 0, /**< Record contains loadable data. */ - HEX_RECORD_TYPE_EndOfFile = 1, /**< End of file record. */ - HEX_RECORD_TYPE_ExtendedSegmentAddress = 2, /**< Extended segment start record. */ - HEX_RECORD_TYPE_StartSegmentAddress = 3, /**< Normal segment start record. */ - HEX_RECORD_TYPE_ExtendedLinearAddress = 4, /**< Extended linear address start record. */ - HEX_RECORD_TYPE_StartLinearAddress = 5, /**< Linear address start record. */ - }; - - /* Function Prototypes: */ - static void SetupHardware(void); - - void EVENT_USB_Device_Connect(void); - void EVENT_USB_Device_Disconnect(void); - void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); - -#endif - diff --git a/lib/lufa/Bootloaders/Printer/BootloaderPrinter.txt b/lib/lufa/Bootloaders/Printer/BootloaderPrinter.txt deleted file mode 100644 index d9aa79686f..0000000000 --- a/lib/lufa/Bootloaders/Printer/BootloaderPrinter.txt +++ /dev/null @@ -1,202 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \mainpage Printer Class USB AVR Bootloader - * - * \section Sec_Compat Demo Compatibility: - * - * The following list indicates what microcontrollers are compatible with this demo. - * - * \li Series 7 USB AVRs (AT90USBxxx7) - * \li Series 6 USB AVRs (AT90USBxxx6) - * \li Series 4 USB AVRs (ATMEGAxxU4) - * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) - * - * \section Sec_Info USB Information: - * - * The following table gives a rundown of the USB utilization of this demo. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
USB Mode:Device
USB Class:Printer Class
USB Subclass:Printer Subclass
Relevant Standards:USBIF Printer Class Standard
Supported USB Speeds:Full Speed Mode
- * - * \section Sec_Description Project Description: - * - * This bootloader enumerates to the host as a Generic Text Only Printer device, capable of reading and parsing - * "printed" plain-text Intel HEX files to load firmware onto the AVR. - * - * Out of the box this bootloader builds for the AT90USB1287 with an 8KB bootloader section size, and will fit - * into 4KB of bootloader space. If you wish to alter this size and/or change the AVR model, you will need to - * edit the MCU, FLASH_SIZE_KB and BOOT_SECTION_SIZE_KB values in the accompanying makefile. - * - * When the bootloader is running, the board's LED(s) will flash at regular intervals to distinguish the - * bootloader from the normal user application. - * - * \section Sec_Running Running the Bootloader - * - * On the USB AVR8 devices, setting the \c HWBE device fuse will cause the bootloader to run if the \c HWB pin of - * the AVR is grounded when the device is reset. - * - * The are two behaviours of this bootloader, depending on the device's fuses: - * - * If the device's BOOTRST fuse is set, the bootloader will run any time the system is reset from - * the external reset pin, unless no valid user application has been loaded. To initiate the bootloader, the - * device's external reset pin should be grounded momentarily. - * - * If the device's BOOTRST fuse is not set, the bootloader will run only if initiated via a software - * jump, or if the \c HWB pin was low during the last device reset (if the \c HWBE fuse is set). - * - * For board specific exceptions to the above, see below. - * - * \subsection SSec_XPLAIN Atmel Xplain Board - * Ground the USB AVR JTAG's \c TCK pin to ground when powering on the board to start the bootloader. This assumes the - * \c HWBE fuse is cleared and the \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board. - * - * \subsection SSec_Leonardo Arduino Leonardo Board - * Ground \c IO13 when powering the board to start the bootloader. This assumes the \c HWBE fuse is cleared and the - * \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board. - * - * \section Sec_Installation Driver Installation - * - * This bootloader uses the Generic Text-Only printer drivers inbuilt into all modern operating systems, thus no - * additional drivers need to be supplied for correct operation. - * - * \section Sec_HostApp Host Controller Application - * - * This bootloader is compatible with Notepad under Windows, and the command line \c lpr utility under Linux. - * - * \subsection SSec_Notepad Notepad (Windows) - * - * While most text applications under Windows will be compatible with the bootloader, the inbuilt Notepad utility - * is recommended as it will introduce minimal formatting changes to the output stream. To program with Notepad, - * open the target HEX file and print it to the Generic Text Only printer device the bootloader creates. - * - * \subsection SSec_LPR LPR (Linux) - * - * While the CUPS framework under Linux will enumerate the bootloader as a Generic Text-Only printer, many - * applications will refuse to print to the device due to the lack of rich formatting options available. As a result, - * under Linux HEX files must be printed via the low level \c lpr utility instead. - * - * \code - * cat Mouse.hex | lpr - * \endcode - * - * \section Sec_API User Application API - * - * Several user application functions for FLASH and other special memory area manipulations are exposed by the bootloader, - * allowing the user application to call into the bootloader at runtime to read and write FLASH data. - * - * By default, the bootloader API jump table is located 32 bytes from the end of the device's FLASH memory, and follows the - * following layout: - * - * \code - * #define BOOTLOADER_API_TABLE_SIZE 32 - * #define BOOTLOADER_API_TABLE_START ((FLASHEND + 1UL) - BOOTLOADER_API_TABLE_SIZE) - * #define BOOTLOADER_API_CALL(Index) (void*)((BOOTLOADER_API_TABLE_START + (Index * 2)) / 2) - * - * void (*BootloaderAPI_ErasePage)(uint32_t Address) = BOOTLOADER_API_CALL(0); - * void (*BootloaderAPI_WritePage)(uint32_t Address) = BOOTLOADER_API_CALL(1); - * void (*BootloaderAPI_FillWord)(uint32_t Address, uint16_t Word) = BOOTLOADER_API_CALL(2); - * uint8_t (*BootloaderAPI_ReadSignature)(uint16_t Address) = BOOTLOADER_API_CALL(3); - * uint8_t (*BootloaderAPI_ReadFuse)(uint16_t Address) = BOOTLOADER_API_CALL(4); - * uint8_t (*BootloaderAPI_ReadLock)(void) = BOOTLOADER_API_CALL(5); - * void (*BootloaderAPI_WriteLock)(uint8_t LockBits) = BOOTLOADER_API_CALL(6); - * - * #define BOOTLOADER_MAGIC_SIGNATURE_START (BOOTLOADER_API_TABLE_START + (BOOTLOADER_API_TABLE_SIZE - 2)) - * #define BOOTLOADER_MAGIC_SIGNATURE 0xDCFB - * - * #define BOOTLOADER_CLASS_SIGNATURE_START (BOOTLOADER_API_TABLE_START + (BOOTLOADER_API_TABLE_SIZE - 4)) - * #define BOOTLOADER_PRINTER_SIGNATURE 0xDF20 - * - * #define BOOTLOADER_ADDRESS_START (BOOTLOADER_API_TABLE_START + (BOOTLOADER_API_TABLE_SIZE - 8)) - * #define BOOTLOADER_ADDRESS_LENGTH 4 - * \endcode - * - * From the application the API support of the bootloader can be detected by reading the FLASH memory bytes located at address - * \c BOOTLOADER_MAGIC_SIGNATURE_START and comparing them to the value \c BOOTLOADER_MAGIC_SIGNATURE. The class of bootloader - * can be determined by reading the FLASH memory bytes located at address \c BOOTLOADER_CLASS_SIGNATURE_START and comparing them - * to the value \c BOOTLOADER_PRINTER_SIGNATURE. The start address of the bootloader can be retrieved by reading the bytes of FLASH - * memory starting from address \c BOOTLOADER_ADDRESS_START. - * - * \subsection SSec_API_MemLayout Device Memory Map - * The following illustration indicates the final memory map of the device when loaded with the bootloader. - * - * \verbatim - * +----------------------------+ 0x0000 - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | User Application | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * +----------------------------+ FLASHEND - BOOT_SECTION_SIZE - * | | - * | Bootloader Application | - * | (Not User App. Accessible) | - * | | - * +----------------------------+ FLASHEND - 96 - * | API Table Trampolines | - * | (Not User App. Accessible) | - * +----------------------------+ FLASHEND - 32 - * | Bootloader API Table | - * | (User App. Accessible) | - * +----------------------------+ FLASHEND - 8 - * | Bootloader ID Constants | - * | (User App. Accessible) | - * +----------------------------+ FLASHEND - * \endverbatim - * - * - * \section Sec_KnownIssues Known Issues: - * - * \par On Linux machines, new firmware fails to be sent to the device via CUPS. - * Only a limited subset of normal printer functionality is exposed via the - * bootloader, causing CUPS to reject print requests from applications that - * are unable to handle true plain-text printing. For best results, the low - * level \c lpr command should be used to print new firmware to the bootloader. - * - * \section Sec_Options Project Options - * - * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value. - * - * - * - * - * - *
- * None - *
- */ - diff --git a/lib/lufa/Bootloaders/Printer/Config/LUFAConfig.h b/lib/lufa/Bootloaders/Printer/Config/LUFAConfig.h deleted file mode 100644 index 5aa0e765bf..0000000000 --- a/lib/lufa/Bootloaders/Printer/Config/LUFAConfig.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief LUFA Library Configuration Header File - * - * This header file is used to configure LUFA's compile time options, - * as an alternative to the compile time constants supplied through - * a makefile. - * - * For information on what each token does, refer to the LUFA - * manual section "Summary of Compile Tokens". - */ - -#ifndef _LUFA_CONFIG_H_ -#define _LUFA_CONFIG_H_ - - #if (ARCH == ARCH_AVR8) - - /* Non-USB Related Configuration Tokens: */ -// #define DISABLE_TERMINAL_CODES - - /* USB Class Driver Related Tokens: */ -// #define HID_HOST_BOOT_PROTOCOL_ONLY -// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} -// #define HID_USAGE_STACK_DEPTH {Insert Value Here} -// #define HID_MAX_COLLECTIONS {Insert Value Here} -// #define HID_MAX_REPORTITEMS {Insert Value Here} -// #define HID_MAX_REPORT_IDS {Insert Value Here} -// #define NO_CLASS_DRIVER_AUTOFLUSH - - /* General USB Driver Related Tokens: */ - #define ORDERED_EP_CONFIG - #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL) - #define USB_DEVICE_ONLY -// #define USB_HOST_ONLY -// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} -// #define NO_LIMITED_CONTROLLER_CONNECT - #define NO_SOF_EVENTS - - /* USB Device Mode Driver Related Tokens: */ - #define USE_RAM_DESCRIPTORS -// #define USE_FLASH_DESCRIPTORS -// #define USE_EEPROM_DESCRIPTORS - #define NO_INTERNAL_SERIAL - #define FIXED_CONTROL_ENDPOINT_SIZE 8 - #define DEVICE_STATE_AS_GPIOR 0 - #define FIXED_NUM_CONFIGURATIONS 1 -// #define CONTROL_ONLY_DEVICE -// #define INTERRUPT_CONTROL_ENDPOINT - #define NO_DEVICE_REMOTE_WAKEUP - #define NO_DEVICE_SELF_POWER - - /* USB Host Mode Driver Related Tokens: */ -// #define HOST_STATE_AS_GPIOR {Insert Value Here} -// #define USB_HOST_TIMEOUT_MS {Insert Value Here} -// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here} -// #define NO_AUTO_VBUS_MANAGEMENT -// #define INVERTED_VBUS_ENABLE_LINE - - #else - - #error Unsupported architecture for this LUFA configuration file. - - #endif -#endif diff --git a/lib/lufa/Bootloaders/Printer/Descriptors.c b/lib/lufa/Bootloaders/Printer/Descriptors.c deleted file mode 100644 index 99625d605a..0000000000 --- a/lib/lufa/Bootloaders/Printer/Descriptors.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * USB Device Descriptors, for library use when in USB device mode. Descriptors are special - * computer-readable structures which the host requests upon device enumeration, to determine - * the device's capabilities and functions. - */ - -#include "Descriptors.h" - - -/** Device descriptor structure. This descriptor, located in SRAM memory, describes the overall - * device characteristics, including the supported USB version, control endpoint size and the - * number of device configurations. The descriptor is read out by the USB host when the enumeration - * process begins. - */ -const USB_Descriptor_Device_t DeviceDescriptor = -{ - .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, - - .USBSpecification = VERSION_BCD(1,1,0), - .Class = USB_CSCP_NoDeviceClass, - .SubClass = USB_CSCP_NoDeviceSubclass, - .Protocol = USB_CSCP_NoDeviceProtocol, - - .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - - .VendorID = 0x03EB, - .ProductID = 0x206B, - .ReleaseNumber = VERSION_BCD(0,0,1), - - .ManufacturerStrIndex = STRING_ID_Manufacturer, - .ProductStrIndex = STRING_ID_Product, - .SerialNumStrIndex = NO_DESCRIPTOR, - - .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS -}; - -/** Configuration descriptor structure. This descriptor, located in SRAM memory, describes the usage - * of the device in one of its supported configurations, including information about any device interfaces - * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting - * a configuration so that the host may correctly communicate with the USB device. - */ -const USB_Descriptor_Configuration_t ConfigurationDescriptor = -{ - .Config = - { - .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), - .TotalInterfaces = 1, - - .ConfigurationNumber = 1, - .ConfigurationStrIndex = NO_DESCRIPTOR, - - .ConfigAttributes = USB_CONFIG_ATTR_RESERVED, - - .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) - }, - - .Printer_Interface = - { - .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - - .InterfaceNumber = INTERFACE_ID_Printer, - .AlternateSetting = 0, - - .TotalEndpoints = 2, - - .Class = PRNT_CSCP_PrinterClass, - .SubClass = PRNT_CSCP_PrinterSubclass, - .Protocol = PRNT_CSCP_BidirectionalProtocol, - - .InterfaceStrIndex = NO_DESCRIPTOR - }, - - .Printer_DataInEndpoint = - { - .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, - - .EndpointAddress = PRINTER_IN_EPADDR, - .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = PRINTER_IO_EPSIZE, - .PollingIntervalMS = 0x05 - }, - - .Printer_DataOutEndpoint = - { - .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, - - .EndpointAddress = PRINTER_OUT_EPADDR, - .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = PRINTER_IO_EPSIZE, - .PollingIntervalMS = 0x05 - } -}; - -/** Language descriptor structure. This descriptor, located in SRAM memory, is returned when the host requests - * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate - * via the language ID table available at USB.org what languages the device supports for its string descriptors. - */ -const USB_Descriptor_String_t LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG); - -/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable - * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device - * Descriptor. - */ -const USB_Descriptor_String_t ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera"); - -/** Product descriptor string. This is a Unicode string containing the product's details in human readable form, - * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device - * Descriptor. - */ -const USB_Descriptor_String_t ProductString = USB_STRING_DESCRIPTOR(L"LUFA Printer Bootloader"); - -/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" - * documentation) by the application code so that the address and size of a requested descriptor can be given - * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function - * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the - * USB host. - */ -uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint16_t wIndex, - const void** const DescriptorAddress) -{ - const uint8_t DescriptorType = (wValue >> 8); - const uint8_t DescriptorNumber = (wValue & 0xFF); - - const void* Address = NULL; - uint16_t Size = NO_DESCRIPTOR; - - switch (DescriptorType) - { - case DTYPE_Device: - Address = &DeviceDescriptor; - Size = sizeof(USB_Descriptor_Device_t); - break; - case DTYPE_Configuration: - Address = &ConfigurationDescriptor; - Size = sizeof(USB_Descriptor_Configuration_t); - break; - case DTYPE_String: - switch (DescriptorNumber) - { - case STRING_ID_Language: - Address = &LanguageString; - Size = LanguageString.Header.Size; - break; - case STRING_ID_Manufacturer: - Address = &ManufacturerString; - Size = ManufacturerString.Header.Size; - break; - case STRING_ID_Product: - Address = &ProductString; - Size = ProductString.Header.Size; - break; - } - - break; - } - - *DescriptorAddress = Address; - return Size; -} - diff --git a/lib/lufa/Bootloaders/Printer/Descriptors.h b/lib/lufa/Bootloaders/Printer/Descriptors.h deleted file mode 100644 index adb0dddb64..0000000000 --- a/lib/lufa/Bootloaders/Printer/Descriptors.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Header file for Descriptors.c. - */ - -#ifndef _DESCRIPTORS_H_ -#define _DESCRIPTORS_H_ - - /* Includes: */ - #include - - #include - - /* Macros: */ - /** Endpoint address of the Printer device-to-host data IN endpoint. */ - #define PRINTER_IN_EPADDR (ENDPOINT_DIR_IN | 3) - - /** Endpoint address of the Printer host-to-device data OUT endpoint. */ - #define PRINTER_OUT_EPADDR (ENDPOINT_DIR_OUT | 4) - - /** Size in bytes of the Printer data endpoints. */ - #define PRINTER_IO_EPSIZE 64 - - /* Type Defines: */ - /** Type define for the device configuration descriptor structure. This must be defined in the - * application code, as the configuration descriptor contains several sub-descriptors which - * vary between devices, and which describe the device's usage to the host. - */ - typedef struct - { - USB_Descriptor_Configuration_Header_t Config; - - // Printer Interface - USB_Descriptor_Interface_t Printer_Interface; - USB_Descriptor_Endpoint_t Printer_DataInEndpoint; - USB_Descriptor_Endpoint_t Printer_DataOutEndpoint; - } USB_Descriptor_Configuration_t; - - /** Enum for the device interface descriptor IDs within the device. Each string descriptor - * should have a unique ID index associated with it, which can be used to refer to the - * interface from other descriptors. - */ - enum InterfaceDescriptors_t - { - INTERFACE_ID_Printer = 0, /**< Printer interface descriptor ID */ - }; - - /** Enum for the device string descriptor IDs within the device. Each string descriptor should - * have a unique ID index associated with it, which can be used to refer to the string from - * other descriptors. - */ - enum StringDescriptors_t - { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ - }; - - /* Function Prototypes: */ - uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint16_t wIndex, - const void** const DescriptorAddress) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); - -#endif - diff --git a/lib/lufa/Bootloaders/Printer/asf.xml b/lib/lufa/Bootloaders/Printer/asf.xml deleted file mode 100644 index b5c0c6b3a5..0000000000 --- a/lib/lufa/Bootloaders/Printer/asf.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Printer Class Bootloader, capable of reprogramming a device by "printing" new HEX files to the virtual Plain-Text printer it creates when plugged into a host. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/lufa/Bootloaders/Printer/doxyfile b/lib/lufa/Bootloaders/Printer/doxyfile deleted file mode 100644 index 0f96bb9b73..0000000000 --- a/lib/lufa/Bootloaders/Printer/doxyfile +++ /dev/null @@ -1,2396 +0,0 @@ -# Doxyfile 1.8.9 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the