1
0
Fork 0

Squashed 'tmk_core/' changes from caca2c0..dc0e46e

dc0e46e Rename LUFA to LUFA-git
3bfa7fa Remove LUFA-120730
215b764 Merge commit 'afa0f22a9299686fd88f58ce09c5b521ac917e8f' as 'protocol/lufa/LUFA'
afa0f22 Squashed 'protocol/lufa/LUFA/' content from commit def7fca
c0c42fa Remove submodule of LUFA
30f897d Merge commit '87ced33feb74e79c3281dda36eb6d6d153399b41' as 'protocol/usb_hid/USB_Host_Shield_2.0'
87ced33 Squashed 'protocol/usb_hid/USB_Host_Shield_2.0/' content from commit aab4a69
14f6d49 Remove submodule of USB_Host_Shield_2.0

git-subtree-dir: tmk_core
git-subtree-split: dc0e46eaa4367d4e218f8816e3c117895820f07c
This commit is contained in:
tmk 2015-05-13 11:13:10 +09:00
parent 4d116a04e9
commit f6d56675f9
1575 changed files with 421901 additions and 63190 deletions

View file

@ -0,0 +1,66 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2014.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2014 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 LIBUSB_DRIVER_COMPAT
// #define RESET_TOGGLES_LIBUSB_COMPAT
// #define FIRMWARE_VERSION_MINOR 0x11
#endif

View file

@ -0,0 +1,93 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2014.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2014 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

View file

@ -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"

View file

@ -0,0 +1,156 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2014.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk)
Copyright 2010 Peter Danneger
Copyright 2014 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;
}
}

View file

@ -0,0 +1,71 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2014.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk)
Copyright 2010 Peter Danneger
Copyright 2014 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 <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
#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

View file

@ -0,0 +1,245 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2014.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2014 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 uint8_t wIndex,
const void** const DescriptorAddress,
uint8_t* const DescriptorMemorySpace)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
*DescriptorMemorySpace = MEMSPACE_FLASH;
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;
}

View file

@ -0,0 +1,112 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2014.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2014 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 <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#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 uint8_t wIndex,
const void** const DescriptorAddress,
uint8_t* const DescriptorMemorySpace);
#endif

View file

@ -0,0 +1,294 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2014.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2014 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
* \param[out] DescriptorMemorySpace Memory space that the descriptor is stored in
*
* \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 uint8_t wIndex,
const void** const DescriptorAddress,
uint8_t* const DescriptorMemorySpace)
{
/* Return the correct descriptors based on the selected mode */
if (CurrentFirmwareMode == MODE_USART_BRIDGE)
return USART_GetDescriptor(wValue, wIndex, DescriptorAddress, DescriptorMemorySpace);
else
return AVRISP_GetDescriptor(wValue, wIndex, DescriptorAddress, DescriptorMemorySpace);
}

View file

@ -0,0 +1,104 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2014.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2014 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 <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "USARTDescriptors.h"
#include "AVRISPDescriptors.h"
#include "Lib/V2Protocol.h"
#include "Lib/SoftUART.h"
#include "Config/AppConfig.h"
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Misc/RingBuffer.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Platform/Platform.h>
/* 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 uint8_t wIndex,
const void** const DescriptorAddress,
uint8_t* const DescriptorMemorySpace)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3) ATTR_NON_NULL_PTR_ARG(4);
#endif

View file

@ -0,0 +1,109 @@
/** \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.
*
* <table>
* <tr>
* <td><b>USB Mode:</b></td>
* <td>1) Device</td>
* <td>2) Device</td>
* </tr>
* <tr>
* <td><b>USB Class:</b></td>
* <td>1) Communications Device Class (CDC)</td>
* <td>2) Vendor Specific Class</td>
* </tr>
* <tr>
* <td><b>USB Subclass:</b></td>
* <td>1) Abstract Control Model (ACM)</td>
* <td>2) N/A</td>
* </tr>
* <tr>
* <td><b>Relevant Standards:</b></td>
* <td>1) USBIF CDC Class Standard</td>
* <td>2) Atmel AVRISP MKII Protocol Specification</td>
* </tr>
* <tr>
* <td><b>Supported USB Speeds:</b></td>
* <td>1) Full Speed Mode</td>
* <td>2) Full Speed Mode</td>
* </tr>
* </table>
*
* \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.
*
* <table>
* <tr>
* <th><b>Define Name:</b></th>
* <th><b>Location:</b></th>
* <th><b>Description:</b></th>
* </tr>
* <tr>
* <td>LIBUSB_DRIVER_COMPAT</td>
* <td>AppConfig.h</td>
* <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making
* the code compatible with software such as avrdude (all platforms) that use the libUSB driver.
*
* \note This option is incompatible with \c RESET_TOGGLES_LIBUSB_COMPAT.</td>
* </tr>
* <tr>
* <td>RESET_TOGGLES_LIBUSB_COMPAT</td>
* <td>Makefile LUFA_OPTS</td>
* <td>Define to make the /RESET line of the AVR toggle between Jungo and libUSB driver compatibility modes. Each time the AVR is
* reset externally via the reset pin, the compatibility mode will be toggled. The compatibility mode is preserved between
* power cycles and is not toggled via other forms of reset such as Watchdog or Brown Out.
*
* When this option is enabled, all board LEDs will flash twice on startup for Jungo compatibility mode, and five times for
* libUSB compatibility mode.
*
* \note This option is incompatible with \c LIBUSB_DRIVER_COMPAT.</td>
* </tr>
* <tr>
* <td>FIRMWARE_VERSION_MINOR</td>
* <td>AppConfig.h</td>
* <td>Define 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.</td>
* </tr>
* </table>
*/

