Add svn:eol-style property to source files, so that the line endings are correctly converted to the target system's native end of line style.
This commit is contained in:
parent
e331b531c6
commit
071e02c6b6
839 changed files with 274562 additions and 274562 deletions
|
@ -1,219 +1,219 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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 "AVRISPDescriptors.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.
|
||||
*/
|
||||
USB_Descriptor_Device_t PROGMEM AVRISP_DeviceDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
|
||||
|
||||
.USBSpecification = VERSION_BCD(01.10),
|
||||
.Class = 0xFF,
|
||||
.SubClass = 0x00,
|
||||
.Protocol = 0x00,
|
||||
|
||||
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
|
||||
|
||||
.VendorID = 0x03EB,
|
||||
.ProductID = 0x2104,
|
||||
.ReleaseNumber = VERSION_BCD(02.00),
|
||||
|
||||
.ManufacturerStrIndex = 0x01,
|
||||
.ProductStrIndex = 0x02,
|
||||
.SerialNumStrIndex = 0x03,
|
||||
|
||||
.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.
|
||||
*/
|
||||
AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor =
|
||||
{
|
||||
.Config =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
|
||||
|
||||
.TotalConfigurationSize = sizeof(AVRISP_USB_Descriptor_Configuration_t),
|
||||
.TotalInterfaces = 1,
|
||||
|
||||
.ConfigurationNumber = 1,
|
||||
.ConfigurationStrIndex = NO_DESCRIPTOR,
|
||||
|
||||
.ConfigAttributes = USB_CONFIG_ATTR_SELFPOWERED,
|
||||
|
||||
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
|
||||
},
|
||||
|
||||
.AVRISP_Interface =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 0,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 2,
|
||||
|
||||
.Class = 0xFF,
|
||||
.SubClass = 0x00,
|
||||
.Protocol = 0x00,
|
||||
|
||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||
},
|
||||
|
||||
.AVRISP_DataInEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_IN_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = AVRISP_DATA_EPSIZE,
|
||||
.PollingIntervalMS = 0x00
|
||||
},
|
||||
|
||||
.AVRISP_DataOutEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_OUT_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = AVRISP_DATA_EPSIZE,
|
||||
.PollingIntervalMS = 0x00
|
||||
},
|
||||
};
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM AVRISP_LanguageString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = {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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = 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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM AVRISP_ProductString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"LUFA AVRISP MkII Clone"
|
||||
};
|
||||
|
||||
/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a
|
||||
* series of uppercase hexadecimal digits.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM AVRISP_SerialString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"0000A00128255"
|
||||
};
|
||||
|
||||
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
|
||||
* documentation) by the application code so that the address and size of a requested descriptor can be given
|
||||
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
|
||||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t AVRISP_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
||||
void* Address = NULL;
|
||||
uint16_t Size = NO_DESCRIPTOR;
|
||||
|
||||
switch (DescriptorType)
|
||||
{
|
||||
case DTYPE_Device:
|
||||
Address = (void*)&AVRISP_DeviceDescriptor;
|
||||
Size = sizeof(USB_Descriptor_Device_t);
|
||||
break;
|
||||
case DTYPE_Configuration:
|
||||
Address = (void*)&AVRISP_ConfigurationDescriptor;
|
||||
Size = sizeof(AVRISP_USB_Descriptor_Configuration_t);
|
||||
break;
|
||||
case DTYPE_String:
|
||||
switch (DescriptorNumber)
|
||||
{
|
||||
case 0x00:
|
||||
Address = (void*)&AVRISP_LanguageString;
|
||||
Size = pgm_read_byte(&AVRISP_LanguageString.Header.Size);
|
||||
break;
|
||||
case 0x01:
|
||||
Address = (void*)&AVRISP_ManufacturerString;
|
||||
Size = pgm_read_byte(&AVRISP_ManufacturerString.Header.Size);
|
||||
break;
|
||||
case 0x02:
|
||||
Address = (void*)&AVRISP_ProductString;
|
||||
Size = pgm_read_byte(&AVRISP_ProductString.Header.Size);
|
||||
break;
|
||||
case 0x03:
|
||||
Address = (void*)&AVRISP_SerialString;
|
||||
Size = pgm_read_byte(&AVRISP_SerialString.Header.Size);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
*DescriptorAddress = Address;
|
||||
return Size;
|
||||
}
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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 "AVRISPDescriptors.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.
|
||||
*/
|
||||
USB_Descriptor_Device_t PROGMEM AVRISP_DeviceDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
|
||||
|
||||
.USBSpecification = VERSION_BCD(01.10),
|
||||
.Class = 0xFF,
|
||||
.SubClass = 0x00,
|
||||
.Protocol = 0x00,
|
||||
|
||||
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
|
||||
|
||||
.VendorID = 0x03EB,
|
||||
.ProductID = 0x2104,
|
||||
.ReleaseNumber = VERSION_BCD(02.00),
|
||||
|
||||
.ManufacturerStrIndex = 0x01,
|
||||
.ProductStrIndex = 0x02,
|
||||
.SerialNumStrIndex = 0x03,
|
||||
|
||||
.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.
|
||||
*/
|
||||
AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor =
|
||||
{
|
||||
.Config =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
|
||||
|
||||
.TotalConfigurationSize = sizeof(AVRISP_USB_Descriptor_Configuration_t),
|
||||
.TotalInterfaces = 1,
|
||||
|
||||
.ConfigurationNumber = 1,
|
||||
.ConfigurationStrIndex = NO_DESCRIPTOR,
|
||||
|
||||
.ConfigAttributes = USB_CONFIG_ATTR_SELFPOWERED,
|
||||
|
||||
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
|
||||
},
|
||||
|
||||
.AVRISP_Interface =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 0,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 2,
|
||||
|
||||
.Class = 0xFF,
|
||||
.SubClass = 0x00,
|
||||
.Protocol = 0x00,
|
||||
|
||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||
},
|
||||
|
||||
.AVRISP_DataInEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_IN_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = AVRISP_DATA_EPSIZE,
|
||||
.PollingIntervalMS = 0x00
|
||||
},
|
||||
|
||||
.AVRISP_DataOutEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_OUT_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = AVRISP_DATA_EPSIZE,
|
||||
.PollingIntervalMS = 0x00
|
||||
},
|
||||
};
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM AVRISP_LanguageString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = {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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = 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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM AVRISP_ProductString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"LUFA AVRISP MkII Clone"
|
||||
};
|
||||
|
||||
/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a
|
||||
* series of uppercase hexadecimal digits.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM AVRISP_SerialString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"0000A00128255"
|
||||
};
|
||||
|
||||
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
|
||||
* documentation) by the application code so that the address and size of a requested descriptor can be given
|
||||
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
|
||||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t AVRISP_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
||||
void* Address = NULL;
|
||||
uint16_t Size = NO_DESCRIPTOR;
|
||||
|
||||
switch (DescriptorType)
|
||||
{
|
||||
case DTYPE_Device:
|
||||
Address = (void*)&AVRISP_DeviceDescriptor;
|
||||
Size = sizeof(USB_Descriptor_Device_t);
|
||||
break;
|
||||
case DTYPE_Configuration:
|
||||
Address = (void*)&AVRISP_ConfigurationDescriptor;
|
||||
Size = sizeof(AVRISP_USB_Descriptor_Configuration_t);
|
||||
break;
|
||||
case DTYPE_String:
|
||||
switch (DescriptorNumber)
|
||||
{
|
||||
case 0x00:
|
||||
Address = (void*)&AVRISP_LanguageString;
|
||||
Size = pgm_read_byte(&AVRISP_LanguageString.Header.Size);
|
||||
break;
|
||||
case 0x01:
|
||||
Address = (void*)&AVRISP_ManufacturerString;
|
||||
Size = pgm_read_byte(&AVRISP_ManufacturerString.Header.Size);
|
||||
break;
|
||||
case 0x02:
|
||||
Address = (void*)&AVRISP_ProductString;
|
||||
Size = pgm_read_byte(&AVRISP_ProductString.Header.Size);
|
||||
break;
|
||||
case 0x03:
|
||||
Address = (void*)&AVRISP_SerialString;
|
||||
Size = pgm_read_byte(&AVRISP_SerialString.Header.Size);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
*DescriptorAddress = Address;
|
||||
return Size;
|
||||
}
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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 AVRISPDescriptors.c.
|
||||
*/
|
||||
|
||||
#ifndef _AVRISP_DESCRIPTORS_H_
|
||||
#define _AVRISP_DESCRIPTORS_H_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#include <LUFA/Drivers/USB/USB.h>
|
||||
|
||||
/* Macros: */
|
||||
#if !defined(LIBUSB_FILTERDRV_COMPAT)
|
||||
/** Endpoint number of the AVRISP data OUT endpoint. */
|
||||
#define AVRISP_DATA_OUT_EPNUM 2
|
||||
|
||||
/** Endpoint number of the AVRISP data IN endpoint. */
|
||||
#define AVRISP_DATA_IN_EPNUM 2
|
||||
#else
|
||||
/** Endpoint number of the AVRISP data OUT endpoint. */
|
||||
#define AVRISP_DATA_OUT_EPNUM 2
|
||||
|
||||
/** Endpoint number of the AVRISP data IN endpoint. */
|
||||
#define AVRISP_DATA_IN_EPNUM 3
|
||||
#endif
|
||||
|
||||
/** Size in bytes of the AVRISP data endpoint. */
|
||||
#define AVRISP_DATA_EPSIZE 64
|
||||
|
||||
/* Type Defines: */
|
||||
/** Type define for the device configuration descriptor structure. This must be defined in the
|
||||
* application code, as the configuration descriptor contains several sub-descriptors which
|
||||
* vary between devices, and which describe the device's usage to the host.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t AVRISP_Interface;
|
||||
USB_Descriptor_Endpoint_t AVRISP_DataInEndpoint;
|
||||
USB_Descriptor_Endpoint_t AVRISP_DataOutEndpoint;
|
||||
} AVRISP_USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t AVRISP_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
|
||||
|
||||
#endif
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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 AVRISPDescriptors.c.
|
||||
*/
|
||||
|
||||
#ifndef _AVRISP_DESCRIPTORS_H_
|
||||
#define _AVRISP_DESCRIPTORS_H_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#include <LUFA/Drivers/USB/USB.h>
|
||||
|
||||
/* Macros: */
|
||||
#if !defined(LIBUSB_FILTERDRV_COMPAT)
|
||||
/** Endpoint number of the AVRISP data OUT endpoint. */
|
||||
#define AVRISP_DATA_OUT_EPNUM 2
|
||||
|
||||
/** Endpoint number of the AVRISP data IN endpoint. */
|
||||
#define AVRISP_DATA_IN_EPNUM 2
|
||||
#else
|
||||
/** Endpoint number of the AVRISP data OUT endpoint. */
|
||||
#define AVRISP_DATA_OUT_EPNUM 2
|
||||
|
||||
/** Endpoint number of the AVRISP data IN endpoint. */
|
||||
#define AVRISP_DATA_IN_EPNUM 3
|
||||
#endif
|
||||
|
||||
/** Size in bytes of the AVRISP data endpoint. */
|
||||
#define AVRISP_DATA_EPSIZE 64
|
||||
|
||||
/* Type Defines: */
|
||||
/** Type define for the device configuration descriptor structure. This must be defined in the
|
||||
* application code, as the configuration descriptor contains several sub-descriptors which
|
||||
* vary between devices, and which describe the device's usage to the host.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
USB_Descriptor_Interface_t AVRISP_Interface;
|
||||
USB_Descriptor_Endpoint_t AVRISP_DataInEndpoint;
|
||||
USB_Descriptor_Endpoint_t AVRISP_DataOutEndpoint;
|
||||
} AVRISP_USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t AVRISP_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,106 +1,106 @@
|
|||
;************************************************************
|
||||
; Windows USB CDC ACM Setup File
|
||||
; Copyright (c) 2000 Microsoft Corporation
|
||||
|
||||
|
||||
[Version]
|
||||
Signature="$Windows NT$"
|
||||
Class=Ports
|
||||
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
|
||||
Provider=%MFGNAME%
|
||||
LayoutFile=layout.inf
|
||||
CatalogFile=%MFGFILENAME%.cat
|
||||
DriverVer=11/15/2007,5.1.2600.0
|
||||
|
||||
[Manufacturer]
|
||||
%MFGNAME%=DeviceList, NTamd64
|
||||
|
||||
[DestinationDirs]
|
||||
DefaultDestDir=12
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Windows 2000/XP/Vista-32bit Sections
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
[DriverInstall.nt]
|
||||
include=mdmcpq.inf
|
||||
CopyFiles=DriverCopyFiles.nt
|
||||
AddReg=DriverInstall.nt.AddReg
|
||||
|
||||
[DriverCopyFiles.nt]
|
||||
usbser.sys,,,0x20
|
||||
|
||||
[DriverInstall.nt.AddReg]
|
||||
HKR,,DevLoader,,*ntkern
|
||||
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
|
||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||
|
||||
[DriverInstall.nt.Services]
|
||||
AddService=usbser, 0x00000002, DriverService.nt
|
||||
|
||||
[DriverService.nt]
|
||||
DisplayName=%SERVICE%
|
||||
ServiceType=1
|
||||
StartType=3
|
||||
ErrorControl=1
|
||||
ServiceBinary=%12%\%DRIVERFILENAME%.sys
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Vista-64bit Sections
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
[DriverInstall.NTamd64]
|
||||
include=mdmcpq.inf
|
||||
CopyFiles=DriverCopyFiles.NTamd64
|
||||
AddReg=DriverInstall.NTamd64.AddReg
|
||||
|
||||
[DriverCopyFiles.NTamd64]
|
||||
%DRIVERFILENAME%.sys,,,0x20
|
||||
|
||||
[DriverInstall.NTamd64.AddReg]
|
||||
HKR,,DevLoader,,*ntkern
|
||||
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
|
||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||
|
||||
[DriverInstall.NTamd64.Services]
|
||||
AddService=usbser, 0x00000002, DriverService.NTamd64
|
||||
|
||||
[DriverService.NTamd64]
|
||||
DisplayName=%SERVICE%
|
||||
ServiceType=1
|
||||
StartType=3
|
||||
ErrorControl=1
|
||||
ServiceBinary=%12%\%DRIVERFILENAME%.sys
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; 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.
|
||||
;------------------------------------------------------------------------------
|
||||
[SourceDisksFiles]
|
||||
[SourceDisksNames]
|
||||
[DeviceList]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
|
||||
|
||||
[DeviceList.NTamd64]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; String Definitions
|
||||
;------------------------------------------------------------------------------
|
||||
;Modify these strings to customize your device
|
||||
;------------------------------------------------------------------------------
|
||||
[Strings]
|
||||
MFGFILENAME="CDC_vista"
|
||||
DRIVERFILENAME ="usbser"
|
||||
MFGNAME="http://www.fourwalledcubicle.com"
|
||||
INSTDISK="LUFA USB-RS232 CDC Driver Installer"
|
||||
DESCRIPTION="Communications Port"
|
||||
;************************************************************
|
||||
; Windows USB CDC ACM Setup File
|
||||
; Copyright (c) 2000 Microsoft Corporation
|
||||
|
||||
|
||||
[Version]
|
||||
Signature="$Windows NT$"
|
||||
Class=Ports
|
||||
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
|
||||
Provider=%MFGNAME%
|
||||
LayoutFile=layout.inf
|
||||
CatalogFile=%MFGFILENAME%.cat
|
||||
DriverVer=11/15/2007,5.1.2600.0
|
||||
|
||||
[Manufacturer]
|
||||
%MFGNAME%=DeviceList, NTamd64
|
||||
|
||||
[DestinationDirs]
|
||||
DefaultDestDir=12
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Windows 2000/XP/Vista-32bit Sections
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
[DriverInstall.nt]
|
||||
include=mdmcpq.inf
|
||||
CopyFiles=DriverCopyFiles.nt
|
||||
AddReg=DriverInstall.nt.AddReg
|
||||
|
||||
[DriverCopyFiles.nt]
|
||||
usbser.sys,,,0x20
|
||||
|
||||
[DriverInstall.nt.AddReg]
|
||||
HKR,,DevLoader,,*ntkern
|
||||
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
|
||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||
|
||||
[DriverInstall.nt.Services]
|
||||
AddService=usbser, 0x00000002, DriverService.nt
|
||||
|
||||
[DriverService.nt]
|
||||
DisplayName=%SERVICE%
|
||||
ServiceType=1
|
||||
StartType=3
|
||||
ErrorControl=1
|
||||
ServiceBinary=%12%\%DRIVERFILENAME%.sys
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Vista-64bit Sections
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
[DriverInstall.NTamd64]
|
||||
include=mdmcpq.inf
|
||||
CopyFiles=DriverCopyFiles.NTamd64
|
||||
AddReg=DriverInstall.NTamd64.AddReg
|
||||
|
||||
[DriverCopyFiles.NTamd64]
|
||||
%DRIVERFILENAME%.sys,,,0x20
|
||||
|
||||
[DriverInstall.NTamd64.AddReg]
|
||||
HKR,,DevLoader,,*ntkern
|
||||
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
|
||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||
|
||||
[DriverInstall.NTamd64.Services]
|
||||
AddService=usbser, 0x00000002, DriverService.NTamd64
|
||||
|
||||
[DriverService.NTamd64]
|
||||
DisplayName=%SERVICE%
|
||||
ServiceType=1
|
||||
StartType=3
|
||||
ErrorControl=1
|
||||
ServiceBinary=%12%\%DRIVERFILENAME%.sys
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; 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.
|
||||
;------------------------------------------------------------------------------
|
||||
[SourceDisksFiles]
|
||||
[SourceDisksNames]
|
||||
[DeviceList]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
|
||||
|
||||
[DeviceList.NTamd64]
|
||||
%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204B
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; String Definitions
|
||||
;------------------------------------------------------------------------------
|
||||
;Modify these strings to customize your device
|
||||
;------------------------------------------------------------------------------
|
||||
[Strings]
|
||||
MFGFILENAME="CDC_vista"
|
||||
DRIVERFILENAME ="usbser"
|
||||
MFGNAME="http://www.fourwalledcubicle.com"
|
||||
INSTDISK="LUFA USB-RS232 CDC Driver Installer"
|
||||
DESCRIPTION="Communications Port"
|
||||
SERVICE="USB RS-232 Emulation Driver"
|
|
@ -1,120 +1,120 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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.
|
||||
*/
|
||||
|
||||
#include "RingBuff.h"
|
||||
|
||||
void Buffer_Initialize(RingBuff_t* const Buffer)
|
||||
{
|
||||
BUFF_ATOMIC_BLOCK
|
||||
{
|
||||
Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
|
||||
Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
|
||||
Buffer->Elements = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data)
|
||||
{
|
||||
BUFF_ATOMIC_BLOCK
|
||||
{
|
||||
#if defined(BUFF_DROPOLD)
|
||||
if (Buffer->Elements == BUFF_LENGTH)
|
||||
{
|
||||
Buffer->OutPtr++;
|
||||
|
||||
if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
|
||||
Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer->Elements++;
|
||||
}
|
||||
#elif defined(BUFF_DROPNEW)
|
||||
if (Buffer->Elements == BUFF_LENGTH)
|
||||
return;
|
||||
|
||||
Buffer->Elements++;
|
||||
#elif defined(BUFF_NODROPCHECK)
|
||||
Buffer->Elements++;
|
||||
#endif
|
||||
|
||||
*(Buffer->InPtr) = Data;
|
||||
Buffer->InPtr++;
|
||||
|
||||
if (Buffer->InPtr == &Buffer->Buffer[BUFF_LENGTH])
|
||||
Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
|
||||
}
|
||||
}
|
||||
|
||||
RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer)
|
||||
{
|
||||
RingBuff_Data_t BuffData;
|
||||
|
||||
BUFF_ATOMIC_BLOCK
|
||||
{
|
||||
#if defined(BUFF_EMPTYRETURNSZERO)
|
||||
if (!(Buffer->Elements))
|
||||
return 0;
|
||||
#elif !defined(BUFF_NOEMPTYCHECK)
|
||||
#error No empty buffer check behavior specified.
|
||||
#endif
|
||||
|
||||
BuffData = *(Buffer->OutPtr);
|
||||
|
||||
Buffer->OutPtr++;
|
||||
Buffer->Elements--;
|
||||
|
||||
if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
|
||||
Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
|
||||
}
|
||||
|
||||
return BuffData;
|
||||
}
|
||||
|
||||
#if defined(BUFF_USEPEEK)
|
||||
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer)
|
||||
{
|
||||
RingBuff_Data_t BuffData;
|
||||
|
||||
BUFF_ATOMIC_BLOCK
|
||||
{
|
||||
#if defined(BUFF_EMPTYRETURNSZERO)
|
||||
if (!(Buffer->Elements))
|
||||
return 0;
|
||||
#elif !defined(BUFF_NOEMPTYCHECK)
|
||||
#error No empty buffer check behavior specified.
|
||||
#endif
|
||||
|
||||
BuffData = *(Buffer->OutPtr);
|
||||
}
|
||||
|
||||
return BuffData;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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.
|
||||
*/
|
||||
|
||||
#include "RingBuff.h"
|
||||
|
||||
void Buffer_Initialize(RingBuff_t* const Buffer)
|
||||
{
|
||||
BUFF_ATOMIC_BLOCK
|
||||
{
|
||||
Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
|
||||
Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
|
||||
Buffer->Elements = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data)
|
||||
{
|
||||
BUFF_ATOMIC_BLOCK
|
||||
{
|
||||
#if defined(BUFF_DROPOLD)
|
||||
if (Buffer->Elements == BUFF_LENGTH)
|
||||
{
|
||||
Buffer->OutPtr++;
|
||||
|
||||
if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
|
||||
Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer->Elements++;
|
||||
}
|
||||
#elif defined(BUFF_DROPNEW)
|
||||
if (Buffer->Elements == BUFF_LENGTH)
|
||||
return;
|
||||
|
||||
Buffer->Elements++;
|
||||
#elif defined(BUFF_NODROPCHECK)
|
||||
Buffer->Elements++;
|
||||
#endif
|
||||
|
||||
*(Buffer->InPtr) = Data;
|
||||
Buffer->InPtr++;
|
||||
|
||||
if (Buffer->InPtr == &Buffer->Buffer[BUFF_LENGTH])
|
||||
Buffer->InPtr = (RingBuff_Data_t*)&Buffer->Buffer;
|
||||
}
|
||||
}
|
||||
|
||||
RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer)
|
||||
{
|
||||
RingBuff_Data_t BuffData;
|
||||
|
||||
BUFF_ATOMIC_BLOCK
|
||||
{
|
||||
#if defined(BUFF_EMPTYRETURNSZERO)
|
||||
if (!(Buffer->Elements))
|
||||
return 0;
|
||||
#elif !defined(BUFF_NOEMPTYCHECK)
|
||||
#error No empty buffer check behavior specified.
|
||||
#endif
|
||||
|
||||
BuffData = *(Buffer->OutPtr);
|
||||
|
||||
Buffer->OutPtr++;
|
||||
Buffer->Elements--;
|
||||
|
||||
if (Buffer->OutPtr == &Buffer->Buffer[BUFF_LENGTH])
|
||||
Buffer->OutPtr = (RingBuff_Data_t*)&Buffer->Buffer;
|
||||
}
|
||||
|
||||
return BuffData;
|
||||
}
|
||||
|
||||
#if defined(BUFF_USEPEEK)
|
||||
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer)
|
||||
{
|
||||
RingBuff_Data_t BuffData;
|
||||
|
||||
BUFF_ATOMIC_BLOCK
|
||||
{
|
||||
#if defined(BUFF_EMPTYRETURNSZERO)
|
||||
if (!(Buffer->Elements))
|
||||
return 0;
|
||||
#elif !defined(BUFF_NOEMPTYCHECK)
|
||||
#error No empty buffer check behavior specified.
|
||||
#endif
|
||||
|
||||
BuffData = *(Buffer->OutPtr);
|
||||
}
|
||||
|
||||
return BuffData;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,116 +1,116 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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.
|
||||
*/
|
||||
|
||||
/* Buffer Configuration: */
|
||||
/* Buffer length - select static size of created ring buffers: */
|
||||
#define BUFF_STATICSIZE 128 // Set to the static ring buffer size for all ring buffers (place size after define)
|
||||
|
||||
/* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */
|
||||
#define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access
|
||||
|
||||
/* Drop mode - select behaviour when Buffer_StoreElement called on a full buffer: */
|
||||
#define BUFF_DROPOLD // Uncomment to cause full ring buffers to drop the oldest character to make space when full
|
||||
// #define BUFF_DROPNEW // Uncomment to cause full ring buffers to drop the new character when full
|
||||
// #define BUFF_NODROPCHECK // Uncomment to ignore full ring buffer checks - checking left to user!
|
||||
|
||||
/* Underflow behaviour - select behaviour when Buffer_GetElement is called with an empty ring buffer: */
|
||||
//#define BUFF_EMPTYRETURNSZERO // Uncomment to return 0 when an empty ring buffer is read
|
||||
#define BUFF_NOEMPTYCHECK // Uncomment to disable checking of empty ring buffers - checking left to user!
|
||||
|
||||
/* Buffer storage type - set the datatype for the stored data */
|
||||
#define BUFF_DATATYPE uint8_t // Change to the data type that is going to be stored into the buffer
|
||||
|
||||
/* Peek routine - uncomment to include the peek routine (fetches next byte without removing it from the buffer */
|
||||
//#define BUFF_USEPEEK
|
||||
|
||||
#ifndef _RINGBUFF_H_
|
||||
#define _RINGBUFF_H_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/atomic.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <LUFA/Common/Common.h>
|
||||
|
||||
/* Defines and checks: */
|
||||
#if defined(BUFF_STATICSIZE)
|
||||
#define BUFF_LENGTH BUFF_STATICSIZE
|
||||
#else
|
||||
#error No buffer length specified!
|
||||
#endif
|
||||
|
||||
#if !(defined(BUFF_DROPOLD) || defined(BUFF_DROPNEW) || defined(BUFF_NODROPCHECK))
|
||||
#error No buffer drop mode specified.
|
||||
#endif
|
||||
|
||||
#if !defined(BUFF_DATATYPE)
|
||||
#error Ringbuffer storage data type not specified.
|
||||
#endif
|
||||
|
||||
#if defined(BUFF_VOLATILE)
|
||||
#define BUFF_MODE volatile
|
||||
#define BUFF_ATOMIC_BLOCK ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
|
||||
#else
|
||||
#define BUFF_MODE
|
||||
#define BUFF_ATOMIC_BLOCK
|
||||
#endif
|
||||
|
||||
#if (BUFF_STATICSIZE > LONG_MAX)
|
||||
#define RingBuff_Elements_t uint64_t
|
||||
#elif (BUFF_STATICSIZE > INT_MAX)
|
||||
#define RingBuff_Elements_t uint32_t
|
||||
#elif (BUFF_STATICSIZE > CHAR_MAX)
|
||||
#define RingBuff_Elements_t uint16_t
|
||||
#else
|
||||
#define RingBuff_Elements_t uint8_t
|
||||
#endif
|
||||
|
||||
/* Type Defines: */
|
||||
typedef BUFF_DATATYPE RingBuff_Data_t;
|
||||
|
||||
typedef BUFF_MODE struct
|
||||
{
|
||||
RingBuff_Data_t Buffer[BUFF_LENGTH];
|
||||
RingBuff_Data_t* InPtr;
|
||||
RingBuff_Data_t* OutPtr;
|
||||
RingBuff_Elements_t Elements;
|
||||
} RingBuff_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
void Buffer_Initialize(RingBuff_t* const Buff);
|
||||
void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data);
|
||||
RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer);
|
||||
#if defined(BUFF_USEPEEK)
|
||||
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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.
|
||||
*/
|
||||
|
||||
/* Buffer Configuration: */
|
||||
/* Buffer length - select static size of created ring buffers: */
|
||||
#define BUFF_STATICSIZE 128 // Set to the static ring buffer size for all ring buffers (place size after define)
|
||||
|
||||
/* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */
|
||||
#define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access
|
||||
|
||||
/* Drop mode - select behaviour when Buffer_StoreElement called on a full buffer: */
|
||||
#define BUFF_DROPOLD // Uncomment to cause full ring buffers to drop the oldest character to make space when full
|
||||
// #define BUFF_DROPNEW // Uncomment to cause full ring buffers to drop the new character when full
|
||||
// #define BUFF_NODROPCHECK // Uncomment to ignore full ring buffer checks - checking left to user!
|
||||
|
||||
/* Underflow behaviour - select behaviour when Buffer_GetElement is called with an empty ring buffer: */
|
||||
//#define BUFF_EMPTYRETURNSZERO // Uncomment to return 0 when an empty ring buffer is read
|
||||
#define BUFF_NOEMPTYCHECK // Uncomment to disable checking of empty ring buffers - checking left to user!
|
||||
|
||||
/* Buffer storage type - set the datatype for the stored data */
|
||||
#define BUFF_DATATYPE uint8_t // Change to the data type that is going to be stored into the buffer
|
||||
|
||||
/* Peek routine - uncomment to include the peek routine (fetches next byte without removing it from the buffer */
|
||||
//#define BUFF_USEPEEK
|
||||
|
||||
#ifndef _RINGBUFF_H_
|
||||
#define _RINGBUFF_H_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/atomic.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <LUFA/Common/Common.h>
|
||||
|
||||
/* Defines and checks: */
|
||||
#if defined(BUFF_STATICSIZE)
|
||||
#define BUFF_LENGTH BUFF_STATICSIZE
|
||||
#else
|
||||
#error No buffer length specified!
|
||||
#endif
|
||||
|
||||
#if !(defined(BUFF_DROPOLD) || defined(BUFF_DROPNEW) || defined(BUFF_NODROPCHECK))
|
||||
#error No buffer drop mode specified.
|
||||
#endif
|
||||
|
||||
#if !defined(BUFF_DATATYPE)
|
||||
#error Ringbuffer storage data type not specified.
|
||||
#endif
|
||||
|
||||
#if defined(BUFF_VOLATILE)
|
||||
#define BUFF_MODE volatile
|
||||
#define BUFF_ATOMIC_BLOCK ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
|
||||
#else
|
||||
#define BUFF_MODE
|
||||
#define BUFF_ATOMIC_BLOCK
|
||||
#endif
|
||||
|
||||
#if (BUFF_STATICSIZE > LONG_MAX)
|
||||
#define RingBuff_Elements_t uint64_t
|
||||
#elif (BUFF_STATICSIZE > INT_MAX)
|
||||
#define RingBuff_Elements_t uint32_t
|
||||
#elif (BUFF_STATICSIZE > CHAR_MAX)
|
||||
#define RingBuff_Elements_t uint16_t
|
||||
#else
|
||||
#define RingBuff_Elements_t uint8_t
|
||||
#endif
|
||||
|
||||
/* Type Defines: */
|
||||
typedef BUFF_DATATYPE RingBuff_Data_t;
|
||||
|
||||
typedef BUFF_MODE struct
|
||||
{
|
||||
RingBuff_Data_t Buffer[BUFF_LENGTH];
|
||||
RingBuff_Data_t* InPtr;
|
||||
RingBuff_Data_t* OutPtr;
|
||||
RingBuff_Elements_t Elements;
|
||||
} RingBuff_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
void Buffer_Initialize(RingBuff_t* const Buff);
|
||||
void Buffer_StoreElement(RingBuff_t* const Buffer, RingBuff_Data_t Data);
|
||||
RingBuff_Data_t Buffer_GetElement(RingBuff_t* const Buffer);
|
||||
#if defined(BUFF_USEPEEK)
|
||||
RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* const Buffer);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,143 +1,143 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk)
|
||||
Copyright 2010 Peter Danneger
|
||||
Copyright 2010 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 disclaim 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.
|
||||
*/
|
||||
|
||||
#include "SoftUART.h"
|
||||
|
||||
volatile uint8_t srx_done, stx_count;
|
||||
volatile uint8_t srx_data, srx_mask, srx_tmp, stx_data;
|
||||
|
||||
uint8_t SoftUART_IsReady(void)
|
||||
{
|
||||
return !(stx_count);
|
||||
}
|
||||
|
||||
uint8_t SoftUART_TxByte(uint8_t Byte)
|
||||
{
|
||||
while (stx_count);
|
||||
|
||||
stx_data = ~Byte;
|
||||
stx_count = 10;
|
||||
|
||||
return Byte;
|
||||
}
|
||||
|
||||
uint8_t SoftUART_IsReceived(void)
|
||||
{
|
||||
return srx_done;
|
||||
}
|
||||
|
||||
uint8_t SoftUART_RxByte(void)
|
||||
{
|
||||
while (!(srx_done));
|
||||
|
||||
srx_done = 0;
|
||||
|
||||
return srx_data;
|
||||
}
|
||||
|
||||
void SoftUART_Init(void)
|
||||
{
|
||||
OCR2B = TCNT2 + 1; // force first compare
|
||||
TCCR2A = (1 << COM2B1) | (1 << COM2B0); // T1 mode 0
|
||||
TCCR2B = (1 << FOC2B) | (1 << CS21); // CLK/8, T1 mode 0
|
||||
TIMSK2 = (1 << OCIE2B); // enable tx and wait for start
|
||||
EICRA = (1 << ISC01); // -ve edge
|
||||
EIMSK = (1 << INT0); // enable INT0 interrupt
|
||||
|
||||
stx_count = 0; // nothing to send
|
||||
srx_done = 0; // nothing received
|
||||
STXPORT |= 1 << STX; // TX output
|
||||
STXDDR |= 1 << STX; // TX output
|
||||
SRXPORT |= (1 << SRX); // pullup on INT0
|
||||
}
|
||||
|
||||
/* ISR to detect the start of a bit being sent from the transmitter. */
|
||||
ISR(INT0_vect)
|
||||
{
|
||||
OCR2A = TCNT2 + (BIT_TIME / 8 * 3 / 2); // scan 1.5 bits after start
|
||||
|
||||
srx_tmp = 0; // clear bit storage
|
||||
srx_mask = 1; // bit mask
|
||||
|
||||
TIFR2 = (1 << OCF2A); // clear pending interrupt
|
||||
|
||||
if (!(SRXPIN & (1 << SRX))) // still low
|
||||
{
|
||||
TIMSK2 = (1 << OCIE2A) | (1 << OCIE2B); // wait for first bit
|
||||
EIMSK &= ~(1 << INT0);
|
||||
}
|
||||
}
|
||||
|
||||
/* ISR to manage the reception of bits to the transmitter. */
|
||||
ISR(TIMER2_COMPA_vect)
|
||||
{
|
||||
if (srx_mask)
|
||||
{
|
||||
if (SRXPIN & (1 << SRX))
|
||||
srx_tmp |= srx_mask;
|
||||
|
||||
srx_mask <<= 1;
|
||||
|
||||
OCR2A += BIT_TIME / 8; // next bit slice
|
||||
}
|
||||
else
|
||||
{
|
||||
srx_done = 1; // mark rx data valid
|
||||
srx_data = srx_tmp; // store rx data
|
||||
TIMSK2 = (1 << OCIE2B); // enable tx and wait for start
|
||||
EIMSK |= (1 << INT0); // enable START irq
|
||||
EIFR = (1 << INTF0); // clear any pending
|
||||
}
|
||||
}
|
||||
|
||||
/* ISR to manage the transmission of bits to the receiver. */
|
||||
ISR(TIMER2_COMPB_vect)
|
||||
{
|
||||
OCR2B += BIT_TIME / 8; // next bit slice
|
||||
|
||||
if (stx_count)
|
||||
{
|
||||
if (--stx_count != 9) // no start bit
|
||||
{
|
||||
if (!(stx_data & 1)) // test inverted data
|
||||
TCCR2A = (1 << COM2B1) | (1 << COM2B0);
|
||||
else
|
||||
TCCR2A = (1 << COM2B1);
|
||||
|
||||
stx_data >>= 1; // shift zero in from left
|
||||
}
|
||||
else
|
||||
{
|
||||
TCCR2A = (1 << COM2B1); // START bit
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk)
|
||||
Copyright 2010 Peter Danneger
|
||||
Copyright 2010 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 disclaim 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.
|
||||
*/
|
||||
|
||||
#include "SoftUART.h"
|
||||
|
||||
volatile uint8_t srx_done, stx_count;
|
||||
volatile uint8_t srx_data, srx_mask, srx_tmp, stx_data;
|
||||
|
||||
uint8_t SoftUART_IsReady(void)
|
||||
{
|
||||
return !(stx_count);
|
||||
}
|
||||
|
||||
uint8_t SoftUART_TxByte(uint8_t Byte)
|
||||
{
|
||||
while (stx_count);
|
||||
|
||||
stx_data = ~Byte;
|
||||
stx_count = 10;
|
||||
|
||||
return Byte;
|
||||
}
|
||||
|
||||
uint8_t SoftUART_IsReceived(void)
|
||||
{
|
||||
return srx_done;
|
||||
}
|
||||
|
||||
uint8_t SoftUART_RxByte(void)
|
||||
{
|
||||
while (!(srx_done));
|
||||
|
||||
srx_done = 0;
|
||||
|
||||
return srx_data;
|
||||
}
|
||||
|
||||
void SoftUART_Init(void)
|
||||
{
|
||||
OCR2B = TCNT2 + 1; // force first compare
|
||||
TCCR2A = (1 << COM2B1) | (1 << COM2B0); // T1 mode 0
|
||||
TCCR2B = (1 << FOC2B) | (1 << CS21); // CLK/8, T1 mode 0
|
||||
TIMSK2 = (1 << OCIE2B); // enable tx and wait for start
|
||||
EICRA = (1 << ISC01); // -ve edge
|
||||
EIMSK = (1 << INT0); // enable INT0 interrupt
|
||||
|
||||
stx_count = 0; // nothing to send
|
||||
srx_done = 0; // nothing received
|
||||
STXPORT |= 1 << STX; // TX output
|
||||
STXDDR |= 1 << STX; // TX output
|
||||
SRXPORT |= (1 << SRX); // pullup on INT0
|
||||
}
|
||||
|
||||
/* ISR to detect the start of a bit being sent from the transmitter. */
|
||||
ISR(INT0_vect)
|
||||
{
|
||||
OCR2A = TCNT2 + (BIT_TIME / 8 * 3 / 2); // scan 1.5 bits after start
|
||||
|
||||
srx_tmp = 0; // clear bit storage
|
||||
srx_mask = 1; // bit mask
|
||||
|
||||
TIFR2 = (1 << OCF2A); // clear pending interrupt
|
||||
|
||||
if (!(SRXPIN & (1 << SRX))) // still low
|
||||
{
|
||||
TIMSK2 = (1 << OCIE2A) | (1 << OCIE2B); // wait for first bit
|
||||
EIMSK &= ~(1 << INT0);
|
||||
}
|
||||
}
|
||||
|
||||
/* ISR to manage the reception of bits to the transmitter. */
|
||||
ISR(TIMER2_COMPA_vect)
|
||||
{
|
||||
if (srx_mask)
|
||||
{
|
||||
if (SRXPIN & (1 << SRX))
|
||||
srx_tmp |= srx_mask;
|
||||
|
||||
srx_mask <<= 1;
|
||||
|
||||
OCR2A += BIT_TIME / 8; // next bit slice
|
||||
}
|
||||
else
|
||||
{
|
||||
srx_done = 1; // mark rx data valid
|
||||
srx_data = srx_tmp; // store rx data
|
||||
TIMSK2 = (1 << OCIE2B); // enable tx and wait for start
|
||||
EIMSK |= (1 << INT0); // enable START irq
|
||||
EIFR = (1 << INTF0); // clear any pending
|
||||
}
|
||||
}
|
||||
|
||||
/* ISR to manage the transmission of bits to the receiver. */
|
||||
ISR(TIMER2_COMPB_vect)
|
||||
{
|
||||
OCR2B += BIT_TIME / 8; // next bit slice
|
||||
|
||||
if (stx_count)
|
||||
{
|
||||
if (--stx_count != 9) // no start bit
|
||||
{
|
||||
if (!(stx_data & 1)) // test inverted data
|
||||
TCCR2A = (1 << COM2B1) | (1 << COM2B0);
|
||||
else
|
||||
TCCR2A = (1 << COM2B1);
|
||||
|
||||
stx_data >>= 1; // shift zero in from left
|
||||
}
|
||||
else
|
||||
{
|
||||
TCCR2A = (1 << COM2B1); // START bit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk)
|
||||
Copyright 2010 Peter Danneger
|
||||
Copyright 2010 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 disclaim 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.
|
||||
*/
|
||||
|
||||
#ifndef _SOFT_UART_
|
||||
#define _SOFT_UART_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include "SoftUART.h"
|
||||
|
||||
/* Macros: */
|
||||
#define BAUD 9600
|
||||
#define BIT_TIME (uint16_t)((F_CPU + (BAUD / 2)) / BAUD)
|
||||
|
||||
#define SRX PD0
|
||||
#define SRXPIN PIND
|
||||
#define SRXPORT PORTD
|
||||
|
||||
#define STX PD1
|
||||
#define STXPORT PORTD
|
||||
#define STXDDR DDRD
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint8_t SoftUART_IsReady(void);
|
||||
uint8_t SoftUART_TxByte(uint8_t c);
|
||||
uint8_t SoftUART_IsReceived(void);
|
||||
uint8_t SoftUART_RxByte(void);
|
||||
void SoftUART_Init(void);
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 David Prentice (david.prentice [at] farming [dot] uk)
|
||||
Copyright 2010 Peter Danneger
|
||||
Copyright 2010 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 disclaim 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.
|
||||
*/
|
||||
|
||||
#ifndef _SOFT_UART_
|
||||
#define _SOFT_UART_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include "SoftUART.h"
|
||||
|
||||
/* Macros: */
|
||||
#define BAUD 9600
|
||||
#define BIT_TIME (uint16_t)((F_CPU + (BAUD / 2)) / BAUD)
|
||||
|
||||
#define SRX PD0
|
||||
#define SRXPIN PIND
|
||||
#define SRXPORT PORTD
|
||||
|
||||
#define STX PD1
|
||||
#define STXPORT PORTD
|
||||
#define STXDDR DDRD
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint8_t SoftUART_IsReady(void);
|
||||
uint8_t SoftUART_TxByte(uint8_t c);
|
||||
uint8_t SoftUART_IsReceived(void);
|
||||
uint8_t SoftUART_RxByte(void);
|
||||
void SoftUART_Init(void);
|
||||
|
||||
#endif
|
|
@ -1,264 +1,264 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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"
|
||||
|
||||
/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
|
||||
* the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
|
||||
* This allows the host to track a device across insertions on different ports, allowing them to retain allocated
|
||||
* resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
|
||||
* so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
|
||||
* from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
|
||||
* port location).
|
||||
*/
|
||||
#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
|
||||
#warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
|
||||
#endif
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
USB_Descriptor_Device_t PROGMEM USART_DeviceDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
|
||||
|
||||
.USBSpecification = VERSION_BCD(01.10),
|
||||
.Class = 0x02,
|
||||
.SubClass = 0x00,
|
||||
.Protocol = 0x00,
|
||||
|
||||
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
|
||||
|
||||
.VendorID = 0x03EB,
|
||||
.ProductID = 0x204B,
|
||||
.ReleaseNumber = 0x0000,
|
||||
|
||||
.ManufacturerStrIndex = 0x01,
|
||||
.ProductStrIndex = 0x02,
|
||||
.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.
|
||||
*/
|
||||
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_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
|
||||
|
||||
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
|
||||
},
|
||||
|
||||
.CDC_CCI_Interface =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 0,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 1,
|
||||
|
||||
.Class = 0x02,
|
||||
.SubClass = 0x02,
|
||||
.Protocol = 0x01,
|
||||
|
||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||
},
|
||||
|
||||
.CDC_Functional_IntHeader =
|
||||
{
|
||||
.Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
|
||||
.SubType = 0x00,
|
||||
|
||||
.Data = {0x01, 0x10}
|
||||
},
|
||||
|
||||
.CDC_Functional_AbstractControlManagement =
|
||||
{
|
||||
.Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), .Type = 0x24},
|
||||
.SubType = 0x02,
|
||||
|
||||
.Data = {0x06}
|
||||
},
|
||||
|
||||
.CDC_Functional_Union=
|
||||
{
|
||||
.Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
|
||||
.SubType = 0x06,
|
||||
|
||||
.Data = {0x00, 0x01}
|
||||
},
|
||||
|
||||
.CDC_ManagementEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
|
||||
.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 = 1,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 2,
|
||||
|
||||
.Class = 0x0A,
|
||||
.SubClass = 0x00,
|
||||
.Protocol = 0x00,
|
||||
|
||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||
},
|
||||
|
||||
.CDC_DataOutEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = CDC_TXRX_EPSIZE,
|
||||
.PollingIntervalMS = 0x00
|
||||
},
|
||||
|
||||
.CDC_DataInEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = CDC_TXRX_EPSIZE,
|
||||
.PollingIntervalMS = 0x00
|
||||
}
|
||||
};
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM USART_LanguageString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = {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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM USART_ManufacturerString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = 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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM USART_ProductString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"LUFA XPLAIN Bridge"
|
||||
};
|
||||
|
||||
/** Descriptior 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, void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
||||
void* Address = NULL;
|
||||
uint16_t Size = NO_DESCRIPTOR;
|
||||
|
||||
switch (DescriptorType)
|
||||
{
|
||||
case DTYPE_Device:
|
||||
Address = (void*)&USART_DeviceDescriptor;
|
||||
Size = sizeof(USB_Descriptor_Device_t);
|
||||
break;
|
||||
case DTYPE_Configuration:
|
||||
Address = (void*)&USART_ConfigurationDescriptor;
|
||||
Size = sizeof(USART_USB_Descriptor_Configuration_t);
|
||||
break;
|
||||
case DTYPE_String:
|
||||
switch (DescriptorNumber)
|
||||
{
|
||||
case 0x00:
|
||||
Address = (void*)&USART_LanguageString;
|
||||
Size = pgm_read_byte(&USART_LanguageString.Header.Size);
|
||||
break;
|
||||
case 0x01:
|
||||
Address = (void*)&USART_ManufacturerString;
|
||||
Size = pgm_read_byte(&USART_ManufacturerString.Header.Size);
|
||||
break;
|
||||
case 0x02:
|
||||
Address = (void*)&USART_ProductString;
|
||||
Size = pgm_read_byte(&USART_ProductString.Header.Size);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
*DescriptorAddress = Address;
|
||||
return Size;
|
||||
}
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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"
|
||||
|
||||
/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
|
||||
* the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
|
||||
* This allows the host to track a device across insertions on different ports, allowing them to retain allocated
|
||||
* resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
|
||||
* so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
|
||||
* from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
|
||||
* port location).
|
||||
*/
|
||||
#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
|
||||
#warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
|
||||
#endif
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
USB_Descriptor_Device_t PROGMEM USART_DeviceDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
|
||||
|
||||
.USBSpecification = VERSION_BCD(01.10),
|
||||
.Class = 0x02,
|
||||
.SubClass = 0x00,
|
||||
.Protocol = 0x00,
|
||||
|
||||
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
|
||||
|
||||
.VendorID = 0x03EB,
|
||||
.ProductID = 0x204B,
|
||||
.ReleaseNumber = 0x0000,
|
||||
|
||||
.ManufacturerStrIndex = 0x01,
|
||||
.ProductStrIndex = 0x02,
|
||||
.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.
|
||||
*/
|
||||
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_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
|
||||
|
||||
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
|
||||
},
|
||||
|
||||
.CDC_CCI_Interface =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 0,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 1,
|
||||
|
||||
.Class = 0x02,
|
||||
.SubClass = 0x02,
|
||||
.Protocol = 0x01,
|
||||
|
||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||
},
|
||||
|
||||
.CDC_Functional_IntHeader =
|
||||
{
|
||||
.Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
|
||||
.SubType = 0x00,
|
||||
|
||||
.Data = {0x01, 0x10}
|
||||
},
|
||||
|
||||
.CDC_Functional_AbstractControlManagement =
|
||||
{
|
||||
.Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), .Type = 0x24},
|
||||
.SubType = 0x02,
|
||||
|
||||
.Data = {0x06}
|
||||
},
|
||||
|
||||
.CDC_Functional_Union=
|
||||
{
|
||||
.Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24},
|
||||
.SubType = 0x06,
|
||||
|
||||
.Data = {0x00, 0x01}
|
||||
},
|
||||
|
||||
.CDC_ManagementEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
|
||||
.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 = 1,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 2,
|
||||
|
||||
.Class = 0x0A,
|
||||
.SubClass = 0x00,
|
||||
.Protocol = 0x00,
|
||||
|
||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||
},
|
||||
|
||||
.CDC_DataOutEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = CDC_TXRX_EPSIZE,
|
||||
.PollingIntervalMS = 0x00
|
||||
},
|
||||
|
||||
.CDC_DataInEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = CDC_TXRX_EPSIZE,
|
||||
.PollingIntervalMS = 0x00
|
||||
}
|
||||
};
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM USART_LanguageString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = {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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM USART_ManufacturerString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = 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.
|
||||
*/
|
||||
USB_Descriptor_String_t PROGMEM USART_ProductString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"LUFA XPLAIN Bridge"
|
||||
};
|
||||
|
||||
/** Descriptior 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, void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
||||
void* Address = NULL;
|
||||
uint16_t Size = NO_DESCRIPTOR;
|
||||
|
||||
switch (DescriptorType)
|
||||
{
|
||||
case DTYPE_Device:
|
||||
Address = (void*)&USART_DeviceDescriptor;
|
||||
Size = sizeof(USB_Descriptor_Device_t);
|
||||
break;
|
||||
case DTYPE_Configuration:
|
||||
Address = (void*)&USART_ConfigurationDescriptor;
|
||||
Size = sizeof(USART_USB_Descriptor_Configuration_t);
|
||||
break;
|
||||
case DTYPE_String:
|
||||
switch (DescriptorNumber)
|
||||
{
|
||||
case 0x00:
|
||||
Address = (void*)&USART_LanguageString;
|
||||
Size = pgm_read_byte(&USART_LanguageString.Header.Size);
|
||||
break;
|
||||
case 0x01:
|
||||
Address = (void*)&USART_ManufacturerString;
|
||||
Size = pgm_read_byte(&USART_ManufacturerString.Header.Size);
|
||||
break;
|
||||
case 0x02:
|
||||
Address = (void*)&USART_ProductString;
|
||||
Size = pgm_read_byte(&USART_ProductString.Header.Size);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
*DescriptorAddress = Address;
|
||||
return Size;
|
||||
}
|
||||
|
|
|
@ -1,82 +1,82 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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 <LUFA/Drivers/USB/Class/CDC.h>
|
||||
|
||||
/* Macros: */
|
||||
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
|
||||
#define CDC_NOTIFICATION_EPNUM 2
|
||||
|
||||
/** Endpoint number of the CDC device-to-host data IN endpoint. */
|
||||
#define CDC_TX_EPNUM 3
|
||||
|
||||
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
|
||||
#define CDC_RX_EPNUM 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;
|
||||
USB_Descriptor_Interface_t CDC_CCI_Interface;
|
||||
CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_IntHeader;
|
||||
CDC_FUNCTIONAL_DESCRIPTOR(1) CDC_Functional_AbstractControlManagement;
|
||||
CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_Union;
|
||||
USB_Descriptor_Endpoint_t CDC_ManagementEndpoint;
|
||||
USB_Descriptor_Interface_t CDC_DCI_Interface;
|
||||
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
|
||||
USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
|
||||
} USART_USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t USART_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
|
||||
|
||||
#endif
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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 <LUFA/Drivers/USB/Class/CDC.h>
|
||||
|
||||
/* Macros: */
|
||||
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
|
||||
#define CDC_NOTIFICATION_EPNUM 2
|
||||
|
||||
/** Endpoint number of the CDC device-to-host data IN endpoint. */
|
||||
#define CDC_TX_EPNUM 3
|
||||
|
||||
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
|
||||
#define CDC_RX_EPNUM 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;
|
||||
USB_Descriptor_Interface_t CDC_CCI_Interface;
|
||||
CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_IntHeader;
|
||||
CDC_FUNCTIONAL_DESCRIPTOR(1) CDC_Functional_AbstractControlManagement;
|
||||
CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_Union;
|
||||
USB_Descriptor_Endpoint_t CDC_ManagementEndpoint;
|
||||
USB_Descriptor_Interface_t CDC_DCI_Interface;
|
||||
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
|
||||
USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
|
||||
} USART_USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t USART_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,240 +1,240 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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 demo 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_PDI_PROGRAMMER;
|
||||
|
||||
/** 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 = 0,
|
||||
|
||||
.DataINEndpointNumber = CDC_TX_EPNUM,
|
||||
.DataINEndpointSize = CDC_TXRX_EPSIZE,
|
||||
.DataINEndpointDoubleBank = true,
|
||||
|
||||
.DataOUTEndpointNumber = CDC_RX_EPNUM,
|
||||
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
|
||||
.DataOUTEndpointDoubleBank = true,
|
||||
|
||||
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
|
||||
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
|
||||
.NotificationEndpointDoubleBank = false,
|
||||
},
|
||||
};
|
||||
|
||||
/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */
|
||||
RingBuff_t USBtoUART_Buffer;
|
||||
|
||||
/** Circular buffer to hold data from the serial port before it is sent to the host. */
|
||||
RingBuff_t UARTtoUSB_Buffer;
|
||||
|
||||
|
||||
/** 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();
|
||||
|
||||
Buffer_Initialize(&USBtoUART_Buffer);
|
||||
Buffer_Initialize(&UARTtoUSB_Buffer);
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
|
||||
sei();
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (CurrentFirmwareMode == MODE_USART_BRIDGE)
|
||||
USARTBridge_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;
|
||||
|
||||
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
|
||||
|
||||
/* 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 USARTBridge_Task(void)
|
||||
{
|
||||
/* Must be in the configured state for the USART Bridge code to process data */
|
||||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||
return;
|
||||
|
||||
/* Read bytes from the USB OUT endpoint into the UART transmit buffer */
|
||||
for (uint8_t DataBytesRem = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface); DataBytesRem != 0; DataBytesRem--)
|
||||
{
|
||||
if (!(BUFF_STATICSIZE - USBtoUART_Buffer.Elements))
|
||||
break;
|
||||
|
||||
Buffer_StoreElement(&USBtoUART_Buffer, CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
|
||||
}
|
||||
|
||||
/* Read bytes from the UART receive buffer into the USB IN endpoint */
|
||||
if (UARTtoUSB_Buffer.Elements)
|
||||
CDC_Device_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&UARTtoUSB_Buffer));
|
||||
|
||||
/* Load bytes from the UART transmit buffer into the UART */
|
||||
if ((USBtoUART_Buffer.Elements) && SoftUART_IsReady())
|
||||
SoftUART_TxByte(Buffer_GetElement(&USBtoUART_Buffer));
|
||||
|
||||
/* Load bytes from the UART into the UART receive buffer */
|
||||
if (SoftUART_IsReceived())
|
||||
Buffer_StoreElement(&UARTtoUSB_Buffer, SoftUART_RxByte());
|
||||
|
||||
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
|
||||
}
|
||||
|
||||
/** Configures the board hardware and chip peripherals for the demo's functionality. */
|
||||
void SetupHardware(void)
|
||||
{
|
||||
/* Disable watchdog if enabled by bootloader/fuses */
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
wdt_disable();
|
||||
|
||||
/* Disable clock division */
|
||||
clock_prescale_set(clock_div_1);
|
||||
|
||||
/* Hardware Initialization */
|
||||
SoftUART_Init();
|
||||
LEDs_Init();
|
||||
USB_Init();
|
||||
V2Protocol_Init();
|
||||
|
||||
/* Disable JTAG debugging */
|
||||
MCUCR |= (1 << JTD);
|
||||
MCUCR |= (1 << JTD);
|
||||
|
||||
/* Enable pullup 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);
|
||||
}
|
||||
|
||||
/** Event handler for the library USB Configuration Changed event. */
|
||||
void EVENT_USB_Device_ConfigurationChanged(void)
|
||||
{
|
||||
bool EndpointConfigSuccess = true;
|
||||
|
||||
/* Configure the device endpoints according to the selected mode */
|
||||
if (CurrentFirmwareMode == MODE_USART_BRIDGE)
|
||||
{
|
||||
EndpointConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
|
||||
}
|
||||
else
|
||||
{
|
||||
EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPNUM, EP_TYPE_BULK,
|
||||
ENDPOINT_DIR_OUT, AVRISP_DATA_EPSIZE,
|
||||
ENDPOINT_BANK_SINGLE);
|
||||
|
||||
#if defined(LIBUSB_FILTERDRV_COMPAT)
|
||||
EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK,
|
||||
ENDPOINT_DIR_IN, AVRISP_DATA_EPSIZE,
|
||||
ENDPOINT_BANK_SINGLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (EndpointConfigSuccess)
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||
else
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
}
|
||||
|
||||
/** Event handler for the library USB Unhandled Control Request event. */
|
||||
void EVENT_USB_Device_UnhandledControlRequest(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);
|
||||
}
|
||||
|
||||
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
|
||||
* documentation) by the application code so that the address and size of a requested descriptor can be given
|
||||
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
|
||||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, 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);
|
||||
}
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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 demo 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_PDI_PROGRAMMER;
|
||||
|
||||
/** 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 = 0,
|
||||
|
||||
.DataINEndpointNumber = CDC_TX_EPNUM,
|
||||
.DataINEndpointSize = CDC_TXRX_EPSIZE,
|
||||
.DataINEndpointDoubleBank = true,
|
||||
|
||||
.DataOUTEndpointNumber = CDC_RX_EPNUM,
|
||||
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
|
||||
.DataOUTEndpointDoubleBank = true,
|
||||
|
||||
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
|
||||
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
|
||||
.NotificationEndpointDoubleBank = false,
|
||||
},
|
||||
};
|
||||
|
||||
/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */
|
||||
RingBuff_t USBtoUART_Buffer;
|
||||
|
||||
/** Circular buffer to hold data from the serial port before it is sent to the host. */
|
||||
RingBuff_t UARTtoUSB_Buffer;
|
||||
|
||||
|
||||
/** 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();
|
||||
|
||||
Buffer_Initialize(&USBtoUART_Buffer);
|
||||
Buffer_Initialize(&UARTtoUSB_Buffer);
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
|
||||
sei();
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (CurrentFirmwareMode == MODE_USART_BRIDGE)
|
||||
USARTBridge_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;
|
||||
|
||||
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
|
||||
|
||||
/* 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 USARTBridge_Task(void)
|
||||
{
|
||||
/* Must be in the configured state for the USART Bridge code to process data */
|
||||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||
return;
|
||||
|
||||
/* Read bytes from the USB OUT endpoint into the UART transmit buffer */
|
||||
for (uint8_t DataBytesRem = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface); DataBytesRem != 0; DataBytesRem--)
|
||||
{
|
||||
if (!(BUFF_STATICSIZE - USBtoUART_Buffer.Elements))
|
||||
break;
|
||||
|
||||
Buffer_StoreElement(&USBtoUART_Buffer, CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
|
||||
}
|
||||
|
||||
/* Read bytes from the UART receive buffer into the USB IN endpoint */
|
||||
if (UARTtoUSB_Buffer.Elements)
|
||||
CDC_Device_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&UARTtoUSB_Buffer));
|
||||
|
||||
/* Load bytes from the UART transmit buffer into the UART */
|
||||
if ((USBtoUART_Buffer.Elements) && SoftUART_IsReady())
|
||||
SoftUART_TxByte(Buffer_GetElement(&USBtoUART_Buffer));
|
||||
|
||||
/* Load bytes from the UART into the UART receive buffer */
|
||||
if (SoftUART_IsReceived())
|
||||
Buffer_StoreElement(&UARTtoUSB_Buffer, SoftUART_RxByte());
|
||||
|
||||
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
|
||||
}
|
||||
|
||||
/** Configures the board hardware and chip peripherals for the demo's functionality. */
|
||||
void SetupHardware(void)
|
||||
{
|
||||
/* Disable watchdog if enabled by bootloader/fuses */
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
wdt_disable();
|
||||
|
||||
/* Disable clock division */
|
||||
clock_prescale_set(clock_div_1);
|
||||
|
||||
/* Hardware Initialization */
|
||||
SoftUART_Init();
|
||||
LEDs_Init();
|
||||
USB_Init();
|
||||
V2Protocol_Init();
|
||||
|
||||
/* Disable JTAG debugging */
|
||||
MCUCR |= (1 << JTD);
|
||||
MCUCR |= (1 << JTD);
|
||||
|
||||
/* Enable pullup 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);
|
||||
}
|
||||
|
||||
/** Event handler for the library USB Configuration Changed event. */
|
||||
void EVENT_USB_Device_ConfigurationChanged(void)
|
||||
{
|
||||
bool EndpointConfigSuccess = true;
|
||||
|
||||
/* Configure the device endpoints according to the selected mode */
|
||||
if (CurrentFirmwareMode == MODE_USART_BRIDGE)
|
||||
{
|
||||
EndpointConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
|
||||
}
|
||||
else
|
||||
{
|
||||
EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPNUM, EP_TYPE_BULK,
|
||||
ENDPOINT_DIR_OUT, AVRISP_DATA_EPSIZE,
|
||||
ENDPOINT_BANK_SINGLE);
|
||||
|
||||
#if defined(LIBUSB_FILTERDRV_COMPAT)
|
||||
EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK,
|
||||
ENDPOINT_DIR_IN, AVRISP_DATA_EPSIZE,
|
||||
ENDPOINT_BANK_SINGLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (EndpointConfigSuccess)
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||
else
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
}
|
||||
|
||||
/** Event handler for the library USB Unhandled Control Request event. */
|
||||
void EVENT_USB_Device_UnhandledControlRequest(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);
|
||||
}
|
||||
|
||||
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
|
||||
* documentation) by the application code so that the address and size of a requested descriptor can be given
|
||||
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
|
||||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, 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);
|
||||
}
|
||||
|
|
|
@ -1,94 +1,94 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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 "AVRISPDescriptors.h"
|
||||
#include "USARTDescriptors.h"
|
||||
|
||||
#include "Lib/RingBuff.h"
|
||||
#include "Lib/SoftUART.h"
|
||||
#include <Lib/V2Protocol.h>
|
||||
|
||||
#include <LUFA/Version.h>
|
||||
#include <LUFA/Drivers/Board/LEDs.h>
|
||||
#include <LUFA/Drivers/USB/USB.h>
|
||||
#include <LUFA/Drivers/USB/Class/CDC.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;
|
||||
|
||||
/* Function Prototypes: */
|
||||
void SetupHardware(void);
|
||||
void AVRISP_Task(void);
|
||||
void USARTBridge_Task(void);
|
||||
|
||||
void EVENT_USB_Device_ConfigurationChanged(void);
|
||||
void EVENT_USB_Device_UnhandledControlRequest(void);
|
||||
void EVENT_USB_Device_Connect(void);
|
||||
void EVENT_USB_Device_Disconnect(void);
|
||||
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
|
||||
|
||||
#endif
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2010 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 disclaim 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 "AVRISPDescriptors.h"
|
||||
#include "USARTDescriptors.h"
|
||||
|
||||
#include "Lib/RingBuff.h"
|
||||
#include "Lib/SoftUART.h"
|
||||
#include <Lib/V2Protocol.h>
|
||||
|
||||
#include <LUFA/Version.h>
|
||||
#include <LUFA/Drivers/Board/LEDs.h>
|
||||
#include <LUFA/Drivers/USB/USB.h>
|
||||
#include <LUFA/Drivers/USB/Class/CDC.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;
|
||||
|
||||
/* Function Prototypes: */
|
||||
void SetupHardware(void);
|
||||
void AVRISP_Task(void);
|
||||
void USARTBridge_Task(void);
|
||||
|
||||
void EVENT_USB_Device_ConfigurationChanged(void);
|
||||
void EVENT_USB_Device_UnhandledControlRequest(void);
|
||||
void EVENT_USB_Device_Connect(void);
|
||||
void EVENT_USB_Device_Disconnect(void);
|
||||
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,89 +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 SSec_Compat Project Compatibility:
|
||||
*
|
||||
* The following list indicates what microcontrollers are compatible with this project.
|
||||
*
|
||||
* - AT90USB1287
|
||||
*
|
||||
* \section SSec_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>Usable Speeds:</b></td>
|
||||
* <td>1) Full Speed Mode</td>
|
||||
* <td>2) Full Speed Mode</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* \section SSec_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 compaible 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.
|
||||
*
|
||||
* After running this project 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 drivers,
|
||||
* negating the need for custom drivers for the device. Other Operating Systems should automatically use their own inbuilt CDC-ACM
|
||||
* drivers.
|
||||
*
|
||||
* This project relies on files from the LUFA AVRISP-MKII project for compilation.
|
||||
*
|
||||
* \section SSec_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>
|
||||
* <td><b>Define Name:</b></td>
|
||||
* <td><b>Location:</b></td>
|
||||
* <td><b>Description:</b></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>BUFF_STATICSIZE</td>
|
||||
* <td>RingBuff.h</td>
|
||||
* <td>Defines the maximum number of bytes which can be buffered in each Ring Buffer.</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>LIBUSB_FILTERDRV_COMPAT</td>
|
||||
* <td>Makefile CDEFS</td>
|
||||
* <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making
|
||||
* the code compatible with Windows builds of avrdude using the libUSB driver. Linux platforms are not affected by this
|
||||
* option.
|
||||
* </tr>
|
||||
* </table>
|
||||
/** \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 SSec_Compat Project Compatibility:
|
||||
*
|
||||
* The following list indicates what microcontrollers are compatible with this project.
|
||||
*
|
||||
* - AT90USB1287
|
||||
*
|
||||
* \section SSec_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>Usable Speeds:</b></td>
|
||||
* <td>1) Full Speed Mode</td>
|
||||
* <td>2) Full Speed Mode</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* \section SSec_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 compaible 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.
|
||||
*
|
||||
* After running this project 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 drivers,
|
||||
* negating the need for custom drivers for the device. Other Operating Systems should automatically use their own inbuilt CDC-ACM
|
||||
* drivers.
|
||||
*
|
||||
* This project relies on files from the LUFA AVRISP-MKII project for compilation.
|
||||
*
|
||||
* \section SSec_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>
|
||||
* <td><b>Define Name:</b></td>
|
||||
* <td><b>Location:</b></td>
|
||||
* <td><b>Description:</b></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>BUFF_STATICSIZE</td>
|
||||
* <td>RingBuff.h</td>
|
||||
* <td>Defines the maximum number of bytes which can be buffered in each Ring Buffer.</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>LIBUSB_FILTERDRV_COMPAT</td>
|
||||
* <td>Makefile CDEFS</td>
|
||||
* <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making
|
||||
* the code compatible with Windows builds of avrdude using the libUSB driver. Linux platforms are not affected by this
|
||||
* option.
|
||||
* </tr>
|
||||
* </table>
|
||||
*/
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue