diff options
Diffstat (limited to 'Projects/XPLAINBridge')
-rw-r--r-- | Projects/XPLAINBridge/AVRISPDescriptors.c | 77 | ||||
-rw-r--r-- | Projects/XPLAINBridge/AVRISPDescriptors.h | 19 | ||||
-rw-r--r-- | Projects/XPLAINBridge/Lib/LightweightRingBuff.h | 39 | ||||
-rw-r--r-- | Projects/XPLAINBridge/Lib/SoftUART.c | 17 | ||||
-rw-r--r-- | Projects/XPLAINBridge/Lib/SoftUART.h | 20 | ||||
-rw-r--r-- | Projects/XPLAINBridge/USARTDescriptors.c | 103 | ||||
-rw-r--r-- | Projects/XPLAINBridge/USARTDescriptors.h | 21 | ||||
-rw-r--r-- | Projects/XPLAINBridge/XPLAINBridge.c | 23 | ||||
-rw-r--r-- | Projects/XPLAINBridge/XPLAINBridge.h | 19 | ||||
-rw-r--r-- | Projects/XPLAINBridge/XPLAINBridge.txt | 7 | ||||
-rw-r--r-- | Projects/XPLAINBridge/makefile | 49 |
11 files changed, 202 insertions, 192 deletions
diff --git a/Projects/XPLAINBridge/AVRISPDescriptors.c b/Projects/XPLAINBridge/AVRISPDescriptors.c index e8f9f8d88..7c4d1a82a 100644 --- a/Projects/XPLAINBridge/AVRISPDescriptors.c +++ b/Projects/XPLAINBridge/AVRISPDescriptors.c @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + 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 + 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 + 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 @@ -30,9 +30,9 @@ /** \file * - * USB Device Descriptors, for library use when in USB device mode. Descriptors are special + * 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. + * the device's capabilities and functions. */ #include "AVRISPDescriptors.h" @@ -45,22 +45,22 @@ 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 }; @@ -71,41 +71,41 @@ USB_Descriptor_Device_t PROGMEM AVRISP_DeviceDescriptor = */ AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor = { - .Config = + .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_BUSPOWERED, - + .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) }, - .AVRISP_Interface = + .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 = + .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, @@ -115,7 +115,7 @@ AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor = .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, @@ -130,7 +130,7 @@ AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor = USB_Descriptor_String_t PROGMEM AVRISP_LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, - + .UnicodeString = {LANGUAGE_ID_ENG} }; @@ -141,7 +141,7 @@ USB_Descriptor_String_t PROGMEM AVRISP_LanguageString = USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString = { .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String}, - + .UnicodeString = L"Dean Camera" }; @@ -152,7 +152,7 @@ USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString = USB_Descriptor_String_t PROGMEM AVRISP_ProductString = { .Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String}, - + .UnicodeString = L"LUFA AVRISP MkII Clone" }; @@ -162,7 +162,7 @@ USB_Descriptor_String_t PROGMEM AVRISP_ProductString = USB_Descriptor_String_t PROGMEM AVRISP_SerialString = { .Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String}, - + .UnicodeString = L"0000A00128255" }; @@ -181,41 +181,42 @@ uint16_t AVRISP_GetDescriptor(const uint16_t wValue, const void* Address = NULL; uint16_t Size = NO_DESCRIPTOR; - + switch (DescriptorType) { - case DTYPE_Device: + case DTYPE_Device: Address = &AVRISP_DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; - case DTYPE_Configuration: + case DTYPE_Configuration: Address = &AVRISP_ConfigurationDescriptor; Size = sizeof(AVRISP_USB_Descriptor_Configuration_t); break; - case DTYPE_String: + case DTYPE_String: switch (DescriptorNumber) { - case 0x00: + case 0x00: Address = &AVRISP_LanguageString; Size = pgm_read_byte(&AVRISP_LanguageString.Header.Size); break; - case 0x01: + case 0x01: Address = &AVRISP_ManufacturerString; Size = pgm_read_byte(&AVRISP_ManufacturerString.Header.Size); break; - case 0x02: + case 0x02: Address = &AVRISP_ProductString; Size = pgm_read_byte(&AVRISP_ProductString.Header.Size); break; case 0x03: Address = &AVRISP_SerialString; Size = pgm_read_byte(&AVRISP_SerialString.Header.Size); - break; + break; } - + break; } - + *DescriptorAddress = Address; return Size; } + diff --git a/Projects/XPLAINBridge/AVRISPDescriptors.h b/Projects/XPLAINBridge/AVRISPDescriptors.h index edfb37dbe..8c9bc29eb 100644 --- a/Projects/XPLAINBridge/AVRISPDescriptors.h +++ b/Projects/XPLAINBridge/AVRISPDescriptors.h @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + 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 + 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 + 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 @@ -32,7 +32,7 @@ * * Header file for AVRISPDescriptors.c. */ - + #ifndef _AVRISP_DESCRIPTORS_H_ #define _AVRISP_DESCRIPTORS_H_ @@ -55,9 +55,9 @@ /** 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 + #define AVRISP_DATA_EPSIZE 64 /* Type Defines: */ /** Type define for the device configuration descriptor structure. This must be defined in the @@ -78,3 +78,4 @@ const void** const DescriptorAddress); #endif + diff --git a/Projects/XPLAINBridge/Lib/LightweightRingBuff.h b/Projects/XPLAINBridge/Lib/LightweightRingBuff.h index 768e49a50..2fbc164cb 100644 --- a/Projects/XPLAINBridge/Lib/LightweightRingBuff.h +++ b/Projects/XPLAINBridge/Lib/LightweightRingBuff.h @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + 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 + 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 + 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 @@ -39,20 +39,20 @@ * or deletions) must not overlap. If there is possibility of two or more of the same kind of * operating occuring at the same point in time, atomic (mutex) locking should be used. */ - + #ifndef _ULW_RING_BUFF_H_ #define _ULW_RING_BUFF_H_ /* Includes: */ #include <util/atomic.h> - + #include <stdint.h> #include <stdbool.h> /* Defines: */ /** Size of each ring buffer, in data elements - must be between 1 and 255. */ #define BUFFER_SIZE 255 - + /** Type of data to store into the buffer. */ #define RingBuff_Data_t uint8_t @@ -76,7 +76,7 @@ RingBuff_Data_t* Out; /**< Current retrieval location in the circular buffer */ RingBuff_Count_t Count; } RingBuff_t; - + /* Inline Functions: */ /** Initializes a ring buffer ready for use. Buffers must be initialized via this function * before any operations are called upon them. Already initialized buffers may be reset @@ -92,7 +92,7 @@ Buffer->Out = Buffer->Buffer; } } - + /** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed * by entering an atomic lock on the buffer while the IN and OUT locations are fetched, so that * the buffer cannot be modified while the computation takes place. This value should be cached @@ -109,15 +109,15 @@ static inline RingBuff_Count_t RingBuffer_GetCount(RingBuff_t* const Buffer) { RingBuff_Count_t Count; - + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { Count = Buffer->Count; } - + return Count; } - + /** Atomically determines if the specified ring buffer contains any free space. This should * be tested before storing data to the buffer, to ensure that no data is lost due to a * buffer overrun. @@ -125,7 +125,7 @@ * \param[in,out] Buffer Pointer to a ring buffer structure to insert into * * \return Boolean true if the buffer contains no free space, false otherwise - */ + */ static inline bool RingBuffer_IsFull(RingBuff_t* const Buffer) { return (RingBuffer_GetCount(Buffer) == BUFFER_SIZE); @@ -142,7 +142,7 @@ * \param[in,out] Buffer Pointer to a ring buffer structure to insert into * * \return Boolean true if the buffer contains no free space, false otherwise - */ + */ static inline bool RingBuffer_IsEmpty(RingBuff_t* const Buffer) { return (RingBuffer_GetCount(Buffer) == 0); @@ -161,7 +161,7 @@ const RingBuff_Data_t Data) { *Buffer->In = Data; - + if (++Buffer->In == &Buffer->Buffer[BUFFER_SIZE]) Buffer->In = Buffer->Buffer; @@ -184,7 +184,7 @@ static inline RingBuff_Data_t RingBuffer_Remove(RingBuff_t* const Buffer) { RingBuff_Data_t Data = *Buffer->Out; - + if (++Buffer->Out == &Buffer->Buffer[BUFFER_SIZE]) Buffer->Out = Buffer->Buffer; @@ -192,8 +192,9 @@ { Buffer->Count--; } - + return Data; } #endif + diff --git a/Projects/XPLAINBridge/Lib/SoftUART.c b/Projects/XPLAINBridge/Lib/SoftUART.c index 12fdf96bc..00bb38320 100644 --- a/Projects/XPLAINBridge/Lib/SoftUART.c +++ b/Projects/XPLAINBridge/Lib/SoftUART.c @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -11,13 +11,13 @@ Copyright 2010 Peter Danneger Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + 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 + 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 + 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 @@ -79,7 +79,7 @@ ISR(INT0_vect, ISR_BLOCK) { /* Reset the number of reception bits remaining counter */ RX_BitsRemaining = 8; - + /* Reset the bit reception timer */ TCNT1 = 0; @@ -120,7 +120,7 @@ ISR(TIMER1_CAPT_vect, ISR_BLOCK) /* Reception complete, store the received byte if stop bit valid */ if (SRX_Cached) - RingBuffer_Insert(&XMEGAtoUSB_Buffer, RX_Data); + RingBuffer_Insert(&XMEGAtoUSB_Buffer, RX_Data); } } @@ -150,3 +150,4 @@ ISR(TIMER3_CAPT_vect, ISR_BLOCK) TX_BitsRemaining = 9; } } + diff --git a/Projects/XPLAINBridge/Lib/SoftUART.h b/Projects/XPLAINBridge/Lib/SoftUART.h index 923631b50..9dd81ad35 100644 --- a/Projects/XPLAINBridge/Lib/SoftUART.h +++ b/Projects/XPLAINBridge/Lib/SoftUART.h @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -11,13 +11,13 @@ Copyright 2010 Peter Danneger Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + 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 + 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 + 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 @@ -42,7 +42,7 @@ #include <avr/io.h> #include <avr/interrupt.h> #include <stdbool.h> - + #include "../XPLAINBridge.h" #include "LightweightRingBuff.h" @@ -55,11 +55,11 @@ #define STXPORT PORTD #define STXDDR DDRD - /* Inline Functions: */ + /* Inline Functions: */ static inline void SoftUART_SetBaud(const uint32_t Baud) { uint16_t BitTime = ((F_CPU / Baud) - 1); - + ICR1 = BitTime; ICR3 = BitTime; } @@ -67,4 +67,4 @@ /* Function Prototypes: */ void SoftUART_Init(void); -#endif
\ No newline at end of file +#endif diff --git a/Projects/XPLAINBridge/USARTDescriptors.c b/Projects/XPLAINBridge/USARTDescriptors.c index 266c8f3c2..2b1fc6293 100644 --- a/Projects/XPLAINBridge/USARTDescriptors.c +++ b/Projects/XPLAINBridge/USARTDescriptors.c @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + 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 + 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 + 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 @@ -30,9 +30,9 @@ /** \file * - * USB Device Descriptors, for library use when in USB device mode. Descriptors are special + * 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. + * the device's capabilities and functions. */ #include "USARTDescriptors.h" @@ -57,22 +57,22 @@ 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 = VERSION_BCD(00.01), - + .ManufacturerStrIndex = 0x01, .ProductStrIndex = 0x02, .SerialNumStrIndex = USE_INTERNAL_SERIAL, - + .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS }; @@ -83,102 +83,102 @@ USB_Descriptor_Device_t PROGMEM USART_DeviceDescriptor = */ USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor = { - .Config = + .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, - + .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) }, - - .CDC_CCI_Interface = + + .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_Header = + .CDC_Functional_Header = { .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface}, .Subtype = CDC_DSUBTYPE_CSInterface_Header, - + .CDCSpecification = VERSION_BCD(01.10), }, - .CDC_Functional_ACM = + .CDC_Functional_ACM = { .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface}, .Subtype = CDC_DSUBTYPE_CSInterface_ACM, - + .Capabilities = 0x06, }, - - .CDC_Functional_Union = + + .CDC_Functional_Union = { .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface}, .Subtype = CDC_DSUBTYPE_CSInterface_Union, - + .MasterInterfaceNumber = 0, .SlaveInterfaceNumber = 1, }, - .CDC_NotificationEndpoint = + .CDC_NotificationEndpoint = { .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 = + .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 = + .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 = + + .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, @@ -193,7 +193,7 @@ USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor = USB_Descriptor_String_t PROGMEM USART_LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, - + .UnicodeString = {LANGUAGE_ID_ENG} }; @@ -204,7 +204,7 @@ USB_Descriptor_String_t PROGMEM USART_LanguageString = USB_Descriptor_String_t PROGMEM USART_ManufacturerString = { .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String}, - + .UnicodeString = L"Dean Camera" }; @@ -215,7 +215,7 @@ USB_Descriptor_String_t PROGMEM USART_ManufacturerString = USB_Descriptor_String_t PROGMEM USART_ProductString = { .Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String}, - + .UnicodeString = L"LUFA XPLAIN Bridge" }; @@ -234,34 +234,35 @@ uint16_t USART_GetDescriptor(const uint16_t wValue, switch (DescriptorType) { - case DTYPE_Device: + case DTYPE_Device: Address = &USART_DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; - case DTYPE_Configuration: + case DTYPE_Configuration: Address = &USART_ConfigurationDescriptor; Size = sizeof(USART_USB_Descriptor_Configuration_t); break; - case DTYPE_String: + case DTYPE_String: switch (DescriptorNumber) { - case 0x00: + case 0x00: Address = &USART_LanguageString; Size = pgm_read_byte(&USART_LanguageString.Header.Size); break; - case 0x01: + case 0x01: Address = &USART_ManufacturerString; Size = pgm_read_byte(&USART_ManufacturerString.Header.Size); break; - case 0x02: + case 0x02: Address = &USART_ProductString; Size = pgm_read_byte(&USART_ProductString.Header.Size); break; } - + break; } - + *DescriptorAddress = Address; return Size; } + diff --git a/Projects/XPLAINBridge/USARTDescriptors.h b/Projects/XPLAINBridge/USARTDescriptors.h index cac0a987d..0287e81ae 100644 --- a/Projects/XPLAINBridge/USARTDescriptors.h +++ b/Projects/XPLAINBridge/USARTDescriptors.h @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + 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 + 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 + 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 @@ -32,7 +32,7 @@ * * Header file for USARTDescriptors.c. */ - + #ifndef _USART_DESCRIPTORS_H_ #define _USART_DESCRIPTORS_H_ @@ -47,17 +47,17 @@ #define CDC_NOTIFICATION_EPNUM 2 /** Endpoint number of the CDC device-to-host data IN endpoint. */ - #define CDC_TX_EPNUM 3 + #define CDC_TX_EPNUM 3 /** Endpoint number of the CDC host-to-device data OUT endpoint. */ - #define CDC_RX_EPNUM 4 + #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 @@ -82,3 +82,4 @@ const void** const DescriptorAddress); #endif + diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c index 0764bb9a8..24aa383db 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.c +++ b/Projects/XPLAINBridge/XPLAINBridge.c @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + 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 + 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 + 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 @@ -45,7 +45,7 @@ bool CurrentFirmwareMode = MODE_USART_BRIDGE; */ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { - .Config = + .Config = { .ControlInterfaceNumber = 0, @@ -100,7 +100,7 @@ void AVRISP_Task(void) V2Params_UpdateParamValues(); Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM); - + /* Check to see if a V2 Protocol command has been received */ if (Endpoint_IsOUTReceived()) { @@ -123,7 +123,7 @@ void UARTBridge_Task(void) int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); if (!(ReceivedByte < 0) && !(RingBuffer_IsFull(&USBtoUART_Buffer))) RingBuffer_Insert(&USBtoUART_Buffer, ReceivedByte); - + /* Check if the UART receive buffer flush timer has expired or buffer is nearly full */ RingBuff_Count_t BufferCount = RingBuffer_GetCount(&UARTtoUSB_Buffer); if ((TIFR0 & (1 << TOV0)) || (BufferCount > 200)) @@ -185,7 +185,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) /* Initialize ring buffers used to hold serial data between USB and software UART interfaces */ RingBuffer_InitBuffer(&USBtoUART_Buffer); RingBuffer_InitBuffer(&UARTtoUSB_Buffer); - + /* Start the software USART */ SoftUART_Init(); } @@ -198,7 +198,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN, AVRISP_DATA_EPSIZE, ENDPOINT_BANK_SINGLE); #endif - + /* Configure the V2 protocol packet handler */ V2Protocol_Init(); } @@ -257,3 +257,4 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, else return AVRISP_GetDescriptor(wValue, wIndex, DescriptorAddress); } + diff --git a/Projects/XPLAINBridge/XPLAINBridge.h b/Projects/XPLAINBridge/XPLAINBridge.h index 74fa4458d..ac4378dc7 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.h +++ b/Projects/XPLAINBridge/XPLAINBridge.h @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + 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 + 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 + 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 @@ -66,7 +66,7 @@ /** 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 @@ -80,7 +80,7 @@ extern bool CurrentFirmwareMode; extern RingBuff_t UARTtoUSB_Buffer; extern RingBuff_t USBtoUART_Buffer; - + /* Function Prototypes: */ void SetupHardware(void); void AVRISP_Task(void); @@ -89,7 +89,7 @@ void EVENT_USB_Device_ConfigurationChanged(void); void EVENT_USB_Device_UnhandledControlRequest(void); void EVENT_USB_Device_Connect(void); - void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_Disconnect(void); void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); @@ -99,3 +99,4 @@ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); #endif + diff --git a/Projects/XPLAINBridge/XPLAINBridge.txt b/Projects/XPLAINBridge/XPLAINBridge.txt index fe7e739f1..42943101f 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.txt +++ b/Projects/XPLAINBridge/XPLAINBridge.txt @@ -3,7 +3,7 @@ * 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: @@ -27,7 +27,7 @@ * <td>1) Communications Device Class (CDC)</td> * <td>2) Vendor Specific Class</td> * </tr> - * <tr> + * <tr> * <td><b>USB Subclass:</b></td> * <td>1) Abstract Control Model (ACM)</td> * <td>2) N/A</td> @@ -44,7 +44,7 @@ * </tr> * </table> * - * \section SSec_Description Project Description: + * \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 compatible PDI programmer for the XMEGA. @@ -91,3 +91,4 @@ * </tr> * </table> */ + diff --git a/Projects/XPLAINBridge/makefile b/Projects/XPLAINBridge/makefile index 542b928e4..1416f8133 100644 --- a/Projects/XPLAINBridge/makefile +++ b/Projects/XPLAINBridge/makefile @@ -47,7 +47,7 @@ # make doxygen = Generate DoxyGen documentation for the project (must have # DoxyGen installed) # -# make debug = Start either simulavr or avarice as specified for debugging, +# make debug = Start either simulavr or avarice as specified for debugging, # with avr-gdb or avr-insight as the front end for debugging. # # make filename.s = Just compile filename.c into the assembler code only. @@ -64,14 +64,14 @@ MCU = at90usb1287 # Target board (see library "Board Types" documentation, NONE for projects not requiring -# LUFA board drivers). If USER is selected, put custom board drivers in a directory called +# LUFA board drivers). If USER is selected, put custom board drivers in a directory called # "Board" inside the application directory. BOARD = XPLAIN # Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to # calculate timings. Do NOT tack on a 'UL' at the end, this will be done # automatically to create a 32-bit value in your source code. # @@ -84,7 +84,7 @@ F_CPU = 8000000 # Input clock frequency. -# This will define a symbol, F_CLOCK, in all source code files equal to the +# This will define a symbol, F_CLOCK, in all source code files equal to the # input clock frequency (before any prescaling is performed) in Hz. This value may # differ from F_CPU if prescaling is used on the latter, and is required as the # raw input clock is fed directly to the PLL sections of the AVR for high speed @@ -161,7 +161,7 @@ SRC = $(TARGET).c \ # List C++ source files here. (C dependencies are automatically generated.) -CPPSRC = +CPPSRC = # List Assembler source files here. @@ -174,7 +174,7 @@ CPPSRC = ASRC = -# Optimization level, can be [0, 1, 2, 3, s]. +# Optimization level, can be [0, 1, 2, 3, s]. # 0 = turn off optimization. s = optimize for size. # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) OPT = s @@ -288,7 +288,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) # for use in COFF files, additional information about filenames # and function names needs to be present in the assembler source # files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex +# -listing-cont-lines: Sets the maximum number of continuation lines of hex # dump that will be displayed for a given single line of source input. ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 @@ -301,7 +301,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt # If this is left blank, then it will use the Standard printf version. -PRINTF_LIB = +PRINTF_LIB = #PRINTF_LIB = $(PRINTF_LIB_MIN) #PRINTF_LIB = $(PRINTF_LIB_FLOAT) @@ -313,7 +313,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt # If this is left blank, then it will use the Standard scanf version. -SCANF_LIB = +SCANF_LIB = #SCANF_LIB = $(SCANF_LIB_MIN) #SCANF_LIB = $(SCANF_LIB_FLOAT) @@ -325,7 +325,7 @@ MATH_LIB = -lm # Each directory must be seperated by a space. # Use forward slashes for directory separators. # For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = +EXTRALIBDIRS = @@ -348,7 +348,7 @@ EXTMEMOPTS = # -Map: create map file # --cref: add cross reference to map file LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--relax +LDFLAGS += -Wl,--relax LDFLAGS += -Wl,--gc-sections LDFLAGS += $(EXTMEMOPTS) LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) @@ -382,7 +382,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex #AVRDUDE_NO_VERIFY = -V # Increase verbosity level. Please use this when submitting bug -# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> +# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> # to submit bug reports. #AVRDUDE_VERBOSE = -v -v @@ -416,7 +416,7 @@ JTAG_DEV = /dev/com1 DEBUG_PORT = 4242 # Debugging host used to communicate between GDB / avarice / simulavr, normally -# just set to localhost unless doing some sort of crazy debugging when +# just set to localhost unless doing some sort of crazy debugging when # avarice is running on a different computer. DEBUG_HOST = localhost @@ -445,7 +445,7 @@ WINSHELL = cmd MSG_ERRORS_NONE = Errors: none MSG_BEGIN = -------- begin -------- MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: +MSG_SIZE_BEFORE = Size before: MSG_SIZE_AFTER = Size after: MSG_COFF = Converting to AVR COFF: MSG_EXTENDED_COFF = Converting to AVR Extended COFF: @@ -464,10 +464,10 @@ MSG_CREATING_LIBRARY = Creating library: # Define all object files. -OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) +OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) # Define all listing files. -LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) +LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) # Compiler flags to generate dependency files. @@ -532,11 +532,11 @@ sizeafter: # Display compiler version information. -gccversion : +gccversion : @$(CC) --version -# Program the device. +# Program the device. program: $(TARGET).hex $(TARGET).eep $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) @@ -563,9 +563,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep # Generate avr-gdb config/init file which does the following: -# define the reset signal, load the target file, connect to target, and set +# define the reset signal, load the target file, connect to target, and set # a breakpoint at main(). -gdb-config: +gdb-config: @$(REMOVE) $(GDBINIT_FILE) @echo define reset >> $(GDBINIT_FILE) @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) @@ -663,14 +663,14 @@ extcoff: $(TARGET).elf $(OBJDIR)/%.o : %.c @echo @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ + $(CC) -c $(ALL_CFLAGS) $< -o $@ # Compile: create object files from C++ source files. $(OBJDIR)/%.o : %.cpp @echo @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ + $(CC) -c $(ALL_CPPFLAGS) $< -o $@ # Compile: create assembler files from C source files. @@ -692,7 +692,7 @@ $(OBJDIR)/%.o : %.S # Create preprocessed source for use in sending a bug report. %.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ + $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ # Target: clean project. @@ -736,3 +736,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null) build elf hex eep lss sym coff extcoff doxygen clean \ clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ debug gdb-config + |