View file

@ -0,0 +1,57 @@
<asf xmlversion="1.0">
<project caption="XPLAIN Bridge" id="lufa.projects.xplain_bridge.avr8">
<require idref="lufa.projects.xplain_bridge"/>
<require idref="lufa.boards.dummy.avr8"/>
<generator value="as5_8"/>
<device-support value="at90usb1287"/>
<config name="lufa.drivers.board.name" value="usbkey"/>
<build type="define" name="F_CPU" value="8000000UL"/>
<build type="define" name="F_USB" value="8000000UL"/>
</project>
<module type="application" id="lufa.projects.xplain_bridge" caption="XPLAIN Bridge">
<info type="description" value="summary">
Bridge firmware for the original (green) XPLAIN board, for programming and USB virtual serial communications.
</info>
<info type="gui-flag" value="move-to-root"/>
<info type="keyword" value="Technology">
<keyword value="Class Driver APIs"/>
<keyword value="USB Device"/>
<keyword value="CDC Class"/>
</info>
<device-support-alias value="lufa_avr8"/>
<device-support-alias value="lufa_xmega"/>
<device-support-alias value="lufa_uc3"/>
<build type="distribute" subtype="user-file" value="doxyfile"/>
<build type="distribute" subtype="user-file" value="XPLAINBridge.txt"/>
<build type="distribute" subtype="user-file" value="LUFA XPLAIN Bridge.inf"/>
<build type="c-source" value="XPLAINBridge.c"/>
<build type="c-source" value="USARTDescriptors.c"/>
<build type="header-file" value="XPLAINBridge.h"/>
<build type="header-file" value="USARTDescriptors.h"/>
<build type="c-source" value="Lib/SoftUART.c"/>
<build type="header-file" value="Lib/SoftUART.h"/>
<require idref="lufa.projects.avrispmkii_clone.src"/>
<build type="module-config" subtype="path" value="Config"/>
<build type="module-config" subtype="required-header-file" value="AppConfig.h"/>
<build type="header-file" value="Config/AppConfig.h"/>
<build type="header-file" value="Config/LUFAConfig.h"/>
<require idref="lufa.common"/>
<require idref="lufa.platform"/>
<require idref="lufa.drivers.usb"/>
<require idref="lufa.drivers.misc.ringbuffer"/>
<require idref="lufa.drivers.board"/>
<require idref="lufa.drivers.board.leds"/>
</module>
</asf>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,51 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2014.
#
# dean [at] fourwalledcubicle [dot] com
# www.lufa-lib.org
#
# --------------------------------------
# LUFA Project Makefile.
# --------------------------------------
# Run "make help" for target help.
AVRISP_PATH = ../AVRISP-MKII
MCU = at90usb1287
ARCH = AVR8
BOARD = XPLAIN
F_CPU = 8000000
F_USB = $(F_CPU)
OPTIMIZATION = s
TARGET = XPLAINBridge
SRC = $(TARGET).c Lib/SoftUART.c USARTDescriptors.c $(AVRISP_PATH)/AVRISPDescriptors.c $(AVRISP_PATH)/Lib/V2Protocol.c \
$(AVRISP_PATH)/Lib/V2ProtocolParams.c $(AVRISP_PATH)/Lib/ISP/ISPProtocol.c $(AVRISP_PATH)/Lib/ISP/ISPTarget.c \
$(AVRISP_PATH)/Lib/XPROG/XPROGProtocol.c $(AVRISP_PATH)/Lib/XPROG/XPROGTarget.c $(AVRISP_PATH)/Lib/XPROG/XMEGANVM.c \
$(AVRISP_PATH)/Lib/XPROG/TINYNVM.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
LUFA_PATH = ../../LUFA
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -I$(AVRISP_PATH)
LD_FLAGS =
# Default target
all:
# Since this project borrows files from the AVRISP-MKII project which may also have an
# identical OBJDIR directory, we need to enforce the use of this project's object file
# directory as the one where the build object files are to be stored by pre-pending the
# absolute path of the current project to the OBJDIR variable.
ifneq ($(OBJDIR),)
override OBJDIR:=$(shell pwd)/$(OBJDIR)
endif
# Include LUFA build script makefiles
include $(LUFA_PATH)/Build/lufa_core.mk
include $(LUFA_PATH)/Build/lufa_sources.mk
include $(LUFA_PATH)/Build/lufa_build.mk
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
include $(LUFA_PATH)/Build/lufa_doxygen.mk
include $(LUFA_PATH)/Build/lufa_dfu.mk
include $(LUFA_PATH)/Build/lufa_hid.mk
include $(LUFA_PATH)/Build/lufa_avrdude.mk
include $(LUFA_PATH)/Build/lufa_atprogram.mk