Squashed 'tmk_core/' changes from caca2c0..dc0e46e
dc0e46e Rename LUFA to LUFA-git
3bfa7fa Remove LUFA-120730
215b764 Merge commit 'afa0f22a9299686fd88f58ce09c5b521ac917e8f' as 'protocol/lufa/LUFA'
afa0f22 Squashed 'protocol/lufa/LUFA/' content from commit def7fca
c0c42fa Remove submodule of LUFA
30f897d Merge commit '87ced33feb74e79c3281dda36eb6d6d153399b41' as 'protocol/usb_hid/USB_Host_Shield_2.0'
87ced33 Squashed 'protocol/usb_hid/USB_Host_Shield_2.0/' content from commit aab4a69
14f6d49 Remove submodule of USB_Host_Shield_2.0
git-subtree-dir: tmk_core
git-subtree-split: dc0e46eaa4367d4e218f8816e3c117895820f07c
			
			
This commit is contained in:
		
							parent
							
								
									4d116a04e9
								
							
						
					
					
						commit
						f6d56675f9
					
				
					 1575 changed files with 421901 additions and 63190 deletions
				
			
		
							
								
								
									
										311
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Benito.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										311
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Benito.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,311 @@ | |||
| /*
 | ||||
|              LUFA Library | ||||
|      Copyright (C) Dean Camera, 2014. | ||||
| 
 | ||||
|   dean [at] fourwalledcubicle [dot] com | ||||
|            www.lufa-lib.org | ||||
| */ | ||||
| 
 | ||||
| /*
 | ||||
|   Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||
| 
 | ||||
|   Permission to use, copy, modify, distribute, and sell this | ||||
|   software and its documentation for any purpose is hereby granted | ||||
|   without fee, provided that the above copyright notice appear in | ||||
|   all copies and that both that the copyright notice and this | ||||
|   permission notice and warranty disclaimer appear in supporting | ||||
|   documentation, and that the name of the author not be used in | ||||
|   advertising or publicity pertaining to distribution of the | ||||
|   software without specific, written prior permission. | ||||
| 
 | ||||
|   The author disclaims all warranties with regard to this | ||||
|   software, including all implied warranties of merchantability | ||||
|   and fitness.  In no event shall the author be liable for any | ||||
|   special, indirect or consequential damages or any damages | ||||
|   whatsoever resulting from loss of use, data or profits, whether | ||||
|   in an action of contract, negligence or other tortious action, | ||||
|   arising out of or in connection with the use or performance of | ||||
|   this software. | ||||
| */ | ||||
| 
 | ||||
| /** \file
 | ||||
|  * | ||||
|  *  Main source file for the Benito project. This file contains the main tasks of | ||||
|  *  the project and is responsible for the initial application hardware configuration. | ||||
|  */ | ||||
| 
 | ||||
| #include "Benito.h" | ||||
| 
 | ||||
| /** Circular buffer to hold data from the serial port before it is sent to the host. */ | ||||
| static RingBuffer_t USARTtoUSB_Buffer; | ||||
| 
 | ||||
| /** Underlying data buffer for \ref USARTtoUSB_Buffer, where the stored bytes are located. */ | ||||
| static uint8_t      USARTtoUSB_Buffer_Data[128]; | ||||
| 
 | ||||
| /** Pulse generation counters to keep track of the number of milliseconds remaining for each pulse type */ | ||||
| volatile struct | ||||
| { | ||||
| 	uint8_t ResetPulse; /**< Milliseconds remaining for target /RESET pulse */ | ||||
| 	uint8_t TxLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */ | ||||
| 	uint8_t RxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */ | ||||
| 	uint8_t PingPongLEDPulse; /**< Milliseconds remaining for enumeration Tx/Rx ping-pong LED pulse */ | ||||
| } PulseMSRemaining; | ||||
| 
 | ||||
| /** Milliseconds remaining until the receive buffer is flushed to the USB host */ | ||||
| uint8_t FlushPeriodRemaining = RECEIVE_BUFFER_FLUSH_MS; | ||||
| 
 | ||||
| /** LUFA CDC Class driver interface configuration and state information. This structure is
 | ||||
|  *  passed to all CDC Class driver functions, so that multiple instances of the same class | ||||
|  *  within a device can be differentiated from one another. | ||||
|  */ | ||||
| USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = | ||||
| 	{ | ||||
| 		.Config = | ||||
| 			{ | ||||
| 				.ControlInterfaceNumber   = INTERFACE_ID_CDC_CCI, | ||||
| 				.DataINEndpoint           = | ||||
| 					{ | ||||
| 						.Address          = CDC_TX_EPADDR, | ||||
| 						.Size             = CDC_TXRX_EPSIZE, | ||||
| 						.Banks            = 1, | ||||
| 					}, | ||||
| 				.DataOUTEndpoint = | ||||
| 					{ | ||||
| 						.Address          = CDC_RX_EPADDR, | ||||
| 						.Size             = CDC_TXRX_EPSIZE, | ||||
| 						.Banks            = 1, | ||||
| 					}, | ||||
| 				.NotificationEndpoint = | ||||
| 					{ | ||||
| 						.Address          = CDC_NOTIFICATION_EPADDR, | ||||
| 						.Size             = CDC_NOTIFICATION_EPSIZE, | ||||
| 						.Banks            = 1, | ||||
| 					}, | ||||
| 			}, | ||||
| 	}; | ||||
| 
 | ||||
| /** 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(); | ||||
| 
 | ||||
| 	RingBuffer_InitBuffer(&USARTtoUSB_Buffer, USARTtoUSB_Buffer_Data, sizeof(USARTtoUSB_Buffer_Data)); | ||||
| 
 | ||||
| 	GlobalInterruptEnable(); | ||||
| 
 | ||||
| 	for (;;) | ||||
| 	{ | ||||
| 		/* Echo bytes from the host to the target via the hardware USART */ | ||||
| 		if ((UCSR1A & (1 << UDRE1)) && CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface)) | ||||
| 		{ | ||||
| 			UDR1 = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); | ||||
| 
 | ||||
| 			LEDs_TurnOnLEDs(LEDMASK_TX); | ||||
| 			PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS; | ||||
| 		} | ||||
| 
 | ||||
| 		/* Check if the millisecond timer has elapsed */ | ||||
| 		if (TIFR0 & (1 << OCF0A)) | ||||
| 		{ | ||||
| 			/* Clear flush timer expiry flag */ | ||||
| 			TIFR0 |= (1 << TOV0); | ||||
| 
 | ||||
| 			/* Check if the reset pulse period has elapsed, if so tristate the target reset line */ | ||||
| 			if (PulseMSRemaining.ResetPulse && !(--PulseMSRemaining.ResetPulse)) | ||||
| 			{ | ||||
| 				LEDs_TurnOffLEDs(LEDMASK_BUSY); | ||||
| 				AVR_RESET_LINE_DDR &= ~AVR_RESET_LINE_MASK; | ||||
| 			} | ||||
| 
 | ||||
| 			/* Check if the LEDs should be ping-ponging (during enumeration) */ | ||||
| 			if (PulseMSRemaining.PingPongLEDPulse && !(--PulseMSRemaining.PingPongLEDPulse)) | ||||
| 			{ | ||||
| 				LEDs_ToggleLEDs(LEDMASK_TX | LEDMASK_RX); | ||||
| 				PulseMSRemaining.PingPongLEDPulse = PING_PONG_LED_PULSE_MS; | ||||
| 			} | ||||
| 
 | ||||
| 			/* Turn off TX LED(s) once the TX pulse period has elapsed */ | ||||
| 			if (PulseMSRemaining.TxLEDPulse && !(--PulseMSRemaining.TxLEDPulse)) | ||||
| 			  LEDs_TurnOffLEDs(LEDMASK_TX); | ||||
| 
 | ||||
| 			/* Turn off RX LED(s) once the RX pulse period has elapsed */ | ||||
| 			if (PulseMSRemaining.RxLEDPulse && !(--PulseMSRemaining.RxLEDPulse)) | ||||
| 			  LEDs_TurnOffLEDs(LEDMASK_RX); | ||||
| 
 | ||||
| 			/* Check if the receive buffer flush period has expired */ | ||||
| 			uint16_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer); | ||||
| 			if (!(--FlushPeriodRemaining) || (BufferCount > 200)) | ||||
| 			{ | ||||
| 				FlushPeriodRemaining = RECEIVE_BUFFER_FLUSH_MS; | ||||
| 
 | ||||
| 				/* Start RX LED indicator pulse */ | ||||
| 				if (BufferCount) | ||||
| 				{ | ||||
| 					LEDs_TurnOnLEDs(LEDMASK_RX); | ||||
| 					PulseMSRemaining.RxLEDPulse = TX_RX_LED_PULSE_MS; | ||||
| 				} | ||||
| 
 | ||||
| 				/* Echo bytes from the target to the host via the virtual serial port */ | ||||
| 				while (BufferCount--) | ||||
| 				{ | ||||
| 					/* Try to send the next byte of data to the host, abort if there is an error without dequeuing */ | ||||
| 					if (CDC_Device_SendByte(&VirtualSerial_CDC_Interface, | ||||
| 											RingBuffer_Peek(&USARTtoUSB_Buffer)) != ENDPOINT_READYWAIT_NoError) | ||||
| 					{ | ||||
| 						break; | ||||
| 					} | ||||
| 
 | ||||
| 					/* Dequeue the already sent byte from the buffer now we have confirmed that no transmission error occurred */ | ||||
| 					RingBuffer_Remove(&USARTtoUSB_Buffer); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		CDC_Device_USBTask(&VirtualSerial_CDC_Interface); | ||||
| 		USB_USBTask(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| /** Configures the board hardware and chip peripherals for the demo's functionality. */ | ||||
| void SetupHardware(void) | ||||
| { | ||||
| #if (ARCH == ARCH_AVR8) | ||||
| 	/* Disable watchdog if enabled by bootloader/fuses */ | ||||
| 	MCUSR &= ~(1 << WDRF); | ||||
| 	wdt_disable(); | ||||
| 
 | ||||
| 	/* Disable clock division */ | ||||
| 	clock_prescale_set(clock_div_1); | ||||
| #endif | ||||
| 
 | ||||
| 	/* Hardware Initialization */ | ||||
| 	LEDs_Init(); | ||||
| 	USB_Init(); | ||||
| 
 | ||||
| 	/* Millisecond Timer Interrupt */ | ||||
| 	OCR0A  = (F_CPU / 64 / 1000); | ||||
| 	TCCR0A = (1 << WGM01); | ||||
| 	TCCR0B = ((1 << CS01) | (1 << CS00)); | ||||
| 
 | ||||
| 	/* Tristate target /RESET Line */ | ||||
| 	AVR_RESET_LINE_PORT &= ~AVR_RESET_LINE_MASK; | ||||
| 	AVR_RESET_LINE_DDR  &= ~AVR_RESET_LINE_MASK; | ||||
| } | ||||
| 
 | ||||
| /** Event handler for the library USB Connection event. */ | ||||
| void EVENT_USB_Device_Connect(void) | ||||
| { | ||||
| 	PulseMSRemaining.PingPongLEDPulse = PING_PONG_LED_PULSE_MS; | ||||
| 	LEDs_SetAllLEDs(LEDMASK_TX); | ||||
| } | ||||
| 
 | ||||
| /** Event handler for the library USB Disconnection event. */ | ||||
| void EVENT_USB_Device_Disconnect(void) | ||||
| { | ||||
| 	PulseMSRemaining.PingPongLEDPulse = 0; | ||||
| 	LEDs_SetAllLEDs(LEDS_NO_LEDS); | ||||
| } | ||||
| 
 | ||||
| /** Event handler for the library USB Configuration Changed event. */ | ||||
| void EVENT_USB_Device_ConfigurationChanged(void) | ||||
| { | ||||
| 	bool ConfigSuccess = true; | ||||
| 
 | ||||
| 	ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); | ||||
| 
 | ||||
| 	PulseMSRemaining.PingPongLEDPulse = 0; | ||||
| 
 | ||||
| 	LEDs_SetAllLEDs(ConfigSuccess ? LEDS_NO_LEDS : LEDMASK_ERROR); | ||||
| } | ||||
| 
 | ||||
| /** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
 | ||||
|  *  the device from the USB host before passing along unhandled control requests to the library for processing | ||||
|  *  internally. | ||||
|  */ | ||||
| void EVENT_USB_Device_ControlRequest(void) | ||||
| { | ||||
| 	CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); | ||||
| } | ||||
| 
 | ||||
| /** Event handler for the CDC Class driver Line Encoding Changed event.
 | ||||
|  * | ||||
|  *  \param[in] CDCInterfaceInfo  Pointer to the CDC class interface configuration structure being referenced | ||||
|  */ | ||||
| void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) | ||||
| { | ||||
| 	uint8_t ConfigMask = 0; | ||||
| 
 | ||||
| 	switch (CDCInterfaceInfo->State.LineEncoding.ParityType) | ||||
| 	{ | ||||
| 		case CDC_PARITY_Odd: | ||||
| 			ConfigMask = ((1 << UPM11) | (1 << UPM10)); | ||||
| 			break; | ||||
| 		case CDC_PARITY_Even: | ||||
| 			ConfigMask = (1 << UPM11); | ||||
| 			break; | ||||
| 	} | ||||
| 
 | ||||
| 	if (CDCInterfaceInfo->State.LineEncoding.CharFormat == CDC_LINEENCODING_TwoStopBits) | ||||
| 	  ConfigMask |= (1 << USBS1); | ||||
| 
 | ||||
| 	switch (CDCInterfaceInfo->State.LineEncoding.DataBits) | ||||
| 	{ | ||||
| 		case 6: | ||||
| 			ConfigMask |= (1 << UCSZ10); | ||||
| 			break; | ||||
| 		case 7: | ||||
| 			ConfigMask |= (1 << UCSZ11); | ||||
| 			break; | ||||
| 		case 8: | ||||
| 			ConfigMask |= ((1 << UCSZ11) | (1 << UCSZ10)); | ||||
| 			break; | ||||
| 	} | ||||
| 
 | ||||
| 	/* Must turn off USART before reconfiguring it, otherwise incorrect operation may occur */ | ||||
| 	UCSR1B = 0; | ||||
| 	UCSR1A = 0; | ||||
| 	UCSR1C = 0; | ||||
| 
 | ||||
| 	/* Set the new baud rate before configuring the USART */ | ||||
| 	UBRR1  = SERIAL_2X_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS); | ||||
| 
 | ||||
| 	/* Reconfigure the USART in double speed mode for a wider baud rate range at the expense of accuracy */ | ||||
| 	UCSR1C = ConfigMask; | ||||
| 	UCSR1A = (1 << U2X1); | ||||
| 	UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1)); | ||||
| } | ||||
| 
 | ||||
| /** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer
 | ||||
|  *  for later transmission to the host. | ||||
|  */ | ||||
| ISR(USART1_RX_vect, ISR_BLOCK) | ||||
| { | ||||
| 	uint8_t ReceivedByte = UDR1; | ||||
| 
 | ||||
| 	if (USB_DeviceState == DEVICE_STATE_Configured) | ||||
| 	  RingBuffer_Insert(&USARTtoUSB_Buffer, ReceivedByte); | ||||
| } | ||||
| 
 | ||||
| /** Event handler for the CDC Class driver Host-to-Device Line Encoding Changed event.
 | ||||
|  * | ||||
|  *  \param[in] CDCInterfaceInfo  Pointer to the CDC class interface configuration structure being referenced | ||||
|  */ | ||||
| void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) | ||||
| { | ||||
| 	static bool PreviousDTRState = false; | ||||
| 	bool        CurrentDTRState  = (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR); | ||||
| 
 | ||||
| 	/* Check if the DTR line has been asserted - if so, start the target AVR's reset pulse */ | ||||
| 	if (!(PreviousDTRState) && CurrentDTRState) | ||||
| 	{ | ||||
| 		LEDs_SetAllLEDs(LEDMASK_BUSY); | ||||
| 
 | ||||
| 		AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK; | ||||
| 		PulseMSRemaining.ResetPulse = AVR_RESET_PULSE_MS; | ||||
| 	} | ||||
| 
 | ||||
| 	PreviousDTRState = CurrentDTRState; | ||||
| } | ||||
| 
 | ||||
							
								
								
									
										79
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Benito.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Benito.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,79 @@ | |||
| /*
 | ||||
|              LUFA Library | ||||
|      Copyright (C) Dean Camera, 2014. | ||||
| 
 | ||||
|   dean [at] fourwalledcubicle [dot] com | ||||
|            www.lufa-lib.org | ||||
| */ | ||||
| 
 | ||||
| /*
 | ||||
|   Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||
| 
 | ||||
|   Permission to use, copy, modify, distribute, and sell this | ||||
|   software and its documentation for any purpose is hereby granted | ||||
|   without fee, provided that the above copyright notice appear in | ||||
|   all copies and that both that the copyright notice and this | ||||
|   permission notice and warranty disclaimer appear in supporting | ||||
|   documentation, and that the name of the author not be used in | ||||
|   advertising or publicity pertaining to distribution of the | ||||
|   software without specific, written prior permission. | ||||
| 
 | ||||
|   The author disclaims all warranties with regard to this | ||||
|   software, including all implied warranties of merchantability | ||||
|   and fitness.  In no event shall the author be liable for any | ||||
|   special, indirect or consequential damages or any damages | ||||
|   whatsoever resulting from loss of use, data or profits, whether | ||||
|   in an action of contract, negligence or other tortious action, | ||||
|   arising out of or in connection with the use or performance of | ||||
|   this software. | ||||
| */ | ||||
| 
 | ||||
| /** \file
 | ||||
|  * | ||||
|  *  Header file for Benito.c. | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _BENITO_H_ | ||||
| #define _BENITO_H_ | ||||
| 
 | ||||
| 	/* Includes: */ | ||||
| 		#include <avr/io.h> | ||||
| 		#include <avr/wdt.h> | ||||
| 		#include <avr/power.h> | ||||
| 		#include <avr/interrupt.h> | ||||
| 
 | ||||
| 		#include "Descriptors.h" | ||||
| 		#include "Config/AppConfig.h" | ||||
| 
 | ||||
| 		#include <LUFA/Drivers/Board/LEDs.h> | ||||
| 		#include <LUFA/Drivers/Peripheral/Serial.h> | ||||
| 		#include <LUFA/Drivers/Misc/RingBuffer.h> | ||||
| 		#include <LUFA/Drivers/USB/USB.h> | ||||
| 		#include <LUFA/Platform/Platform.h> | ||||
| 
 | ||||
| 	/* Macros: */ | ||||
| 		/** LED mask for the library LED driver, to indicate TX activity. */ | ||||
| 		#define LEDMASK_TX               LEDS_LED1 | ||||
| 
 | ||||
| 		/** LED mask for the library LED driver, to indicate RX activity. */ | ||||
| 		#define LEDMASK_RX               LEDS_LED2 | ||||
| 
 | ||||
| 		/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ | ||||
| 		#define LEDMASK_ERROR            (LEDS_LED1 | LEDS_LED2) | ||||
| 
 | ||||
| 		/** LED mask for the library LED driver, to indicate that the USB interface is busy. */ | ||||
| 		#define LEDMASK_BUSY             (LEDS_LED1 | LEDS_LED2) | ||||
| 
 | ||||
| 	/* Function Prototypes: */ | ||||
| 		void SetupHardware(void); | ||||
| 
 | ||||
| 		void EVENT_USB_Device_Connect(void); | ||||
| 		void EVENT_USB_Device_Disconnect(void); | ||||
| 		void EVENT_USB_Device_ConfigurationChanged(void); | ||||
| 		void EVENT_USB_Device_ControlRequest(void); | ||||
| 
 | ||||
| 		void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); | ||||
| 		void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
							
								
								
									
										106
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Benito.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										106
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Benito.txt
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,106 @@ | |||
| /** \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 Benito Arduino Programmer Project | ||||
|  * | ||||
|  *  \section Sec_Compat Project Compatibility: | ||||
|  * | ||||
|  *  The following list indicates what microcontrollers are compatible with this project. | ||||
|  * | ||||
|  *  \li Series 7 USB AVRs (AT90USBxxx7) | ||||
|  *  \li Series 6 USB AVRs (AT90USBxxx6) | ||||
|  *  \li Series 4 USB AVRs (ATMEGAxxU4) | ||||
|  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) | ||||
|  * | ||||
|  *  \section Sec_Info USB Information: | ||||
|  * | ||||
|  *  The following table gives a rundown of the USB utilization of this project. | ||||
|  * | ||||
|  * <table> | ||||
|  *  <tr> | ||||
|  *   <td><b>USB Mode:</b></td> | ||||
|  *   <td>Device</td> | ||||
|  *  </tr> | ||||
|  *  <tr> | ||||
|  *   <td><b>USB Class:</b></td> | ||||
|  *   <td>Communications Device Class (CDC)</td> | ||||
|  *  </tr> | ||||
|  *  <tr> | ||||
|  *   <td><b>USB Subclass:</b></td> | ||||
|  *   <td>Abstract Control Model (ACM)</td> | ||||
|  *  </tr> | ||||
|  *  <tr> | ||||
|  *   <td><b>Relevant Standards:</b></td> | ||||
|  *   <td>USBIF CDC Class Standard \n | ||||
|  *       Arduino Bootloader Specification</td> | ||||
|  *  </tr> | ||||
|  *  <tr> | ||||
|  *   <td><b>Supported USB Speeds:</b></td> | ||||
|  *   <td>Full Speed Mode</td> | ||||
|  *  </tr> | ||||
|  * </table> | ||||
|  * | ||||
|  *  \section Sec_Description Project Description: | ||||
|  * | ||||
|  *  Firmware for a USB AVR powered programmer for Arduino boards using the official Arduino bootloader. This | ||||
|  *  project acts like a regular USB to Serial bridge, except that asserting the DTR line will cause a pulse | ||||
|  *  to appear on a given port pin, to control the target's /RESET pin. | ||||
|  * | ||||
|  *  This is primarily designed to fit the Benito board from www.dorkbotpdx.org, but will suit all USB AVRs. | ||||
|  * | ||||
|  *  After running this project for the first time on a new computer, you will need to supply the .INF file located | ||||
|  *  in this 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. | ||||
|  * | ||||
|  *  \section Sec_Options Project Options | ||||
|  * | ||||
|  *  The following defines can be found in this project, which can control the project behaviour when defined, or changed in value. | ||||
|  * | ||||
|  *  <table> | ||||
|  *   <tr> | ||||
|  *    <th><b>Define Name:</b></th> | ||||
|  *    <th><b>Location:</b></th> | ||||
|  *    <th><b>Description:</b></th> | ||||
|  *   </tr> | ||||
|  *   <tr> | ||||
|  *    <td>AVR_RESET_LINE_PORT</td> | ||||
|  *    <td>AppConfig.h</td> | ||||
|  *    <td>Indicates the PORT register of the pin used to generate the target /RESET line pulse.</td> | ||||
|  *   </tr> | ||||
|  *   <tr> | ||||
|  *    <td>AVR_RESET_LINE_DDR</td> | ||||
|  *    <td>AppConfig.h</td> | ||||
|  *    <td>Indicates the DDR register of the pin used to generate the target /RESET line pulse.</td> | ||||
|  *   </tr> | ||||
|  *   <tr> | ||||
|  *    <td>AVR_RESET_LINE_MASK</td> | ||||
|  *    <td>AppConfig.h</td> | ||||
|  *    <td>Indicates the mask of the pin used to generate the target /RESET line pulse.</td> | ||||
|  *   </tr> | ||||
|  *   <tr> | ||||
|  *    <td>AVR_RESET_PULSE_MS</td> | ||||
|  *    <td>AppConfig.h</td> | ||||
|  *    <td>Pulse length in milliseconds for the target /RESET pulse.</td> | ||||
|  *   </tr> | ||||
|  *   <tr> | ||||
|  *    <td>TX_RX_LED_PULSE_MS</td> | ||||
|  *    <td>AppConfig.h</td> | ||||
|  *    <td>Pulse length in milliseconds for the activity Tx/Rx LEDs.</td> | ||||
|  *   </tr> | ||||
|  *   <tr> | ||||
|  *    <td>PING_PONG_LED_PULSE_MS</td> | ||||
|  *    <td>AppConfig.h</td> | ||||
|  *    <td>Pulse length in milliseconds for the enumeration LED ping-ponging between toggles.</td> | ||||
|  *   </tr> | ||||
|  *   <tr> | ||||
|  *    <td>RECEIVE_BUFFER_FLUSH_MS</td> | ||||
|  *    <td>AppConfig.h</td> | ||||
|  *    <td>Period between flushings of received data buffer to the attached USB host.</td> | ||||
|  *   </tr> | ||||
|  *  </table> | ||||
|  */ | ||||
| 
 | ||||
							
								
								
									
										57
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Config/AppConfig.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Config/AppConfig.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,57 @@ | |||
| /*
 | ||||
|              LUFA Library | ||||
|      Copyright (C) Dean Camera, 2014. | ||||
| 
 | ||||
|   dean [at] fourwalledcubicle [dot] com | ||||
|            www.lufa-lib.org | ||||
| */ | ||||
| 
 | ||||
| /*
 | ||||
|   Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||
| 
 | ||||
|   Permission to use, copy, modify, distribute, and sell this | ||||
|   software and its documentation for any purpose is hereby granted | ||||
|   without fee, provided that the above copyright notice appear in | ||||
|   all copies and that both that the copyright notice and this | ||||
|   permission notice and warranty disclaimer appear in supporting | ||||
|   documentation, and that the name of the author not be used in | ||||
|   advertising or publicity pertaining to distribution of the | ||||
|   software without specific, written prior permission. | ||||
| 
 | ||||
|   The author disclaims all warranties with regard to this | ||||
|   software, including all implied warranties of merchantability | ||||
|   and fitness.  In no event shall the author be liable for any | ||||
|   special, indirect or consequential damages or any damages | ||||
|   whatsoever resulting from loss of use, data or profits, whether | ||||
|   in an action of contract, negligence or other tortious action, | ||||
|   arising out of or in connection with the use or performance of | ||||
|   this software. | ||||
| */ | ||||
| 
 | ||||
| /** \file
 | ||||
|  *  \brief Application Configuration Header File | ||||
|  * | ||||
|  *  This is a header file which is be used to configure some of | ||||
|  *  the application's compile time options, as an alternative to | ||||
|  *  specifying the compile time constants supplied through a | ||||
|  *  makefile or build system. | ||||
|  * | ||||
|  *  For information on what each token does, refer to the | ||||
|  *  \ref Sec_Options section of the application documentation. | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _APP_CONFIG_H_ | ||||
| #define _APP_CONFIG_H_ | ||||
| 
 | ||||
| 	#define AVR_RESET_LINE_PORT            PORTD | ||||
| 	#define AVR_RESET_LINE_DDR             DDRD | ||||
| 	#define AVR_RESET_LINE_MASK            (1 << 4) | ||||
| 
 | ||||
| 	#define AVR_RESET_PULSE_MS             10 | ||||
| 
 | ||||
| 	#define TX_RX_LED_PULSE_MS             30 | ||||
| 	#define PING_PONG_LED_PULSE_MS         100 | ||||
| 
 | ||||
| 	#define RECEIVE_BUFFER_FLUSH_MS        10 | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										93
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Config/LUFAConfig.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Config/LUFAConfig.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,93 @@ | |||
| /*
 | ||||
|              LUFA Library | ||||
|      Copyright (C) Dean Camera, 2014. | ||||
| 
 | ||||
|   dean [at] fourwalledcubicle [dot] com | ||||
|            www.lufa-lib.org | ||||
| */ | ||||
| 
 | ||||
| /*
 | ||||
|   Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||
| 
 | ||||
|   Permission to use, copy, modify, distribute, and sell this | ||||
|   software and its documentation for any purpose is hereby granted | ||||
|   without fee, provided that the above copyright notice appear in | ||||
|   all copies and that both that the copyright notice and this | ||||
|   permission notice and warranty disclaimer appear in supporting | ||||
|   documentation, and that the name of the author not be used in | ||||
|   advertising or publicity pertaining to distribution of the | ||||
|   software without specific, written prior permission. | ||||
| 
 | ||||
|   The author disclaims all warranties with regard to this | ||||
|   software, including all implied warranties of merchantability | ||||
|   and fitness.  In no event shall the author be liable for any | ||||
|   special, indirect or consequential damages or any damages | ||||
|   whatsoever resulting from loss of use, data or profits, whether | ||||
|   in an action of contract, negligence or other tortious action, | ||||
|   arising out of or in connection with the use or performance of | ||||
|   this software. | ||||
| */ | ||||
| 
 | ||||
| /** \file
 | ||||
|  *  \brief LUFA Library Configuration Header File | ||||
|  * | ||||
|  *  This header file is used to configure LUFA's compile time options, | ||||
|  *  as an alternative to the compile time constants supplied through | ||||
|  *  a makefile. | ||||
|  * | ||||
|  *  For information on what each token does, refer to the LUFA | ||||
|  *  manual section "Summary of Compile Tokens". | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _LUFA_CONFIG_H_ | ||||
| #define _LUFA_CONFIG_H_ | ||||
| 
 | ||||
| 	#if (ARCH == ARCH_AVR8) | ||||
| 
 | ||||
| 		/* Non-USB Related Configuration Tokens: */ | ||||
| //		#define DISABLE_TERMINAL_CODES
 | ||||
| 
 | ||||
| 		/* USB Class Driver Related Tokens: */ | ||||
| //		#define HID_HOST_BOOT_PROTOCOL_ONLY
 | ||||
| //		#define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
 | ||||
| //		#define HID_USAGE_STACK_DEPTH            {Insert Value Here}
 | ||||
| //		#define HID_MAX_COLLECTIONS              {Insert Value Here}
 | ||||
| //		#define HID_MAX_REPORTITEMS              {Insert Value Here}
 | ||||
| //		#define HID_MAX_REPORT_IDS               {Insert Value Here}
 | ||||
| //		#define NO_CLASS_DRIVER_AUTOFLUSH
 | ||||
| 
 | ||||
| 		/* General USB Driver Related Tokens: */ | ||||
| 		#define ORDERED_EP_CONFIG | ||||
| 		#define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL) | ||||
| 		#define USB_DEVICE_ONLY | ||||
| //		#define USB_HOST_ONLY
 | ||||
| //		#define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
 | ||||
| //		#define NO_LIMITED_CONTROLLER_CONNECT
 | ||||
| //		#define NO_SOF_EVENTS
 | ||||
| 
 | ||||
| 		/* USB Device Mode Driver Related Tokens: */ | ||||
| //		#define USE_RAM_DESCRIPTORS
 | ||||
| 		#define USE_FLASH_DESCRIPTORS | ||||
| //		#define USE_EEPROM_DESCRIPTORS
 | ||||
| //		#define NO_INTERNAL_SERIAL
 | ||||
| 		#define FIXED_CONTROL_ENDPOINT_SIZE      8 | ||||
| 		#define DEVICE_STATE_AS_GPIOR            0 | ||||
| 		#define FIXED_NUM_CONFIGURATIONS         1 | ||||
| //		#define CONTROL_ONLY_DEVICE
 | ||||
| 		#define INTERRUPT_CONTROL_ENDPOINT | ||||
| //		#define NO_DEVICE_REMOTE_WAKEUP
 | ||||
| //		#define NO_DEVICE_SELF_POWER
 | ||||
| 
 | ||||
| 		/* USB Host Mode Driver Related Tokens: */ | ||||
| //		#define HOST_STATE_AS_GPIOR              {Insert Value Here}
 | ||||
| //		#define USB_HOST_TIMEOUT_MS              {Insert Value Here}
 | ||||
| //		#define HOST_DEVICE_SETTLE_DELAY_MS	     {Insert Value Here}
 | ||||
| //		#define NO_AUTO_VBUS_MANAGEMENT
 | ||||
| //		#define INVERTED_VBUS_ENABLE_LINE
 | ||||
| 
 | ||||
| 	#else | ||||
| 
 | ||||
| 		#error Unsupported architecture for this LUFA configuration file. | ||||
| 
 | ||||
| 	#endif | ||||
| #endif | ||||
							
								
								
									
										244
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Descriptors.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										244
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Descriptors.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,244 @@ | |||
| /*
 | ||||
|              LUFA Library | ||||
|      Copyright (C) Dean Camera, 2014. | ||||
| 
 | ||||
|   dean [at] fourwalledcubicle [dot] com | ||||
|            www.lufa-lib.org | ||||
| */ | ||||
| 
 | ||||
| /*
 | ||||
|   Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||
| 
 | ||||
|   Permission to use, copy, modify, distribute, and sell this | ||||
|   software and its documentation for any purpose is hereby granted | ||||
|   without fee, provided that the above copyright notice appear in | ||||
|   all copies and that both that the copyright notice and this | ||||
|   permission notice and warranty disclaimer appear in supporting | ||||
|   documentation, and that the name of the author not be used in | ||||
|   advertising or publicity pertaining to distribution of the | ||||
|   software without specific, written prior permission. | ||||
| 
 | ||||
|   The author disclaims all warranties with regard to this | ||||
|   software, including all implied warranties of merchantability | ||||
|   and fitness.  In no event shall the author be liable for any | ||||
|   special, indirect or consequential damages or any damages | ||||
|   whatsoever resulting from loss of use, data or profits, whether | ||||
|   in an action of contract, negligence or other tortious action, | ||||
|   arising out of or in connection with the use or performance of | ||||
|   this software. | ||||
| */ | ||||
| 
 | ||||
| /** \file
 | ||||
|  * | ||||
|  *  USB Device Descriptors, for library use when in USB device mode. Descriptors are special | ||||
|  *  computer-readable structures which the host requests upon device enumeration, to determine | ||||
|  *  the device's capabilities and functions. | ||||
|  */ | ||||
| 
 | ||||
| #include "Descriptors.h" | ||||
| 
 | ||||
| /** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
 | ||||
|  *  device characteristics, including the supported USB version, control endpoint size and the | ||||
|  *  number of device configurations. The descriptor is read out by the USB host when the enumeration | ||||
|  *  process begins. | ||||
|  */ | ||||
| const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = | ||||
| { | ||||
| 	.Header                 = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, | ||||
| 
 | ||||
| 	.USBSpecification       = VERSION_BCD(1,1,0), | ||||
| 	.Class                  = CDC_CSCP_CDCClass, | ||||
| 	.SubClass               = CDC_CSCP_NoSpecificSubclass, | ||||
| 	.Protocol               = CDC_CSCP_NoSpecificProtocol, | ||||
| 
 | ||||
| 	.Endpoint0Size          = FIXED_CONTROL_ENDPOINT_SIZE, | ||||
| 
 | ||||
| 	.VendorID               = 0x03EB, | ||||
| 	.ProductID              = 0x2060, | ||||
| 	.ReleaseNumber          = VERSION_BCD(0,0,1), | ||||
| 
 | ||||
| 	.ManufacturerStrIndex   = STRING_ID_Manufacturer, | ||||
| 	.ProductStrIndex        = STRING_ID_Product, | ||||
| 	.SerialNumStrIndex      = USE_INTERNAL_SERIAL, | ||||
| 
 | ||||
| 	.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS | ||||
| }; | ||||
| 
 | ||||
| /** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
 | ||||
|  *  of the device in one of its supported configurations, including information about any device interfaces | ||||
|  *  and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting | ||||
|  *  a configuration so that the host may correctly communicate with the USB device. | ||||
|  */ | ||||
| const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = | ||||
| { | ||||
| 	.Config = | ||||
| 		{ | ||||
| 			.Header                 = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, | ||||
| 
 | ||||
| 			.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), | ||||
| 			.TotalInterfaces        = 2, | ||||
| 
 | ||||
| 			.ConfigurationNumber    = 1, | ||||
| 			.ConfigurationStrIndex  = NO_DESCRIPTOR, | ||||
| 
 | ||||
| 			.ConfigAttributes       = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED), | ||||
| 
 | ||||
| 			.MaxPowerConsumption    = USB_CONFIG_POWER_MA(100) | ||||
| 		}, | ||||
| 
 | ||||
| 	.CDC_CCI_Interface = | ||||
| 		{ | ||||
| 			.Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, | ||||
| 
 | ||||
| 			.InterfaceNumber        = INTERFACE_ID_CDC_CCI, | ||||
| 			.AlternateSetting       = 0, | ||||
| 
 | ||||
| 			.TotalEndpoints         = 1, | ||||
| 
 | ||||
| 			.Class                  = CDC_CSCP_CDCClass, | ||||
| 			.SubClass               = CDC_CSCP_ACMSubclass, | ||||
| 			.Protocol               = CDC_CSCP_ATCommandProtocol, | ||||
| 
 | ||||
| 			.InterfaceStrIndex      = NO_DESCRIPTOR | ||||
| 		}, | ||||
| 
 | ||||
| 	.CDC_Functional_Header = | ||||
| 		{ | ||||
| 			.Header                 = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface}, | ||||
| 			.Subtype                = CDC_DSUBTYPE_CSInterface_Header, | ||||
| 
 | ||||
| 			.CDCSpecification       = VERSION_BCD(1,1,0), | ||||
| 		}, | ||||
| 
 | ||||
| 	.CDC_Functional_ACM = | ||||
| 		{ | ||||
| 			.Header                 = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface}, | ||||
| 			.Subtype                = CDC_DSUBTYPE_CSInterface_ACM, | ||||
| 
 | ||||
| 			.Capabilities           = 0x06, | ||||
| 		}, | ||||
| 
 | ||||
| 	.CDC_Functional_Union = | ||||
| 		{ | ||||
| 			.Header                 = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface}, | ||||
| 			.Subtype                = CDC_DSUBTYPE_CSInterface_Union, | ||||
| 
 | ||||
| 			.MasterInterfaceNumber  = INTERFACE_ID_CDC_CCI, | ||||
| 			.SlaveInterfaceNumber   = INTERFACE_ID_CDC_DCI, | ||||
| 		}, | ||||
| 
 | ||||
| 	.CDC_NotificationEndpoint = | ||||
| 		{ | ||||
| 			.Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, | ||||
| 
 | ||||
| 			.EndpointAddress        = CDC_NOTIFICATION_EPADDR, | ||||
| 			.Attributes             = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), | ||||
| 			.EndpointSize           = CDC_NOTIFICATION_EPSIZE, | ||||
| 			.PollingIntervalMS      = 0xFF | ||||
| 		}, | ||||
| 
 | ||||
| 	.CDC_DCI_Interface = | ||||
| 		{ | ||||
| 			.Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, | ||||
| 
 | ||||
| 			.InterfaceNumber        = INTERFACE_ID_CDC_DCI, | ||||
| 			.AlternateSetting       = 0, | ||||
| 
 | ||||
| 			.TotalEndpoints         = 2, | ||||
| 
 | ||||
| 			.Class                  = CDC_CSCP_CDCDataClass, | ||||
| 			.SubClass               = CDC_CSCP_NoDataSubclass, | ||||
| 			.Protocol               = CDC_CSCP_NoDataProtocol, | ||||
| 
 | ||||
| 			.InterfaceStrIndex      = NO_DESCRIPTOR | ||||
| 		}, | ||||
| 
 | ||||
| 	.CDC_DataOutEndpoint = | ||||
| 		{ | ||||
| 			.Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, | ||||
| 
 | ||||
| 			.EndpointAddress        = CDC_RX_EPADDR, | ||||
| 			.Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), | ||||
| 			.EndpointSize           = CDC_TXRX_EPSIZE, | ||||
| 			.PollingIntervalMS      = 0x05 | ||||
| 		}, | ||||
| 
 | ||||
| 	.CDC_DataInEndpoint = | ||||
| 		{ | ||||
| 			.Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, | ||||
| 
 | ||||
| 			.EndpointAddress        = CDC_TX_EPADDR, | ||||
| 			.Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), | ||||
| 			.EndpointSize           = CDC_TXRX_EPSIZE, | ||||
| 			.PollingIntervalMS      = 0x05 | ||||
| 		} | ||||
| }; | ||||
| 
 | ||||
| /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
 | ||||
|  *  the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate | ||||
|  *  via the language ID table available at USB.org what languages the device supports for its string descriptors. | ||||
|  */ | ||||
| const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG); | ||||
| 
 | ||||
| /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
 | ||||
|  *  form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device | ||||
|  *  Descriptor. | ||||
|  */ | ||||
| const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera"); | ||||
| 
 | ||||
| /** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
 | ||||
|  *  and is read out upon request by the host when the appropriate string ID is requested, listed in the Device | ||||
|  *  Descriptor. | ||||
|  */ | ||||
| const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"Benito Arduino Programmer"); | ||||
| 
 | ||||
| /** 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, | ||||
|                                     const void** const DescriptorAddress) | ||||
| { | ||||
| 	const uint8_t  DescriptorType   = (wValue >> 8); | ||||
| 	const uint8_t  DescriptorNumber = (wValue & 0xFF); | ||||
| 
 | ||||
| 	const void* Address = NULL; | ||||
| 	uint16_t    Size    = NO_DESCRIPTOR; | ||||
| 
 | ||||
| 	switch (DescriptorType) | ||||
| 	{ | ||||
| 		case DTYPE_Device: | ||||
| 			Address = &DeviceDescriptor; | ||||
| 			Size    = sizeof(USB_Descriptor_Device_t); | ||||
| 			break; | ||||
| 		case DTYPE_Configuration: | ||||
| 			Address = &ConfigurationDescriptor; | ||||
| 			Size    = sizeof(USB_Descriptor_Configuration_t); | ||||
| 			break; | ||||
| 		case DTYPE_String: | ||||
| 			switch (DescriptorNumber) | ||||
| 			{ | ||||
| 				case STRING_ID_Language: | ||||
| 					Address = &LanguageString; | ||||
| 					Size    = pgm_read_byte(&LanguageString.Header.Size); | ||||
| 					break; | ||||
| 				case STRING_ID_Manufacturer: | ||||
| 					Address = &ManufacturerString; | ||||
| 					Size    = pgm_read_byte(&ManufacturerString.Header.Size); | ||||
| 					break; | ||||
| 				case STRING_ID_Product: | ||||
| 					Address = &ProductString; | ||||
| 					Size    = pgm_read_byte(&ProductString.Header.Size); | ||||
| 					break; | ||||
| 			} | ||||
| 
 | ||||
| 			break; | ||||
| 	} | ||||
| 
 | ||||
| 	*DescriptorAddress = Address; | ||||
| 	return Size; | ||||
| } | ||||
| 
 | ||||
							
								
								
									
										112
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Descriptors.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								protocol/lufa/LUFA-git/Projects/Benito/Descriptors.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,112 @@ | |||
| /*
 | ||||
|              LUFA Library | ||||
|      Copyright (C) Dean Camera, 2014. | ||||
| 
 | ||||
|   dean [at] fourwalledcubicle [dot] com | ||||
|            www.lufa-lib.org | ||||
| */ | ||||
| 
 | ||||
| /*
 | ||||
|   Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||
| 
 | ||||
|   Permission to use, copy, modify, distribute, and sell this | ||||
|   software and its documentation for any purpose is hereby granted | ||||
|   without fee, provided that the above copyright notice appear in | ||||
|   all copies and that both that the copyright notice and this | ||||
|   permission notice and warranty disclaimer appear in supporting | ||||
|   documentation, and that the name of the author not be used in | ||||
|   advertising or publicity pertaining to distribution of the | ||||
|   software without specific, written prior permission. | ||||
| 
 | ||||
|   The author disclaims all warranties with regard to this | ||||
|   software, including all implied warranties of merchantability | ||||
|   and fitness.  In no event shall the author be liable for any | ||||
|   special, indirect or consequential damages or any damages | ||||
|   whatsoever resulting from loss of use, data or profits, whether | ||||
|   in an action of contract, negligence or other tortious action, | ||||
|   arising out of or in connection with the use or performance of | ||||
|   this software. | ||||
| */ | ||||
| 
 | ||||
| /** \file
 | ||||
|  * | ||||
|  *  Header file for Descriptors.c. | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _DESCRIPTORS_H_ | ||||
| #define _DESCRIPTORS_H_ | ||||
| 
 | ||||
| 	/* Includes: */ | ||||
| 		#include <avr/pgmspace.h> | ||||
| 
 | ||||
| 		#include <LUFA/Drivers/USB/USB.h> | ||||
| 
 | ||||
| 		#include "Config/AppConfig.h" | ||||
| 
 | ||||
| 	/* Macros: */ | ||||
| 		/** Endpoint address of the CDC device-to-host notification IN endpoint. */ | ||||
| 		#define CDC_NOTIFICATION_EPADDR        (ENDPOINT_DIR_IN  | 2) | ||||
| 
 | ||||
| 		/** Endpoint address of the CDC device-to-host data IN endpoint. */ | ||||
| 		#define CDC_TX_EPADDR                  (ENDPOINT_DIR_IN  | 3) | ||||
| 
 | ||||
| 		/** Endpoint address of the CDC host-to-device data OUT endpoint. */ | ||||
| 		#define CDC_RX_EPADDR                  (ENDPOINT_DIR_OUT | 4) | ||||
| 
 | ||||
| 		/** Size in bytes of the CDC device-to-host notification IN endpoint. */ | ||||
| 		#define CDC_NOTIFICATION_EPSIZE        8 | ||||
| 
 | ||||
| 		/** Size in bytes of the CDC data IN and OUT endpoints. */ | ||||
| 		#define CDC_TXRX_EPSIZE                16 | ||||
| 
 | ||||
| 	/* Type Defines: */ | ||||
| 		/** Type define for the device configuration descriptor structure. This must be defined in the
 | ||||
| 		 *  application code, as the configuration descriptor contains several sub-descriptors which | ||||
| 		 *  vary between devices, and which describe the device's usage to the host. | ||||
| 		 */ | ||||
| 		typedef struct | ||||
| 		{ | ||||
| 			USB_Descriptor_Configuration_Header_t    Config; | ||||
| 
 | ||||
| 			// CDC Command Interface
 | ||||
| 			USB_Descriptor_Interface_t               CDC_CCI_Interface; | ||||
| 			USB_CDC_Descriptor_FunctionalHeader_t    CDC_Functional_Header; | ||||
| 			USB_CDC_Descriptor_FunctionalACM_t       CDC_Functional_ACM; | ||||
| 			USB_CDC_Descriptor_FunctionalUnion_t     CDC_Functional_Union; | ||||
| 			USB_Descriptor_Endpoint_t                CDC_NotificationEndpoint; | ||||
| 
 | ||||
| 			// CDC Data Interface
 | ||||
| 			USB_Descriptor_Interface_t               CDC_DCI_Interface; | ||||
| 			USB_Descriptor_Endpoint_t                CDC_DataOutEndpoint; | ||||
| 			USB_Descriptor_Endpoint_t                CDC_DataInEndpoint; | ||||
| 		} USB_Descriptor_Configuration_t; | ||||
| 
 | ||||
| 		/** Enum for the device interface descriptor IDs within the device. Each interface descriptor
 | ||||
| 		 *  should have a unique ID index associated with it, which can be used to refer to the | ||||
| 		 *  interface from other descriptors. | ||||
| 		 */ | ||||
| 		enum InterfaceDescriptors_t | ||||
| 		{ | ||||
| 			INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ | ||||
| 			INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ | ||||
| 		}; | ||||
| 
 | ||||
| 		/** Enum for the device string descriptor IDs within the device. Each string descriptor should
 | ||||
| 		 *  have a unique ID index associated with it, which can be used to refer to the string from | ||||
| 		 *  other descriptors. | ||||
| 		 */ | ||||
| 		enum StringDescriptors_t | ||||
| 		{ | ||||
| 			STRING_ID_Language     = 0, /**< Supported Languages string descriptor ID (must be zero) */ | ||||
| 			STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ | ||||
| 			STRING_ID_Product      = 2, /**< Product string ID */ | ||||
| 		}; | ||||
| 
 | ||||
| 	/* Function Prototypes: */ | ||||
| 		uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, | ||||
| 		                                    const uint8_t wIndex, | ||||
| 		                                    const void** const DescriptorAddress) | ||||
| 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
|  | @ -0,0 +1,66 @@ | |||
| ;************************************************************ | ||||
| ; Windows USB CDC ACM Setup File | ||||
| ; Copyright (c) 2000 Microsoft Corporation | ||||
| ;************************************************************ | ||||
| 
 | ||||
| [DefaultInstall] | ||||
| CopyINF="LUFA Benito Programmer.inf" | ||||
| 
 | ||||
| [Version] | ||||
| Signature="$Windows NT$" | ||||
| Class=Ports | ||||
| ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} | ||||
| Provider=%MFGNAME% | ||||
| DriverVer=7/1/2012,10.0.0.0 | ||||
| 
 | ||||
| [Manufacturer] | ||||
| %MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 | ||||
| 
 | ||||
| [SourceDisksNames] | ||||
| 
 | ||||
| [SourceDisksFiles] | ||||
| 
 | ||||
| [DestinationDirs] | ||||
| DefaultDestDir=12 | ||||
| 
 | ||||
| [DriverInstall] | ||||
| Include=mdmcpq.inf | ||||
| CopyFiles=FakeModemCopyFileSection | ||||
| AddReg=DriverInstall.AddReg | ||||
| 
 | ||||
| [DriverInstall.Services] | ||||
| Include=mdmcpq.inf | ||||
| AddService=usbser, 0x00000002, LowerFilter_Service_Inst | ||||
| 
 | ||||
| [DriverInstall.AddReg] | ||||
| HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider" | ||||
| 
 | ||||
| ;------------------------------------------------------------------------------ | ||||
| ;  Vendor and Product ID Definitions | ||||
| ;------------------------------------------------------------------------------ | ||||
| ; When developing your USB device, the VID and PID used in the PC side | ||||
| ; application program and the firmware on the microcontroller must match. | ||||
| ; Modify the below line to use your VID and PID.  Use the format as shown below. | ||||
| ; Note: One INF file can be used for multiple devices with different VID and PIDs. | ||||
| ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. | ||||
| ;------------------------------------------------------------------------------ | ||||
| [DeviceList] | ||||
| %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2060 | ||||
| 
 | ||||
| [DeviceList.NTx86] | ||||
| %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2060 | ||||
| 
 | ||||
| [DeviceList.NTamd64] | ||||
| %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2060 | ||||
| 
 | ||||
| [DeviceList.NTia64] | ||||
| %DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_2060 | ||||
| 
 | ||||
| ;------------------------------------------------------------------------------ | ||||
| ;  String Definitions | ||||
| ;------------------------------------------------------------------------------ | ||||
| ;Modify these strings to customize your device | ||||
| ;------------------------------------------------------------------------------ | ||||
| [Strings] | ||||
| MFGNAME="http://www.lufa-lib.org" | ||||
| DESCRIPTION="LUFA Benito Programmer" | ||||
							
								
								
									
										53
									
								
								protocol/lufa/LUFA-git/Projects/Benito/asf.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								protocol/lufa/LUFA-git/Projects/Benito/asf.xml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,53 @@ | |||
| <asf xmlversion="1.0"> | ||||
| 	<project caption="Benito Programmer" id="lufa.projects.benito.avr8"> | ||||
| 		<require idref="lufa.projects.benito"/> | ||||
| 		<require idref="lufa.boards.dummy.avr8"/> | ||||
| 		<generator value="as5_8"/> | ||||
| 
 | ||||
| 		<device-support value="at90usb1287"/> | ||||
| 		<config name="lufa.drivers.board.name" value="usbkey"/> | ||||
| 
 | ||||
| 		<build type="define" name="F_CPU" value="8000000UL"/> | ||||
| 		<build type="define" name="F_USB" value="8000000UL"/> | ||||
| 	</project> | ||||
| 
 | ||||
| 	<module type="application" id="lufa.projects.benito" caption="Benito Programmer"> | ||||
| 		<info type="description" value="summary"> | ||||
| 		Benito AVR programmer. | ||||
| 		</info> | ||||
| 
 | ||||
|  		<info type="gui-flag" value="move-to-root"/> | ||||
| 
 | ||||
| 		<info type="keyword" value="Technology"> | ||||
| 			<keyword value="Class Driver APIs"/> | ||||
| 			<keyword value="USB Device"/> | ||||
| 			<keyword value="CDC Class"/> | ||||
| 		</info> | ||||
| 
 | ||||
| 		<device-support-alias value="lufa_avr8"/> | ||||
| 		<device-support-alias value="lufa_xmega"/> | ||||
| 		<device-support-alias value="lufa_uc3"/> | ||||
| 
 | ||||
| 		<build type="distribute" subtype="user-file" value="doxyfile"/> | ||||
| 		<build type="distribute" subtype="user-file" value="Benito.txt"/> | ||||
| 		<build type="distribute" subtype="user-file" value="LUFA Benito Programmer.inf"/> | ||||
| 
 | ||||
| 		<build type="c-source" value="Benito.c"/> | ||||
| 		<build type="c-source" value="Descriptors.c"/> | ||||
| 		<build type="header-file" value="Benito.h"/> | ||||
| 		<build type="header-file" value="Descriptors.h"/> | ||||
| 
 | ||||
| 		<build type="module-config" subtype="path" value="Config"/> | ||||
| 		<build type="module-config" subtype="required-header-file" value="AppConfig.h"/> | ||||
| 		<build type="header-file" value="Config/AppConfig.h"/> | ||||
| 		<build type="header-file" value="Config/LUFAConfig.h"/> | ||||
| 
 | ||||
| 		<require idref="lufa.common"/> | ||||
| 		<require idref="lufa.platform"/> | ||||
| 		<require idref="lufa.drivers.usb"/> | ||||
| 		<require idref="lufa.drivers.peripheral.usart"/> | ||||
| 		<require idref="lufa.drivers.misc.ringbuffer"/> | ||||
| 		<require idref="lufa.drivers.board"/> | ||||
| 		<require idref="lufa.drivers.board.leds"/> | ||||
| 	</module> | ||||
| </asf> | ||||
							
								
								
									
										2364
									
								
								protocol/lufa/LUFA-git/Projects/Benito/doxyfile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2364
									
								
								protocol/lufa/LUFA-git/Projects/Benito/doxyfile
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										38
									
								
								protocol/lufa/LUFA-git/Projects/Benito/makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								protocol/lufa/LUFA-git/Projects/Benito/makefile
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | |||
| #
 | ||||
| #             LUFA Library
 | ||||
| #     Copyright (C) Dean Camera, 2014.
 | ||||
| #
 | ||||
| #  dean [at] fourwalledcubicle [dot] com
 | ||||
| #           www.lufa-lib.org
 | ||||
| #
 | ||||
| # --------------------------------------
 | ||||
| #         LUFA Project Makefile.
 | ||||
| # --------------------------------------
 | ||||
| 
 | ||||
| # Run "make help" for target help.
 | ||||
| 
 | ||||
| MCU          = atmega32u2 | ||||
| ARCH         = AVR8 | ||||
| BOARD        = BENITO | ||||
| F_CPU        = 8000000 | ||||
| F_USB        = $(F_CPU) | ||||
| OPTIMIZATION = s | ||||
| TARGET       = Benito | ||||
| SRC          = $(TARGET).c Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) | ||||
| LUFA_PATH    = ../../LUFA | ||||
| CC_FLAGS     = -DUSE_LUFA_CONFIG_HEADER -IConfig/ | ||||
| LD_FLAGS     = | ||||
| 
 | ||||
| # Default target
 | ||||
| all: | ||||
| 
 | ||||
| # Include LUFA build script makefiles
 | ||||
| include $(LUFA_PATH)/Build/lufa_core.mk | ||||
| include $(LUFA_PATH)/Build/lufa_sources.mk | ||||
| include $(LUFA_PATH)/Build/lufa_build.mk | ||||
| include $(LUFA_PATH)/Build/lufa_cppcheck.mk | ||||
| include $(LUFA_PATH)/Build/lufa_doxygen.mk | ||||
| include $(LUFA_PATH)/Build/lufa_dfu.mk | ||||
| include $(LUFA_PATH)/Build/lufa_hid.mk | ||||
| include $(LUFA_PATH)/Build/lufa_avrdude.mk | ||||
| include $(LUFA_PATH)/Build/lufa_atprogram.mk | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tmk
						tmk