From 60b30c036397cb5627fa374bb930794b225daa29 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 7 Jul 2017 11:55:23 -0400 Subject: Squashed 'lib/lufa/' content from commit 385d40300 git-subtree-dir: lib/lufa git-subtree-split: 385d4030035dbaf41591309dbde47653bd03841b --- Projects/XPLAINBridge/Config/AppConfig.h | 64 + Projects/XPLAINBridge/Config/LUFAConfig.h | 93 + Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf | 66 + Projects/XPLAINBridge/Lib/SoftUART.c | 156 ++ Projects/XPLAINBridge/Lib/SoftUART.h | 71 + Projects/XPLAINBridge/USARTDescriptors.c | 242 +++ Projects/XPLAINBridge/USARTDescriptors.h | 111 ++ Projects/XPLAINBridge/XPLAINBridge.c | 292 ++++ Projects/XPLAINBridge/XPLAINBridge.h | 103 ++ Projects/XPLAINBridge/XPLAINBridge.txt | 89 + Projects/XPLAINBridge/asf.xml | 57 + Projects/XPLAINBridge/doxyfile | 2395 ++++++++++++++++++++++++++ Projects/XPLAINBridge/makefile | 54 + 13 files changed, 3793 insertions(+) create mode 100644 Projects/XPLAINBridge/Config/AppConfig.h create mode 100644 Projects/XPLAINBridge/Config/LUFAConfig.h create mode 100644 Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf create mode 100644 Projects/XPLAINBridge/Lib/SoftUART.c create mode 100644 Projects/XPLAINBridge/Lib/SoftUART.h create mode 100644 Projects/XPLAINBridge/USARTDescriptors.c create mode 100644 Projects/XPLAINBridge/USARTDescriptors.h create mode 100644 Projects/XPLAINBridge/XPLAINBridge.c create mode 100644 Projects/XPLAINBridge/XPLAINBridge.h create mode 100644 Projects/XPLAINBridge/XPLAINBridge.txt create mode 100644 Projects/XPLAINBridge/asf.xml create mode 100644 Projects/XPLAINBridge/doxyfile create mode 100644 Projects/XPLAINBridge/makefile (limited to 'Projects/XPLAINBridge') diff --git a/Projects/XPLAINBridge/Config/AppConfig.h b/Projects/XPLAINBridge/Config/AppConfig.h new file mode 100644 index 0000000000..ce9caaf616 --- /dev/null +++ b/Projects/XPLAINBridge/Config/AppConfig.h @@ -0,0 +1,64 @@ +/* + 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 Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define AUX_LINE_PORT PORTB + #define AUX_LINE_PIN PINB + #define AUX_LINE_DDR DDRB + #define AUX_LINE_MASK (1 << 4) + +// #define ENABLE_ISP_PROTOCOL + #define ENABLE_XPROG_PROTOCOL + + #define VTARGET_ADC_CHANNEL 2 + #define VTARGET_REF_VOLTS 3.3 + #define VTARGET_SCALE_FACTOR 2 +// #define VTARGET_USE_INTERNAL_REF +// #define NO_VTARGET_DETECT +// #define XCK_RESCUE_CLOCK_ENABLE +// #define INVERTED_ISP_MISO + +// #define FIRMWARE_VERSION_MINOR 0x11 + +#endif diff --git a/Projects/XPLAINBridge/Config/LUFAConfig.h b/Projects/XPLAINBridge/Config/LUFAConfig.h new file mode 100644 index 0000000000..2767f33e32 --- /dev/null +++ b/Projects/XPLAINBridge/Config/LUFAConfig.h @@ -0,0 +1,93 @@ +/* + 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 16 + #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/Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf b/Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf new file mode 100644 index 0000000000..45840e8bf0 --- /dev/null +++ b/Projects/XPLAINBridge/LUFA XPLAIN Bridge.inf @@ -0,0 +1,66 @@ +;************************************************************ +; Windows USB CDC ACM Setup File +; Copyright (c) 2000 Microsoft Corporation +;************************************************************ + +[DefaultInstall] +CopyINF="LUFA XPLAIN Bridge.inf" + +[Version] +Signature="$Windows NT$" +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Provider=%MFGNAME% +DriverVer=7/1/2012,10.0.0.0 + +[Manufacturer] +%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 + +[SourceDisksNames] + +[SourceDisksFiles] + +[DestinationDirs] +DefaultDestDir=12 + +[DriverInstall] +Include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=DriverInstall.AddReg + +[DriverInstall.Services] +Include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst + +[DriverInstall.AddReg] +HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" + +;------------------------------------------------------------------------------ +; Vendor and Product ID Definitions +;------------------------------------------------------------------------------ +; When developing your USB device, the VID and PID used in the PC side +; application program and the firmware on the microcontroller must match. +; Modify the below line to use your VID and PID. Use the format as shown below. +; Note: One INF file can be used for multiple devices with different VID and PIDs. +; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. +;------------------------------------------------------------------------------ +[DeviceList] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B + +[DeviceList.NTx86] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B + +[DeviceList.NTamd64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B + +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B + +;------------------------------------------------------------------------------ +; String Definitions +;------------------------------------------------------------------------------ +;Modify these strings to customize your device +;------------------------------------------------------------------------------ +[Strings] +MFGNAME="http://www.lufa-lib.org" +DESCRIPTION="LUFA XPLAIN Bridge" \ No newline at end of file diff --git a/Projects/XPLAINBridge/Lib/SoftUART.c b/Projects/XPLAINBridge/Lib/SoftUART.c new file mode 100644 index 0000000000..5c0e3c8cd9 --- /dev/null +++ b/Projects/XPLAINBridge/Lib/SoftUART.c @@ -0,0 +1,156 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk) + Copyright 2010 Peter Danneger + 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 + * + * Software UART for both data transmission and reception. This + * code continuously monitors the ring buffers set up by the main + * project source file and reads/writes data as it becomes available. + */ + +#include "SoftUART.h" + +/** Total number of bits remaining to be sent in the current frame */ +static uint8_t TX_BitsRemaining; + +/** Temporary data variable to hold the byte being transmitted as it is shifted out */ +static uint8_t TX_Data; + +/** Total number of bits remaining to be received in the current frame */ +static uint8_t RX_BitsRemaining; + +/** Temporary data variable to hold the byte being received as it is shifted in */ +static uint8_t RX_Data; + + +/** Initializes the software UART, ready for data transmission and reception into the global ring buffers. */ +void SoftUART_Init(void) +{ + /* Set TX pin to output high, enable RX pull-up */ + STXPORT |= (1 << STX); + STXDDR |= (1 << STX); + SRXPORT |= (1 << SRX); + + /* Enable INT0 for the detection of incoming start bits that signal the start of a byte */ + EICRA = (1 << ISC01); + EIMSK = (1 << INT0); + + /* Set the transmission and reception timer compare values for the default baud rate */ + SoftUART_SetBaud(9600); + + /* Setup reception timer compare ISR */ + TIMSK1 = (1 << OCIE1A); + + /* Setup transmission timer compare ISR and start the timer */ + TIMSK3 = (1 << OCIE3A); + TCCR3B = ((1 << CS30) | (1 << WGM32)); +} + +/** ISR to detect the start of a bit being sent to the software UART. */ +ISR(INT0_vect, ISR_BLOCK) +{ + /* Reset the number of reception bits remaining counter */ + RX_BitsRemaining = 8; + + /* Reset the bit reception timer to -(1/2) of the total bit time, so that the first data bit is + * sampled mid way through the total bit time, making reception more robust. + */ + TCNT1 = -(OCR1A >> 1); + + /* Check to see that the pin is still low (prevents glitches from starting a frame reception) */ + if (!(SRXPIN & (1 << SRX))) + { + /* Disable start bit detection ISR while the next byte is received */ + EIMSK = 0; + + /* Start the reception timer */ + TCCR1B = ((1 << CS10) | (1 << WGM12)); + } +} + +/** ISR to manage the reception of bits to the software UART. */ +ISR(TIMER1_COMPA_vect, ISR_BLOCK) +{ + /* Cache the current RX pin value for later checking */ + uint8_t SRX_Cached = (SRXPIN & (1 << SRX)); + + /* Check if reception has finished */ + if (RX_BitsRemaining) + { + /* Shift the current received bit mask to the next bit position */ + RX_Data >>= 1; + RX_BitsRemaining--; + + /* Store next bit into the received data variable */ + if (SRX_Cached) + RX_Data |= (1 << 7); + } + else + { + /* Disable the reception timer as all data has now been received, re-enable start bit detection ISR */ + TCCR1B = 0; + EIFR = (1 << INTF0); + EIMSK = (1 << INT0); + + /* Reception complete, store the received byte if stop bit valid */ + if (SRX_Cached) + RingBuffer_Insert(&UARTtoUSB_Buffer, RX_Data); + } +} + +/** ISR to manage the transmission of bits via the software UART. */ +ISR(TIMER3_COMPA_vect, ISR_BLOCK) +{ + /* Check if transmission has finished */ + if (TX_BitsRemaining) + { + /* Set the TX line to the value of the next bit in the byte to send */ + if (TX_Data & (1 << 0)) + STXPORT &= ~(1 << STX); + else + STXPORT |= (1 << STX); + + /* Shift the transmission byte to move the next bit into position and decrement the bits remaining counter */ + TX_Data >>= 1; + TX_BitsRemaining--; + } + else if (!(RX_BitsRemaining) && !(RingBuffer_IsEmpty(&USBtoUART_Buffer))) + { + /* Start bit - TX line low */ + STXPORT &= ~(1 << STX); + + /* Transmission complete, get the next byte to send (if available) */ + TX_Data = ~RingBuffer_Remove(&USBtoUART_Buffer); + TX_BitsRemaining = 9; + } +} + diff --git a/Projects/XPLAINBridge/Lib/SoftUART.h b/Projects/XPLAINBridge/Lib/SoftUART.h new file mode 100644 index 0000000000..b273967814 --- /dev/null +++ b/Projects/XPLAINBridge/Lib/SoftUART.h @@ -0,0 +1,71 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk) + Copyright 2010 Peter Danneger + 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 SoftUART.c. + */ + +#ifndef _SOFT_UART_ +#define _SOFT_UART_ + + /* Includes: */ + #include + #include + #include + + #include "../XPLAINBridge.h" + #include "Config/AppConfig.h" + + /* Macros: */ + #define SRX PD0 + #define SRXPIN PIND + #define SRXPORT PORTD + + #define STX PD1 + #define STXPORT PORTD + #define STXDDR DDRD + + /* Inline Functions: */ + static inline void SoftUART_SetBaud(const uint32_t Baud) + { + uint16_t BitTime = ((F_CPU / Baud) - 1); + + OCR1A = BitTime; + OCR3A = BitTime; + } + + /* Function Prototypes: */ + void SoftUART_Init(void); + +#endif + diff --git a/Projects/XPLAINBridge/USARTDescriptors.c b/Projects/XPLAINBridge/USARTDescriptors.c new file mode 100644 index 0000000000..54f0d96fe6 --- /dev/null +++ b/Projects/XPLAINBridge/USARTDescriptors.c @@ -0,0 +1,242 @@ +/* + 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 "USARTDescriptors.h" + + +/** Device descriptor structure. This descriptor, located in FLASH 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 PROGMEM USART_DeviceDescriptor = +{ + .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, + + .USBSpecification = VERSION_BCD(1,1,0), + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_NoSpecificSubclass, + .Protocol = CDC_CSCP_NoSpecificProtocol, + + .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, + + .VendorID = 0x03EB, + .ProductID = 0x204B, + .ReleaseNumber = VERSION_BCD(0,0,1), + + .ManufacturerStrIndex = USART_STRING_ID_Manufacturer, + .ProductStrIndex = USART_STRING_ID_Product, + .SerialNumStrIndex = USE_INTERNAL_SERIAL, + + .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS +}; + +/** Configuration descriptor structure. This descriptor, located in FLASH 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 USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor = +{ + .Config = + { + .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, + + .TotalConfigurationSize = sizeof(USART_USB_Descriptor_Configuration_t), + .TotalInterfaces = 2, + + .ConfigurationNumber = 1, + .ConfigurationStrIndex = NO_DESCRIPTOR, + + .ConfigAttributes = USB_CONFIG_ATTR_RESERVED, + + .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) + }, + + .CDC_CCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_CDC_CCI, + .AlternateSetting = 0, + + .TotalEndpoints = 1, + + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_ACMSubclass, + .Protocol = CDC_CSCP_ATCommandProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC_Functional_Header = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Header, + + .CDCSpecification = VERSION_BCD(1,1,0), + }, + + .CDC_Functional_ACM = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_ACM, + + .Capabilities = 0x06, + }, + + .CDC_Functional_Union = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Union, + + .MasterInterfaceNumber = INTERFACE_ID_CDC_CCI, + .SlaveInterfaceNumber = INTERFACE_ID_CDC_DCI, + }, + + .CDC_NotificationEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_NOTIFICATION_EPADDR, + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .PollingIntervalMS = 0xFF + }, + + .CDC_DCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_CDC_DCI, + .AlternateSetting = 0, + + .TotalEndpoints = 2, + + .Class = CDC_CSCP_CDCDataClass, + .SubClass = CDC_CSCP_NoDataSubclass, + .Protocol = CDC_CSCP_NoDataProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC_DataOutEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_RX_EPADDR, + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x05 + }, + + .CDC_DataInEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_TX_EPADDR, + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x05 + } +}; + +/** Language descriptor structure. This descriptor, located in FLASH 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 PROGMEM USART_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 PROGMEM USART_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 PROGMEM USART_ProductString = USB_STRING_DESCRIPTOR(L"LUFA XPLAIN Bridge"); + +/** Descriptor retrieval function for the USART Bridge descriptors. This function is in turn called by the GetDescriptor + * callback function in the main source file, to retrieve the device's descriptors when in USART bridge mode. + */ +uint16_t USART_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 = &USART_DeviceDescriptor; + Size = sizeof(USB_Descriptor_Device_t); + break; + case DTYPE_Configuration: + Address = &USART_ConfigurationDescriptor; + Size = sizeof(USART_USB_Descriptor_Configuration_t); + break; + case DTYPE_String: + switch (DescriptorNumber) + { + case USART_STRING_ID_Language: + Address = &USART_LanguageString; + Size = pgm_read_byte(&USART_LanguageString.Header.Size); + break; + case USART_STRING_ID_Manufacturer: + Address = &USART_ManufacturerString; + Size = pgm_read_byte(&USART_ManufacturerString.Header.Size); + break; + case USART_STRING_ID_Product: + Address = &USART_ProductString; + Size = pgm_read_byte(&USART_ProductString.Header.Size); + break; + } + + break; + } + + *DescriptorAddress = Address; + return Size; +} + diff --git a/Projects/XPLAINBridge/USARTDescriptors.h b/Projects/XPLAINBridge/USARTDescriptors.h new file mode 100644 index 0000000000..4f165a1e16 --- /dev/null +++ b/Projects/XPLAINBridge/USARTDescriptors.h @@ -0,0 +1,111 @@ +/* + 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 USARTDescriptors.c. + */ + +#ifndef _USART_DESCRIPTORS_H_ +#define _USART_DESCRIPTORS_H_ + + /* Includes: */ + #include + + #include + + #include "Config/AppConfig.h" + + /* Macros: */ + /** Endpoint address of the CDC device-to-host notification IN endpoint. */ + #define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2) + + /** Endpoint address of the CDC device-to-host data IN endpoint. */ + #define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3) + + /** Endpoint address of the CDC host-to-device data OUT endpoint. */ + #define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4) + + /** Size in bytes of the CDC device-to-host notification IN endpoint. */ + #define CDC_NOTIFICATION_EPSIZE 8 + + /** Size in bytes of the CDC data IN and OUT endpoints. */ + #define CDC_TXRX_EPSIZE 16 + + /* 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; + + // CDC Control Interface + USB_Descriptor_Interface_t CDC_CCI_Interface; + USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header; + USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM; + USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union; + USB_Descriptor_Endpoint_t CDC_NotificationEndpoint; + + // CDC Data Interface + USB_Descriptor_Interface_t CDC_DCI_Interface; + USB_Descriptor_Endpoint_t CDC_DataOutEndpoint; + USB_Descriptor_Endpoint_t CDC_DataInEndpoint; + } USART_USB_Descriptor_Configuration_t; + + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum USART_InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI 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 USART_StringDescriptors_t + { + USART_STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + USART_STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + USART_STRING_ID_Product = 2, /**< Product string ID */ + }; + + /* Function Prototypes: */ + uint16_t USART_GetDescriptor(const uint16_t wValue, + const uint16_t wIndex, + const void** const DescriptorAddress); + +#endif + diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c new file mode 100644 index 0000000000..d901af819c --- /dev/null +++ b/Projects/XPLAINBridge/XPLAINBridge.c @@ -0,0 +1,292 @@ +/* + 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 XPLAINBridge project. This file contains the main tasks of + * the project and is responsible for the initial application hardware configuration. + */ + +#include "XPLAINBridge.h" + +/** Current firmware mode, making the device behave as either a programmer or a USART bridge */ +bool CurrentFirmwareMode = MODE_USART_BRIDGE; + +/** LUFA CDC Class driver interface configuration and state information. This structure is + * passed to all CDC Class driver functions, so that multiple instances of the same class + * within a device can be differentiated from one another. + */ +USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = + { + .Config = + { + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, + .DataINEndpoint = + { + .Address = CDC_TX_EPADDR, + .Size = CDC_TXRX_EPSIZE, + .Banks = 1, + }, + .DataOUTEndpoint = + { + .Address = CDC_RX_EPADDR, + .Size = CDC_TXRX_EPSIZE, + .Banks = 1, + }, + .NotificationEndpoint = + { + .Address = CDC_NOTIFICATION_EPADDR, + .Size = CDC_NOTIFICATION_EPSIZE, + .Banks = 1, + }, + }, + }; + +/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */ +RingBuffer_t USBtoUART_Buffer; + +/** Underlying data buffer for \ref USBtoUART_Buffer, where the stored bytes are located. */ +static uint8_t USBtoUART_Buffer_Data[128]; + +/** Circular buffer to hold data from the serial port before it is sent to the host. */ +RingBuffer_t UARTtoUSB_Buffer; + +/** Underlying data buffer for \ref UARTtoUSB_Buffer, where the stored bytes are located. */ +static uint8_t UARTtoUSB_Buffer_Data[128]; + + +/** Main program entry point. This routine contains the overall program flow, including initial + * setup of all components and the main program loop. + */ +int main(void) +{ + SetupHardware(); + + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); + GlobalInterruptEnable(); + + for (;;) + { + if (CurrentFirmwareMode == MODE_USART_BRIDGE) + UARTBridge_Task(); + else + AVRISP_Task(); + + USB_USBTask(); + } +} + +void AVRISP_Task(void) +{ + /* Must be in the configured state for the AVRISP code to process data */ + if (USB_DeviceState != DEVICE_STATE_Configured) + return; + + V2Params_UpdateParamValues(); + + Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPADDR); + + /* Check to see if a V2 Protocol command has been received */ + if (Endpoint_IsOUTReceived()) + { + LEDs_SetAllLEDs(LEDMASK_BUSY); + + /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */ + V2Protocol_ProcessCommand(); + + LEDs_SetAllLEDs(LEDMASK_USB_READY); + } +} + +void UARTBridge_Task(void) +{ + /* Must be in the configured state for the USART Bridge code to process data */ + if (USB_DeviceState != DEVICE_STATE_Configured) + return; + + /* Only try to read in bytes from the CDC interface if the transmit buffer is not full */ + if (!(RingBuffer_IsFull(&USBtoUART_Buffer))) + { + int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); + + /* Read bytes from the USB OUT endpoint into the UART transmit buffer */ + if (!(ReceivedByte < 0)) + RingBuffer_Insert(&USBtoUART_Buffer, ReceivedByte); + } + + /* Check if the UART receive buffer flush timer has expired or buffer is nearly full */ + uint16_t BufferCount = RingBuffer_GetCount(&UARTtoUSB_Buffer); + if ((TIFR0 & (1 << TOV0)) || (BufferCount > 200)) + { + /* Clear flush timer expiry flag */ + TIFR0 |= (1 << TOV0); + + /* Read bytes from the USART receive buffer into the USB IN endpoint */ + while (BufferCount--) + { + /* Try to send the next byte of data to the host, abort if there is an error without dequeuing */ + if (CDC_Device_SendByte(&VirtualSerial_CDC_Interface, + RingBuffer_Peek(&UARTtoUSB_Buffer)) != ENDPOINT_READYWAIT_NoError) + { + break; + } + + /* Dequeue the already sent byte from the buffer now we have confirmed that no transmission error occurred */ + RingBuffer_Remove(&UARTtoUSB_Buffer); + } + } + + CDC_Device_USBTask(&VirtualSerial_CDC_Interface); +} + +/** Configures the board hardware and chip peripherals for the demo's functionality. */ +void SetupHardware(void) +{ +#if (ARCH == ARCH_AVR8) + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); + + /* Disable clock division */ + clock_prescale_set(clock_div_1); +#endif + + /* Disable JTAG debugging */ + MCUCR |= (1 << JTD); + MCUCR |= (1 << JTD); + + /* Enable pull-up on the JTAG TDI pin so we can use it to select the mode */ + PORTF |= (1 << 7); + Delay_MS(10); + + /* Select the firmware mode based on the JTD pin's value */ + CurrentFirmwareMode = (PINF & (1 << 7)) ? MODE_USART_BRIDGE : MODE_PDI_PROGRAMMER; + + /* Re-enable JTAG debugging */ + MCUCR &= ~(1 << JTD); + MCUCR &= ~(1 << JTD); + + /* Hardware Initialization */ + SoftUART_Init(); + LEDs_Init(); + #if defined(RESET_TOGGLES_LIBUSB_COMPAT) + UpdateCurrentCompatibilityMode(); + #endif + + /* USB Stack Initialization */ + USB_Init(); +} + +/** Event handler for the library USB Configuration Changed event. */ +void EVENT_USB_Device_ConfigurationChanged(void) +{ + bool ConfigSuccess = true; + + /* Configure the device endpoints according to the selected mode */ + if (CurrentFirmwareMode == MODE_USART_BRIDGE) + { + ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); + + /* Configure the UART flush timer - run at Fcpu/1024 for maximum interval before overflow */ + TCCR0B = ((1 << CS02) | (1 << CS00)); + + /* Initialize ring buffers used to hold serial data between USB and software UART interfaces */ + RingBuffer_InitBuffer(&USBtoUART_Buffer, USBtoUART_Buffer_Data, sizeof(USBtoUART_Buffer_Data)); + RingBuffer_InitBuffer(&UARTtoUSB_Buffer, UARTtoUSB_Buffer_Data, sizeof(UARTtoUSB_Buffer_Data)); + + /* Start the software USART */ + SoftUART_Init(); + } + else + { + ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); + + if ((AVRISP_DATA_IN_EPADDR & ENDPOINT_EPNUM_MASK) != (AVRISP_DATA_OUT_EPADDR & ENDPOINT_EPNUM_MASK)) + ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); + + /* Configure the V2 protocol packet handler */ + V2Protocol_Init(); + } + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); +} + +/** Event handler for the library USB Control Request reception event. */ +void EVENT_USB_Device_ControlRequest(void) +{ + if (CurrentFirmwareMode == MODE_USART_BRIDGE) + CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); +} + +/** Event handler for the library USB Connection event. */ +void EVENT_USB_Device_Connect(void) +{ + LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); +} + +/** Event handler for the library USB Disconnection event. */ +void EVENT_USB_Device_Disconnect(void) +{ + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); +} + +/** Event handler for the CDC Class driver Line Encoding Changed event. + * + * \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced + */ +void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + /* Change the software UART's baud rate to match the new baud rate */ + SoftUART_SetBaud(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS); +} + +/** 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. + * + * \param[in] wValue Descriptor type and index to retrieve + * \param[in] wIndex Sub-index to retrieve (such as a localized string language) + * \param[out] DescriptorAddress Address of the retrieved descriptor + * + * \return Length of the retrieved descriptor in bytes, or NO_DESCRIPTOR if the descriptor was not found + */ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint16_t wIndex, + const void** const DescriptorAddress) +{ + /* Return the correct descriptors based on the selected mode */ + if (CurrentFirmwareMode == MODE_USART_BRIDGE) + return USART_GetDescriptor(wValue, wIndex, DescriptorAddress); + else + return AVRISP_GetDescriptor(wValue, wIndex, DescriptorAddress); +} + diff --git a/Projects/XPLAINBridge/XPLAINBridge.h b/Projects/XPLAINBridge/XPLAINBridge.h new file mode 100644 index 0000000000..cc7d5b4997 --- /dev/null +++ b/Projects/XPLAINBridge/XPLAINBridge.h @@ -0,0 +1,103 @@ +/* + 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 XPLAINBridge.c. + */ + +#ifndef _XPLAIN_BRIDGE_H_ +#define _XPLAIN_BRIDGE_H_ + + /* Includes: */ + #include + #include + #include + #include + #include + + #include "USARTDescriptors.h" + + #include "AVRISPDescriptors.h" + #include "Lib/V2Protocol.h" + #include "Lib/SoftUART.h" + #include "Config/AppConfig.h" + + #include + #include + #include + #include + + /* 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_LED1 + + /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ + #define LEDMASK_USB_READY LEDS_NO_LEDS + + /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ + #define LEDMASK_USB_ERROR LEDS_LED1 + + /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ + #define LEDMASK_BUSY LEDS_LED1 + + /** Firmware mode define for the USART Bridge mode. */ + #define MODE_USART_BRIDGE false + + /** Firmware mode define for the AVRISP Programmer mode. */ + #define MODE_PDI_PROGRAMMER true + + /* External Variables: */ + extern bool CurrentFirmwareMode; + extern RingBuffer_t UARTtoUSB_Buffer; + extern RingBuffer_t USBtoUART_Buffer; + + /* Function Prototypes: */ + void SetupHardware(void); + void AVRISP_Task(void); + void UARTBridge_Task(void); + + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_ControlRequest(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + + void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); + + 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/Projects/XPLAINBridge/XPLAINBridge.txt b/Projects/XPLAINBridge/XPLAINBridge.txt new file mode 100644 index 0000000000..0cf59a67d7 --- /dev/null +++ b/Projects/XPLAINBridge/XPLAINBridge.txt @@ -0,0 +1,89 @@ +/** \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 XPLAIN UART Bridge/PDI Programmer Project + * + * \section Sec_Compat Project Compatibility: + * + * The following list indicates what microcontrollers are compatible with this project. + * + * \li AT90USB1287 + * + * \section Sec_Info USB Information: + * + * The following table gives a rundown of the USB utilization of this project. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
USB Mode:1) Device2) Device
USB Class:1) Communications Device Class (CDC)2) Vendor Specific Class
USB Subclass:1) Abstract Control Model (ACM)2) N/A
Relevant Standards:1) USBIF CDC Class Standard2) Atmel AVRISP MKII Protocol Specification
Supported USB Speeds:1) Full Speed Mode2) Full Speed Mode
+ * + * \section Sec_Description Project Description: + * + * This project serves a dual purpose. When loaded into the USB AVR on the XPLAIN board, it will act as either a USB to Serial + * converter for the XPLAIN's hardware USART (at a speed of 9600 baud), or an AVRStudio compatible PDI programmer for the XMEGA. + * This project replaces the firmware preloaded onto the XPLAIN's onboard AT90USB1287 microcontroller. + * + * When power to the board is applied, the TDI pin (pin 9) of the USB AVR's JTAG port is read. If the pin is left high, the device + * will enumerate as a regular COM port on the host, which can then be opened and data exchanged between the XMEGA and Host as if + * the XMEGA was connected directly to the host's serial port. If the pin is pulled low by shorting it to GND (pin 10), the device + * will enumerate as an AVRISP-MKII to the host, so that the XMEGA can be reprogrammed by AVRStudio or other compatible software + * such as avrdude by connecting to the board as if it was an Atmel AVRISP-MKII programmer. + * + * After running this project in serial bridge mode for the first time on a new computer, you will need to supply the .INF file + * located in this project project's directory as the device's driver when running under Windows. This will enable Windows to use + * its inbuilt CDC virtual serial drivers, negating the need for custom drivers for the device. Other Operating Systems should + * automatically use their own inbuilt CDC-ACM drivers. + * + * In serial bridge mode, the UART baud rate can be altered through the host terminal software to select a new baud rate - the default + * baud is 9600. Note that parity, data bits and stop bits are fixed at none, eight and one respectively can cannot be altered. Changes + * to the connection's parity, data bits or stop bits are ignored by the firmware. As the serial link between the controllers on the + * XPLAIN is software emulated by the USB AVR, not all baud rates will work correctly. + * + * This project relies on files from the LUFA AVRISP-MKII project for compilation. + * + * \section Sec_Options Project Options + * + * The following defines can be found in this project, which can control the project behaviour when defined, or changed in value. + * + * + * + * + * + * + * + * + * + * + * + * + *
Define Name:Location:Description:
FIRMWARE_VERSION_MINORAppConfig.hDefine to set the minor firmware revision nunber reported to the host on request. By default this will use a firmware version compatible + * with the latest Atmel IDE version, however if desired the reported minor value can be adjusted here.
+ */ + diff --git a/Projects/XPLAINBridge/asf.xml b/Projects/XPLAINBridge/asf.xml new file mode 100644 index 0000000000..dfdf46b905 --- /dev/null +++ b/Projects/XPLAINBridge/asf.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + Bridge firmware for the original (green) XPLAIN board, for programming and USB virtual serial communications. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Projects/XPLAINBridge/doxyfile b/Projects/XPLAINBridge/doxyfile new file mode 100644 index 0000000000..15ae5a0d70 --- /dev/null +++ b/Projects/XPLAINBridge/doxyfile @@ -0,0 +1,2395 @@ +# 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 config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "LUFA Library - XPLAIN Serial Bridge/PDI Programmer Project" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = ./Documentation/ + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping