forked from mfulz_github/qmk_firmware
		
	Added new incomplete AudioInputHost Host LowLevel demo.
Added missing Audio class control request definitions. Added support for the Audio class GET STATUS request so that it is correctly ACKed when sent by the host.
This commit is contained in:
		
							parent
							
								
									cc9b190919
								
							
						
					
					
						commit
						ea922c98d1
					
				@ -143,6 +143,15 @@ void EVENT_USB_Device_ControlRequest(void)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			break;
 | 
			
		||||
		case AUDIO_REQ_GetStatus:
 | 
			
		||||
			/* Get Status request can be directed at either the interface or endpoint, neither is currently used
 | 
			
		||||
			 * according to the latest USB Audio 1.0 standard, but must be ACKed with no data when requested */
 | 
			
		||||
			if ((USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) ||
 | 
			
		||||
			    (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT)))
 | 
			
		||||
			{
 | 
			
		||||
				Endpoint_ClearSETUP();
 | 
			
		||||
				Endpoint_ClearStatusStage();
 | 
			
		||||
			}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -169,6 +169,15 @@ void EVENT_USB_Device_ControlRequest(void)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			break;
 | 
			
		||||
		case AUDIO_REQ_GetStatus:
 | 
			
		||||
			/* Get Status request can be directed at either the interface or endpoint, neither is currently used
 | 
			
		||||
			 * according to the latest USB Audio 1.0 standard, but must be ACKed with no data when requested */
 | 
			
		||||
			if ((USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) ||
 | 
			
		||||
			    (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT)))
 | 
			
		||||
			{
 | 
			
		||||
				Endpoint_ClearSETUP();
 | 
			
		||||
				Endpoint_ClearStatusStage();
 | 
			
		||||
			}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										274
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										274
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,274 @@
 | 
			
		||||
/*
 | 
			
		||||
             LUFA Library
 | 
			
		||||
     Copyright (C) Dean Camera, 2011.
 | 
			
		||||
 | 
			
		||||
  dean [at] fourwalledcubicle [dot] com
 | 
			
		||||
           www.lufa-lib.org
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 | 
			
		||||
 | 
			
		||||
  Permission to use, copy, modify, distribute, and sell this
 | 
			
		||||
  software and its documentation for any purpose is hereby granted
 | 
			
		||||
  without fee, provided that the above copyright notice appear in
 | 
			
		||||
  all copies and that both that the copyright notice and this
 | 
			
		||||
  permission notice and warranty disclaimer appear in supporting
 | 
			
		||||
  documentation, and that the name of the author not be used in
 | 
			
		||||
  advertising or publicity pertaining to distribution of the
 | 
			
		||||
  software without specific, written prior permission.
 | 
			
		||||
 | 
			
		||||
  The author disclaim all warranties with regard to this
 | 
			
		||||
  software, including all implied warranties of merchantability
 | 
			
		||||
  and fitness.  In no event shall the author be liable for any
 | 
			
		||||
  special, indirect or consequential damages or any damages
 | 
			
		||||
  whatsoever resulting from loss of use, data or profits, whether
 | 
			
		||||
  in an action of contract, negligence or other tortious action,
 | 
			
		||||
  arising out of or in connection with the use or performance of
 | 
			
		||||
  this software.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/** \file
 | 
			
		||||
 *
 | 
			
		||||
 *  Main source file for the AudioInputHost demo. This file contains the main tasks of
 | 
			
		||||
 *  the demo and is responsible for the initial application hardware configuration.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "AudioInputHost.h"
 | 
			
		||||
 | 
			
		||||
/** Main program entry point. This routine configures the hardware required by the application, then
 | 
			
		||||
 *  enters a loop to run the application tasks in sequence.
 | 
			
		||||
 */
 | 
			
		||||
int main(void)
 | 
			
		||||
{
 | 
			
		||||
	SetupHardware();
 | 
			
		||||
 | 
			
		||||
	puts_P(PSTR(ESC_FG_CYAN "Audio Host Demo running.\r\n" ESC_FG_WHITE));
 | 
			
		||||
 | 
			
		||||
	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
 | 
			
		||||
	sei();
 | 
			
		||||
 | 
			
		||||
	for (;;)
 | 
			
		||||
	{
 | 
			
		||||
		Audio_Task();
 | 
			
		||||
		USB_USBTask();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Configures the board hardware and chip peripherals for the demo's functionality. */
 | 
			
		||||
void SetupHardware(void)
 | 
			
		||||
{
 | 
			
		||||
	/* Disable watchdog if enabled by bootloader/fuses */
 | 
			
		||||
	MCUSR &= ~(1 << WDRF);
 | 
			
		||||
	wdt_disable();
 | 
			
		||||
 | 
			
		||||
	/* Disable clock division */
 | 
			
		||||
	clock_prescale_set(clock_div_1);
 | 
			
		||||
 | 
			
		||||
	/* Hardware Initialization */
 | 
			
		||||
	Serial_Init(9600, false);
 | 
			
		||||
	LEDs_Init();
 | 
			
		||||
	USB_Init();
 | 
			
		||||
 | 
			
		||||
	/* Create a stdio stream for the serial port for stdin and stdout */
 | 
			
		||||
	Serial_CreateStream(NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
 | 
			
		||||
 *  starts the library USB task to begin the enumeration and USB management process.
 | 
			
		||||
 */
 | 
			
		||||
void EVENT_USB_Host_DeviceAttached(void)
 | 
			
		||||
{
 | 
			
		||||
	puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
 | 
			
		||||
	LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
 | 
			
		||||
 *  stops the library USB task management process.
 | 
			
		||||
 */
 | 
			
		||||
void EVENT_USB_Host_DeviceUnattached(void)
 | 
			
		||||
{
 | 
			
		||||
	puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE));
 | 
			
		||||
	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
 | 
			
		||||
 *  enumerated by the host and is now ready to be used by the application.
 | 
			
		||||
 */
 | 
			
		||||
void EVENT_USB_Host_DeviceEnumerationComplete(void)
 | 
			
		||||
{
 | 
			
		||||
	LEDs_SetAllLEDs(LEDMASK_USB_READY);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
 | 
			
		||||
void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
 | 
			
		||||
{
 | 
			
		||||
	USB_Disable();
 | 
			
		||||
 | 
			
		||||
	printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"
 | 
			
		||||
	                         " -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);
 | 
			
		||||
 | 
			
		||||
	LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
 | 
			
		||||
	for(;;);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
 | 
			
		||||
 *  enumerating an attached USB device.
 | 
			
		||||
 */
 | 
			
		||||
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
 | 
			
		||||
                                            const uint8_t SubErrorCode)
 | 
			
		||||
{
 | 
			
		||||
	printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"
 | 
			
		||||
	                         " -- Error Code %d\r\n"
 | 
			
		||||
	                         " -- Sub Error Code %d\r\n"
 | 
			
		||||
	                         " -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
 | 
			
		||||
 | 
			
		||||
	LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Audio_Task(void)
 | 
			
		||||
{
 | 
			
		||||
	uint8_t ErrorCode;
 | 
			
		||||
 | 
			
		||||
	switch (USB_HostState)
 | 
			
		||||
	{
 | 
			
		||||
		case HOST_STATE_Addressed:
 | 
			
		||||
			puts_P(PSTR("Getting Config Data.\r\n"));
 | 
			
		||||
 | 
			
		||||
			/* Get and process the configuration descriptor data */
 | 
			
		||||
			if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
 | 
			
		||||
			{
 | 
			
		||||
				if (ErrorCode == ControlError)
 | 
			
		||||
				  puts_P(PSTR(ESC_FG_RED "Control Error (Get Configuration).\r\n"));
 | 
			
		||||
				else
 | 
			
		||||
				  puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
 | 
			
		||||
 | 
			
		||||
				printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
 | 
			
		||||
 | 
			
		||||
				/* Indicate error status */
 | 
			
		||||
				LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
 | 
			
		||||
 | 
			
		||||
				/* Wait until USB device disconnected */
 | 
			
		||||
				USB_HostState = HOST_STATE_WaitForDeviceRemoval;
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
 | 
			
		||||
			if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
 | 
			
		||||
			{
 | 
			
		||||
				printf_P(PSTR(ESC_FG_RED "Control Error (Set Configuration).\r\n"
 | 
			
		||||
				                         " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
 | 
			
		||||
 | 
			
		||||
				/* Indicate error status */
 | 
			
		||||
				LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
 | 
			
		||||
 | 
			
		||||
				/* Wait until USB device disconnected */
 | 
			
		||||
				USB_HostState = HOST_STATE_WaitForDeviceRemoval;
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			if ((ErrorCode = USB_Host_SetInterfaceAltSetting(StreamingInterfaceIndex,
 | 
			
		||||
			                                                 StreamingInterfaceAltSetting)) != HOST_SENDCONTROL_Successful)
 | 
			
		||||
			{
 | 
			
		||||
				printf_P(PSTR(ESC_FG_RED "Could not set alternative streaming interface setting.\r\n"
 | 
			
		||||
				                         " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
 | 
			
		||||
 | 
			
		||||
				/* Indicate error status */
 | 
			
		||||
				LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
 | 
			
		||||
 | 
			
		||||
				/* Wait until USB device disconnected */
 | 
			
		||||
				USB_HostState = HOST_STATE_WaitForDeviceRemoval;
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			USB_ControlRequest = (USB_Request_Header_t)
 | 
			
		||||
				{
 | 
			
		||||
					.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT),
 | 
			
		||||
					.bRequest      = AUDIO_REQ_SetCurrent,
 | 
			
		||||
					.wValue        = 0x0100,
 | 
			
		||||
					.wIndex        = StreamingEndpointAddress,
 | 
			
		||||
					.wLength       = sizeof(USB_Audio_SampleFreq_t),
 | 
			
		||||
				};
 | 
			
		||||
				
 | 
			
		||||
			USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000);
 | 
			
		||||
 | 
			
		||||
			/* Select the control pipe for the request transfer */
 | 
			
		||||
			Pipe_SelectPipe(PIPE_CONTROLPIPE);
 | 
			
		||||
 | 
			
		||||
			/* Set the sample rate on the streaming interface endpoint */
 | 
			
		||||
			if ((ErrorCode = USB_Host_SendControlRequest(&SampleRate)) != HOST_SENDCONTROL_Successful)
 | 
			
		||||
			{
 | 
			
		||||
				/* Indicate error status */
 | 
			
		||||
				LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
 | 
			
		||||
 | 
			
		||||
				/* Wait until USB device disconnected */
 | 
			
		||||
				USB_HostState = HOST_STATE_WaitForDeviceRemoval;
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
	
 | 
			
		||||
			/* Sample reload timer initialization */
 | 
			
		||||
			TIMSK0  = (1 << OCIE0A);
 | 
			
		||||
			OCR0A   = ((F_CPU / 8 / 8000) - 1);
 | 
			
		||||
			TCCR0A  = (1 << WGM01);  // CTC mode
 | 
			
		||||
			TCCR0B  = (1 << CS01);   // Fcpu/8 speed	
 | 
			
		||||
 | 
			
		||||
			/* Set speaker as output */
 | 
			
		||||
			DDRC   |= (1 << 6);
 | 
			
		||||
 | 
			
		||||
			/* PWM speaker timer initialization */
 | 
			
		||||
			TCCR3A  = ((1 << WGM30) | (1 << COM3A1) | (1 << COM3A0)
 | 
			
		||||
					| (1 << COM3B1) | (1 << COM3B0)); // Set on match, clear on TOP
 | 
			
		||||
			TCCR3B  = ((1 << WGM32) | (1 << CS30));  // Fast 8-Bit PWM, F_CPU speed
 | 
			
		||||
			
 | 
			
		||||
			puts_P(PSTR("Microphone Enumerated.\r\n"));
 | 
			
		||||
 | 
			
		||||
			USB_HostState = HOST_STATE_Configured;
 | 
			
		||||
			break;
 | 
			
		||||
		case HOST_STATE_Configured:
 | 
			
		||||
			break;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** ISR to handle the reloading of the PWM timer with the next sample. */
 | 
			
		||||
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
 | 
			
		||||
{
 | 
			
		||||
	uint8_t PrevPipe = Pipe_GetCurrentPipe();
 | 
			
		||||
 | 
			
		||||
	Pipe_SelectPipe(AUDIO_DATA_IN_PIPE);
 | 
			
		||||
	Pipe_Unfreeze();
 | 
			
		||||
 | 
			
		||||
	/* Check if the current pipe can be read from (contains a packet) and the device is sending data */
 | 
			
		||||
	if (Pipe_IsINReceived())
 | 
			
		||||
	{
 | 
			
		||||
		/* Retrieve the signed 16-bit audio sample, convert to 8-bit */
 | 
			
		||||
		int8_t Sample_8Bit = (Pipe_Read_16_LE() >> 8);
 | 
			
		||||
 | 
			
		||||
		/* Check to see if the bank is now empty */
 | 
			
		||||
		if (!(Pipe_IsReadWriteAllowed()))
 | 
			
		||||
		{
 | 
			
		||||
			/* Acknowledge the packet, clear the bank ready for the next packet */
 | 
			
		||||
			Pipe_ClearIN();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* Load the sample into the PWM timer channel */
 | 
			
		||||
		OCR3A = (Sample_8Bit ^ (1 << 7));
 | 
			
		||||
 | 
			
		||||
		uint8_t LEDMask = LEDS_NO_LEDS;
 | 
			
		||||
 | 
			
		||||
		/* Turn on LEDs as the sample amplitude increases */
 | 
			
		||||
		if (Sample_8Bit > 16)
 | 
			
		||||
		  LEDMask = (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4);
 | 
			
		||||
		else if (Sample_8Bit > 8)
 | 
			
		||||
		  LEDMask = (LEDS_LED1 | LEDS_LED2 | LEDS_LED3);
 | 
			
		||||
		else if (Sample_8Bit > 4)
 | 
			
		||||
		  LEDMask = (LEDS_LED1 | LEDS_LED2);
 | 
			
		||||
		else if (Sample_8Bit > 2)
 | 
			
		||||
		  LEDMask = (LEDS_LED1);
 | 
			
		||||
 | 
			
		||||
		LEDs_SetAllLEDs(LEDMask);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	Pipe_Freeze();
 | 
			
		||||
 | 
			
		||||
	Pipe_SelectPipe(PrevPipe);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.eep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.eep
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.elf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.elf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										80
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,80 @@
 | 
			
		||||
/*
 | 
			
		||||
             LUFA Library
 | 
			
		||||
     Copyright (C) Dean Camera, 2011.
 | 
			
		||||
 | 
			
		||||
  dean [at] fourwalledcubicle [dot] com
 | 
			
		||||
           www.lufa-lib.org
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 | 
			
		||||
 | 
			
		||||
  Permission to use, copy, modify, distribute, and sell this
 | 
			
		||||
  software and its documentation for any purpose is hereby granted
 | 
			
		||||
  without fee, provided that the above copyright notice appear in
 | 
			
		||||
  all copies and that both that the copyright notice and this
 | 
			
		||||
  permission notice and warranty disclaimer appear in supporting
 | 
			
		||||
  documentation, and that the name of the author not be used in
 | 
			
		||||
  advertising or publicity pertaining to distribution of the
 | 
			
		||||
  software without specific, written prior permission.
 | 
			
		||||
 | 
			
		||||
  The author disclaim all warranties with regard to this
 | 
			
		||||
  software, including all implied warranties of merchantability
 | 
			
		||||
  and fitness.  In no event shall the author be liable for any
 | 
			
		||||
  special, indirect or consequential damages or any damages
 | 
			
		||||
  whatsoever resulting from loss of use, data or profits, whether
 | 
			
		||||
  in an action of contract, negligence or other tortious action,
 | 
			
		||||
  arising out of or in connection with the use or performance of
 | 
			
		||||
  this software.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/** \file
 | 
			
		||||
 *
 | 
			
		||||
 *  Header file for AudioHost.c.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _AUDIO_HOST_H_
 | 
			
		||||
#define _AUDIO_HOST_H_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <avr/wdt.h>
 | 
			
		||||
		#include <avr/pgmspace.h>
 | 
			
		||||
		#include <avr/power.h>
 | 
			
		||||
		#include <avr/interrupt.h>
 | 
			
		||||
		#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
		#include <LUFA/Version.h>
 | 
			
		||||
		#include <LUFA/Drivers/Misc/TerminalCodes.h>
 | 
			
		||||
		#include <LUFA/Drivers/USB/USB.h>
 | 
			
		||||
		#include <LUFA/Drivers/Peripheral/Serial.h>
 | 
			
		||||
		#include <LUFA/Drivers/Board/LEDs.h>
 | 
			
		||||
 | 
			
		||||
		#include "ConfigDescriptor.h"
 | 
			
		||||
 | 
			
		||||
	/* Macros: */
 | 
			
		||||
		/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
 | 
			
		||||
		#define LEDMASK_USB_NOTREADY      LEDS_LED1
 | 
			
		||||
 | 
			
		||||
		/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
 | 
			
		||||
		#define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)
 | 
			
		||||
 | 
			
		||||
		/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
 | 
			
		||||
		#define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)
 | 
			
		||||
 | 
			
		||||
		/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
 | 
			
		||||
		#define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)
 | 
			
		||||
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
		void Audio_Task(void);
 | 
			
		||||
		void SetupHardware(void);
 | 
			
		||||
 | 
			
		||||
		void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
 | 
			
		||||
		void EVENT_USB_Host_DeviceAttached(void);
 | 
			
		||||
		void EVENT_USB_Host_DeviceUnattached(void);
 | 
			
		||||
		void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
 | 
			
		||||
		                                            const uint8_t SubErrorCode);
 | 
			
		||||
		void EVENT_USB_Host_DeviceEnumerationComplete(void);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.hex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.hex
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										5024
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.lss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5024
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.lss
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										853
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.lst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										853
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.lst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,853 @@
 | 
			
		||||
   1               		.file	"AudioInputHost.c"
 | 
			
		||||
   2               	__SREG__ = 0x3f
 | 
			
		||||
   3               	__SP_H__ = 0x3e
 | 
			
		||||
   4               	__SP_L__ = 0x3d
 | 
			
		||||
   5               	__CCP__ = 0x34
 | 
			
		||||
   6               	__tmp_reg__ = 0
 | 
			
		||||
   7               	__zero_reg__ = 1
 | 
			
		||||
  15               	.Ltext0:
 | 
			
		||||
  16               		.section	.text.LEDs_SetAllLEDs,"ax",@progbits
 | 
			
		||||
  18               	LEDs_SetAllLEDs:
 | 
			
		||||
  19               	.LFB127:
 | 
			
		||||
  20               	.LSM0:
 | 
			
		||||
  21               	.LVL0:
 | 
			
		||||
  22               	/* prologue: function */
 | 
			
		||||
  23               	/* frame size = 0 */
 | 
			
		||||
  24               	/* stack size = 0 */
 | 
			
		||||
  25               	.L__stack_usage = 0
 | 
			
		||||
  26               	.LSM1:
 | 
			
		||||
  27 0000 9BB1      		in r25,43-32
 | 
			
		||||
  28 0002 9F70      		andi r25,lo8(15)
 | 
			
		||||
  29 0004 982B      		or r25,r24
 | 
			
		||||
  30 0006 9BB9      		out 43-32,r25
 | 
			
		||||
  31               	/* epilogue start */
 | 
			
		||||
  32               	.LSM2:
 | 
			
		||||
  33 0008 0895      		ret
 | 
			
		||||
  34               	.LFE127:
 | 
			
		||||
  36               		.section	.text.SetupHardware,"ax",@progbits
 | 
			
		||||
  37               	.global	SetupHardware
 | 
			
		||||
  39               	SetupHardware:
 | 
			
		||||
  40               	.LFB132:
 | 
			
		||||
  41               	.LSM3:
 | 
			
		||||
  42               	/* prologue: function */
 | 
			
		||||
  43               	/* frame size = 0 */
 | 
			
		||||
  44               	/* stack size = 0 */
 | 
			
		||||
  45               	.L__stack_usage = 0
 | 
			
		||||
  46               	.LSM4:
 | 
			
		||||
  47 0000 84B7      		in r24,84-32
 | 
			
		||||
  48 0002 877F      		andi r24,lo8(-9)
 | 
			
		||||
  49 0004 84BF      		out 84-32,r24
 | 
			
		||||
  50               	.LSM5:
 | 
			
		||||
  51 0006 28E1      		ldi r18,lo8(24)
 | 
			
		||||
  52               	/* #APP */
 | 
			
		||||
  53               	 ;  63 "AudioInputHost.c" 1
 | 
			
		||||
  54 0008 0FB6      		in __tmp_reg__, __SREG__
 | 
			
		||||
  55 000a F894      		cli
 | 
			
		||||
  56 000c 2093 6000 		sts 96, r18
 | 
			
		||||
  57 0010 1092 6000 		sts 96, __zero_reg__
 | 
			
		||||
  58 0014 0FBE      		out __SREG__,__tmp_reg__
 | 
			
		||||
  59               		
 | 
			
		||||
  60               	 ;  0 "" 2
 | 
			
		||||
  61               	.LVL1:
 | 
			
		||||
  62               	/* #NOAPP */
 | 
			
		||||
  63               	.LBB39:
 | 
			
		||||
  64               	.LBB40:
 | 
			
		||||
  65               	.LSM6:
 | 
			
		||||
  66 0016 90E0      		ldi r25,lo8(0)
 | 
			
		||||
  67 0018 80E8      		ldi r24,lo8(-128)
 | 
			
		||||
  68               	/* #APP */
 | 
			
		||||
  69               	 ;  1614 "c:\program files (x86)\atmel\avr studio 5.0\extensions\application\avr toolchain\bin\../l
 | 
			
		||||
  70 001a 0FB6      		in __tmp_reg__,__SREG__
 | 
			
		||||
  71 001c F894      		cli
 | 
			
		||||
  72 001e 8093 6100 		sts 97, r24
 | 
			
		||||
  73 0022 9093 6100 		sts 97, r25
 | 
			
		||||
  74 0026 0FBE      		out __SREG__, __tmp_reg__
 | 
			
		||||
  75               	 ;  0 "" 2
 | 
			
		||||
  76               	.LVL2:
 | 
			
		||||
  77               	/* #NOAPP */
 | 
			
		||||
  78               	.LBE40:
 | 
			
		||||
  79               	.LBE39:
 | 
			
		||||
  80               	.LBB41:
 | 
			
		||||
  81               	.LBB42:
 | 
			
		||||
  82               	.LSM7:
 | 
			
		||||
  83 0028 83E3      		ldi r24,lo8(51)
 | 
			
		||||
  84 002a 90E0      		ldi r25,hi8(51)
 | 
			
		||||
  85 002c 9093 CD00 		sts 204+1,r25
 | 
			
		||||
  86 0030 8093 CC00 		sts 204,r24
 | 
			
		||||
  87               	.LSM8:
 | 
			
		||||
  88 0034 86E0      		ldi r24,lo8(6)
 | 
			
		||||
  89 0036 8093 CA00 		sts 202,r24
 | 
			
		||||
  90               	.LSM9:
 | 
			
		||||
  91 003a 1092 C800 		sts 200,__zero_reg__
 | 
			
		||||
  92               	.LSM10:
 | 
			
		||||
  93 003e 2093 C900 		sts 201,r18
 | 
			
		||||
  94               	.LSM11:
 | 
			
		||||
  95 0042 539A      		sbi 42-32,3
 | 
			
		||||
  96               	.LSM12:
 | 
			
		||||
  97 0044 5A9A      		sbi 43-32,2
 | 
			
		||||
  98               	.LBE42:
 | 
			
		||||
  99               	.LBE41:
 | 
			
		||||
 100               	.LBB43:
 | 
			
		||||
 101               	.LBB44:
 | 
			
		||||
 102               	.LSM13:
 | 
			
		||||
 103 0046 8AB1      		in r24,42-32
 | 
			
		||||
 104 0048 806F      		ori r24,lo8(-16)
 | 
			
		||||
 105 004a 8AB9      		out 42-32,r24
 | 
			
		||||
 106               	.LSM14:
 | 
			
		||||
 107 004c 8BB1      		in r24,43-32
 | 
			
		||||
 108 004e 8F70      		andi r24,lo8(15)
 | 
			
		||||
 109 0050 8BB9      		out 43-32,r24
 | 
			
		||||
 110               	.LBE44:
 | 
			
		||||
 111               	.LBE43:
 | 
			
		||||
 112               	.LSM15:
 | 
			
		||||
 113 0052 0E94 0000 		call USB_Init
 | 
			
		||||
 114               	.LVL3:
 | 
			
		||||
 115               	.LBB45:
 | 
			
		||||
 116               	.LBB46:
 | 
			
		||||
 117               	.LSM16:
 | 
			
		||||
 118 0056 E0E0      		ldi r30,lo8(USARTSerialStream)
 | 
			
		||||
 119 0058 F0E0      		ldi r31,hi8(USARTSerialStream)
 | 
			
		||||
 120 005a F093 0000 		sts __iob+1,r31
 | 
			
		||||
 121 005e E093 0000 		sts __iob,r30
 | 
			
		||||
 122               	.LSM17:
 | 
			
		||||
 123 0062 F093 0000 		sts __iob+2+1,r31
 | 
			
		||||
 124 0066 E093 0000 		sts __iob+2,r30
 | 
			
		||||
 125               	.LSM18:
 | 
			
		||||
 126 006a 8EE0      		ldi r24,lo8(14)
 | 
			
		||||
 127 006c DF01      		movw r26,r30
 | 
			
		||||
 128 006e 1D92      		st X+,__zero_reg__
 | 
			
		||||
 129 0070 8A95      	        dec r24
 | 
			
		||||
 130 0072 01F4      		brne .-6
 | 
			
		||||
 131 0074 83E0      		ldi r24,lo8(3)
 | 
			
		||||
 132 0076 8093 0000 		sts USARTSerialStream+3,r24
 | 
			
		||||
 133 007a 80E0      		ldi r24,lo8(gs(Serial_putchar))
 | 
			
		||||
 134 007c 90E0      		ldi r25,hi8(gs(Serial_putchar))
 | 
			
		||||
 135 007e 9093 0000 		sts USARTSerialStream+8+1,r25
 | 
			
		||||
 136 0082 8093 0000 		sts USARTSerialStream+8,r24
 | 
			
		||||
 137 0086 80E0      		ldi r24,lo8(gs(Serial_getchar))
 | 
			
		||||
 138 0088 90E0      		ldi r25,hi8(gs(Serial_getchar))
 | 
			
		||||
 139 008a 9093 0000 		sts USARTSerialStream+10+1,r25
 | 
			
		||||
 140 008e 8093 0000 		sts USARTSerialStream+10,r24
 | 
			
		||||
 141               	/* epilogue start */
 | 
			
		||||
 142               	.LBE46:
 | 
			
		||||
 143               	.LBE45:
 | 
			
		||||
 144               	.LSM19:
 | 
			
		||||
 145 0092 0895      		ret
 | 
			
		||||
 146               	.LFE132:
 | 
			
		||||
 148               		.section	.text.EVENT_USB_Host_DeviceAttached,"ax",@progbits
 | 
			
		||||
 149               	.global	EVENT_USB_Host_DeviceAttached
 | 
			
		||||
 151               	EVENT_USB_Host_DeviceAttached:
 | 
			
		||||
 152               	.LFB133:
 | 
			
		||||
 153               	.LSM20:
 | 
			
		||||
 154               	/* prologue: function */
 | 
			
		||||
 155               	/* frame size = 0 */
 | 
			
		||||
 156               	/* stack size = 0 */
 | 
			
		||||
 157               	.L__stack_usage = 0
 | 
			
		||||
 158               	.LSM21:
 | 
			
		||||
 159 0000 80E0      		ldi r24,lo8(__c.3897)
 | 
			
		||||
 160 0002 90E0      		ldi r25,hi8(__c.3897)
 | 
			
		||||
 161 0004 0E94 0000 		call puts_P
 | 
			
		||||
 162               	.LSM22:
 | 
			
		||||
 163 0008 80EA      		ldi r24,lo8(-96)
 | 
			
		||||
 164 000a 0E94 0000 		call LEDs_SetAllLEDs
 | 
			
		||||
 165               	/* epilogue start */
 | 
			
		||||
 166               	.LSM23:
 | 
			
		||||
 167 000e 0895      		ret
 | 
			
		||||
 168               	.LFE133:
 | 
			
		||||
 170               		.section	.text.EVENT_USB_Host_DeviceUnattached,"ax",@progbits
 | 
			
		||||
 171               	.global	EVENT_USB_Host_DeviceUnattached
 | 
			
		||||
 173               	EVENT_USB_Host_DeviceUnattached:
 | 
			
		||||
 174               	.LFB134:
 | 
			
		||||
 175               	.LSM24:
 | 
			
		||||
 176               	/* prologue: function */
 | 
			
		||||
 177               	/* frame size = 0 */
 | 
			
		||||
 178               	/* stack size = 0 */
 | 
			
		||||
 179               	.L__stack_usage = 0
 | 
			
		||||
 180               	.LSM25:
 | 
			
		||||
 181 0000 80E0      		ldi r24,lo8(__c.3902)
 | 
			
		||||
 182 0002 90E0      		ldi r25,hi8(__c.3902)
 | 
			
		||||
 183 0004 0E94 0000 		call puts_P
 | 
			
		||||
 184               	.LSM26:
 | 
			
		||||
 185 0008 80E1      		ldi r24,lo8(16)
 | 
			
		||||
 186 000a 0E94 0000 		call LEDs_SetAllLEDs
 | 
			
		||||
 187               	/* epilogue start */
 | 
			
		||||
 188               	.LSM27:
 | 
			
		||||
 189 000e 0895      		ret
 | 
			
		||||
 190               	.LFE134:
 | 
			
		||||
 192               		.section	.text.EVENT_USB_Host_DeviceEnumerationComplete,"ax",@progbits
 | 
			
		||||
 193               	.global	EVENT_USB_Host_DeviceEnumerationComplete
 | 
			
		||||
 195               	EVENT_USB_Host_DeviceEnumerationComplete:
 | 
			
		||||
 196               	.LFB135:
 | 
			
		||||
 197               	.LSM28:
 | 
			
		||||
 198               	/* prologue: function */
 | 
			
		||||
 199               	/* frame size = 0 */
 | 
			
		||||
 200               	/* stack size = 0 */
 | 
			
		||||
 201               	.L__stack_usage = 0
 | 
			
		||||
 202               	.LSM29:
 | 
			
		||||
 203 0000 80E6      		ldi r24,lo8(96)
 | 
			
		||||
 204 0002 0E94 0000 		call LEDs_SetAllLEDs
 | 
			
		||||
 205               	/* epilogue start */
 | 
			
		||||
 206               	.LSM30:
 | 
			
		||||
 207 0006 0895      		ret
 | 
			
		||||
 208               	.LFE135:
 | 
			
		||||
 210               		.section	.text.EVENT_USB_Host_HostError,"ax",@progbits
 | 
			
		||||
 211               	.global	EVENT_USB_Host_HostError
 | 
			
		||||
 213               	EVENT_USB_Host_HostError:
 | 
			
		||||
 214               	.LFB136:
 | 
			
		||||
 215               	.LSM31:
 | 
			
		||||
 216               	.LVL4:
 | 
			
		||||
 217 0000 DF93      		push r29
 | 
			
		||||
 218 0002 CF93      		push r28
 | 
			
		||||
 219 0004 0F92      		push __tmp_reg__
 | 
			
		||||
 220 0006 CDB7      		in r28,__SP_L__
 | 
			
		||||
 221 0008 DEB7      		in r29,__SP_H__
 | 
			
		||||
 222               	/* prologue: function */
 | 
			
		||||
 223               	/* frame size = 1 */
 | 
			
		||||
 224               	/* stack size = 3 */
 | 
			
		||||
 225               	.L__stack_usage = 3
 | 
			
		||||
 226               	.LSM32:
 | 
			
		||||
 227 000a 8983      		std Y+1,r24
 | 
			
		||||
 228 000c 0E94 0000 		call USB_Disable
 | 
			
		||||
 229               	.LVL5:
 | 
			
		||||
 230               	.LSM33:
 | 
			
		||||
 231 0010 00D0      		rcall .
 | 
			
		||||
 232 0012 00D0      		rcall .
 | 
			
		||||
 233 0014 EDB7      		in r30,__SP_L__
 | 
			
		||||
 234 0016 FEB7      		in r31,__SP_H__
 | 
			
		||||
 235 0018 3196      		adiw r30,1
 | 
			
		||||
 236 001a 20E0      		ldi r18,lo8(__c.3910)
 | 
			
		||||
 237 001c 30E0      		ldi r19,hi8(__c.3910)
 | 
			
		||||
 238 001e ADB7      		in r26,__SP_L__
 | 
			
		||||
 239 0020 BEB7      		in r27,__SP_H__
 | 
			
		||||
 240 0022 1296      		adiw r26,1+1
 | 
			
		||||
 241 0024 3C93      		st X,r19
 | 
			
		||||
 242 0026 2E93      		st -X,r18
 | 
			
		||||
 243 0028 1197      		sbiw r26,1
 | 
			
		||||
 244 002a 8981      		ldd r24,Y+1
 | 
			
		||||
 245 002c 8283      		std Z+2,r24
 | 
			
		||||
 246 002e 1382      		std Z+3,__zero_reg__
 | 
			
		||||
 247 0030 0E94 0000 		call printf_P
 | 
			
		||||
 248               	.LSM34:
 | 
			
		||||
 249 0034 0F90      		pop __tmp_reg__
 | 
			
		||||
 250 0036 0F90      		pop __tmp_reg__
 | 
			
		||||
 251 0038 0F90      		pop __tmp_reg__
 | 
			
		||||
 252 003a 0F90      		pop __tmp_reg__
 | 
			
		||||
 253 003c 80E9      		ldi r24,lo8(-112)
 | 
			
		||||
 254 003e 0E94 0000 		call LEDs_SetAllLEDs
 | 
			
		||||
 255               	.L7:
 | 
			
		||||
 256 0042 00C0      		rjmp .L7
 | 
			
		||||
 257               	.LFE136:
 | 
			
		||||
 259               		.section	.text.EVENT_USB_Host_DeviceEnumerationFailed,"ax",@progbits
 | 
			
		||||
 260               	.global	EVENT_USB_Host_DeviceEnumerationFailed
 | 
			
		||||
 262               	EVENT_USB_Host_DeviceEnumerationFailed:
 | 
			
		||||
 263               	.LFB137:
 | 
			
		||||
 264               	.LSM35:
 | 
			
		||||
 265               	.LVL6:
 | 
			
		||||
 266               	/* prologue: function */
 | 
			
		||||
 267               	/* frame size = 0 */
 | 
			
		||||
 268               	/* stack size = 0 */
 | 
			
		||||
 269               	.L__stack_usage = 0
 | 
			
		||||
 270               	.LSM36:
 | 
			
		||||
 271 0000 9091 0000 		lds r25,USB_HostState
 | 
			
		||||
 272 0004 2DB7      		in r18,__SP_L__
 | 
			
		||||
 273 0006 3EB7      		in r19,__SP_H__
 | 
			
		||||
 274 0008 2850      		subi r18,lo8(-(-8))
 | 
			
		||||
 275 000a 3040      		sbci r19,hi8(-(-8))
 | 
			
		||||
 276 000c 0FB6      		in __tmp_reg__,__SREG__
 | 
			
		||||
 277 000e F894      		cli
 | 
			
		||||
 278 0010 3EBF      		out __SP_H__,r19
 | 
			
		||||
 279 0012 0FBE      		out __SREG__,__tmp_reg__
 | 
			
		||||
 280 0014 2DBF      		out __SP_L__,r18
 | 
			
		||||
 281 0016 EDB7      		in r30,__SP_L__
 | 
			
		||||
 282 0018 FEB7      		in r31,__SP_H__
 | 
			
		||||
 283 001a 3196      		adiw r30,1
 | 
			
		||||
 284 001c 20E0      		ldi r18,lo8(__c.3917)
 | 
			
		||||
 285 001e 30E0      		ldi r19,hi8(__c.3917)
 | 
			
		||||
 286 0020 ADB7      		in r26,__SP_L__
 | 
			
		||||
 287 0022 BEB7      		in r27,__SP_H__
 | 
			
		||||
 288 0024 1296      		adiw r26,1+1
 | 
			
		||||
 289 0026 3C93      		st X,r19
 | 
			
		||||
 290 0028 2E93      		st -X,r18
 | 
			
		||||
 291 002a 1197      		sbiw r26,1
 | 
			
		||||
 292 002c 8283      		std Z+2,r24
 | 
			
		||||
 293 002e 1382      		std Z+3,__zero_reg__
 | 
			
		||||
 294 0030 6483      		std Z+4,r22
 | 
			
		||||
 295 0032 1582      		std Z+5,__zero_reg__
 | 
			
		||||
 296 0034 9683      		std Z+6,r25
 | 
			
		||||
 297 0036 1782      		std Z+7,__zero_reg__
 | 
			
		||||
 298 0038 0E94 0000 		call printf_P
 | 
			
		||||
 299               	.LVL7:
 | 
			
		||||
 300               	.LSM37:
 | 
			
		||||
 301 003c 2DB7      		in r18,__SP_L__
 | 
			
		||||
 302 003e 3EB7      		in r19,__SP_H__
 | 
			
		||||
 303 0040 285F      		subi r18,lo8(-(8))
 | 
			
		||||
 304 0042 3F4F      		sbci r19,hi8(-(8))
 | 
			
		||||
 305 0044 0FB6      		in __tmp_reg__,__SREG__
 | 
			
		||||
 306 0046 F894      		cli
 | 
			
		||||
 307 0048 3EBF      		out __SP_H__,r19
 | 
			
		||||
 308 004a 0FBE      		out __SREG__,__tmp_reg__
 | 
			
		||||
 309 004c 2DBF      		out __SP_L__,r18
 | 
			
		||||
 310 004e 80E9      		ldi r24,lo8(-112)
 | 
			
		||||
 311 0050 0E94 0000 		call LEDs_SetAllLEDs
 | 
			
		||||
 312               	/* epilogue start */
 | 
			
		||||
 313               	.LSM38:
 | 
			
		||||
 314 0054 0895      		ret
 | 
			
		||||
 315               	.LFE137:
 | 
			
		||||
 317               		.section	.text.Audio_Task,"ax",@progbits
 | 
			
		||||
 318               	.global	Audio_Task
 | 
			
		||||
 320               	Audio_Task:
 | 
			
		||||
 321               	.LFB138:
 | 
			
		||||
 322               	.LSM39:
 | 
			
		||||
 323 0000 1F93      		push r17
 | 
			
		||||
 324 0002 DF93      		push r29
 | 
			
		||||
 325 0004 CF93      		push r28
 | 
			
		||||
 326 0006 00D0      		rcall .
 | 
			
		||||
 327 0008 0F92      		push __tmp_reg__
 | 
			
		||||
 328 000a CDB7      		in r28,__SP_L__
 | 
			
		||||
 329 000c DEB7      		in r29,__SP_H__
 | 
			
		||||
 330               	/* prologue: function */
 | 
			
		||||
 331               	/* frame size = 3 */
 | 
			
		||||
 332               	/* stack size = 6 */
 | 
			
		||||
 333               	.L__stack_usage = 6
 | 
			
		||||
 334               	.LSM40:
 | 
			
		||||
 335 000e 8091 0000 		lds r24,USB_HostState
 | 
			
		||||
 336 0012 8B30      		cpi r24,lo8(11)
 | 
			
		||||
 337 0014 01F0      		breq .+2
 | 
			
		||||
 338 0016 00C0      		rjmp .L9
 | 
			
		||||
 339               	.LBB47:
 | 
			
		||||
 340               	.LSM41:
 | 
			
		||||
 341 0018 80E0      		ldi r24,lo8(__c.3924)
 | 
			
		||||
 342 001a 90E0      		ldi r25,hi8(__c.3924)
 | 
			
		||||
 343 001c 0E94 0000 		call puts_P
 | 
			
		||||
 344               	.LSM42:
 | 
			
		||||
 345 0020 0E94 0000 		call ProcessConfigurationDescriptor
 | 
			
		||||
 346 0024 182F      		mov r17,r24
 | 
			
		||||
 347               	.LVL8:
 | 
			
		||||
 348 0026 8823      		tst r24
 | 
			
		||||
 349 0028 01F0      		breq .L12
 | 
			
		||||
 350               	.LSM43:
 | 
			
		||||
 351 002a 8130      		cpi r24,lo8(1)
 | 
			
		||||
 352 002c 01F4      		brne .L13
 | 
			
		||||
 353               	.LSM44:
 | 
			
		||||
 354 002e 80E0      		ldi r24,lo8(__c.3926)
 | 
			
		||||
 355 0030 90E0      		ldi r25,hi8(__c.3926)
 | 
			
		||||
 356               	.LVL9:
 | 
			
		||||
 357 0032 00C0      		rjmp .L20
 | 
			
		||||
 358               	.L13:
 | 
			
		||||
 359               	.LSM45:
 | 
			
		||||
 360 0034 80E0      		ldi r24,lo8(__c.3928)
 | 
			
		||||
 361 0036 90E0      		ldi r25,hi8(__c.3928)
 | 
			
		||||
 362               	.L20:
 | 
			
		||||
 363 0038 0E94 0000 		call puts_P
 | 
			
		||||
 364               	.LSM46:
 | 
			
		||||
 365 003c 00D0      		rcall .
 | 
			
		||||
 366 003e 00D0      		rcall .
 | 
			
		||||
 367 0040 EDB7      		in r30,__SP_L__
 | 
			
		||||
 368 0042 FEB7      		in r31,__SP_H__
 | 
			
		||||
 369 0044 3196      		adiw r30,1
 | 
			
		||||
 370 0046 20E0      		ldi r18,lo8(__c.3930)
 | 
			
		||||
 371 0048 30E0      		ldi r19,hi8(__c.3930)
 | 
			
		||||
 372 004a ADB7      		in r26,__SP_L__
 | 
			
		||||
 373 004c BEB7      		in r27,__SP_H__
 | 
			
		||||
 374 004e 1296      		adiw r26,1+1
 | 
			
		||||
 375 0050 3C93      		st X,r19
 | 
			
		||||
 376 0052 2E93      		st -X,r18
 | 
			
		||||
 377 0054 1197      		sbiw r26,1
 | 
			
		||||
 378 0056 1283      		std Z+2,r17
 | 
			
		||||
 379               	.LVL10:
 | 
			
		||||
 380               	.L22:
 | 
			
		||||
 381 0058 1382      		std Z+3,__zero_reg__
 | 
			
		||||
 382 005a 0E94 0000 		call printf_P
 | 
			
		||||
 383               	.LSM47:
 | 
			
		||||
 384 005e 0F90      		pop __tmp_reg__
 | 
			
		||||
 385 0060 0F90      		pop __tmp_reg__
 | 
			
		||||
 386 0062 0F90      		pop __tmp_reg__
 | 
			
		||||
 387 0064 0F90      		pop __tmp_reg__
 | 
			
		||||
 388 0066 00C0      		rjmp .L21
 | 
			
		||||
 389               	.LVL11:
 | 
			
		||||
 390               	.L12:
 | 
			
		||||
 391               	.LSM48:
 | 
			
		||||
 392 0068 81E0      		ldi r24,lo8(1)
 | 
			
		||||
 393 006a 0E94 0000 		call USB_Host_SetDeviceConfiguration
 | 
			
		||||
 394               	.LVL12:
 | 
			
		||||
 395 006e 8823      		tst r24
 | 
			
		||||
 396 0070 01F0      		breq .L15
 | 
			
		||||
 397               	.LSM49:
 | 
			
		||||
 398 0072 00D0      		rcall .
 | 
			
		||||
 399 0074 00D0      		rcall .
 | 
			
		||||
 400 0076 EDB7      		in r30,__SP_L__
 | 
			
		||||
 401 0078 FEB7      		in r31,__SP_H__
 | 
			
		||||
 402 007a 3196      		adiw r30,1
 | 
			
		||||
 403 007c 20E0      		ldi r18,lo8(__c.3933)
 | 
			
		||||
 404 007e 30E0      		ldi r19,hi8(__c.3933)
 | 
			
		||||
 405 0080 00C0      		rjmp .L23
 | 
			
		||||
 406               	.L15:
 | 
			
		||||
 407               	.LSM50:
 | 
			
		||||
 408 0082 8091 0000 		lds r24,StreamingInterfaceIndex
 | 
			
		||||
 409               	.LVL13:
 | 
			
		||||
 410 0086 6091 0000 		lds r22,StreamingInterfaceAltSetting
 | 
			
		||||
 411 008a 0E94 0000 		call USB_Host_SetInterfaceAltSetting
 | 
			
		||||
 412               	.LVL14:
 | 
			
		||||
 413 008e 8823      		tst r24
 | 
			
		||||
 414 0090 01F0      		breq .L16
 | 
			
		||||
 415               	.LSM51:
 | 
			
		||||
 416 0092 00D0      		rcall .
 | 
			
		||||
 417 0094 00D0      		rcall .
 | 
			
		||||
 418 0096 EDB7      		in r30,__SP_L__
 | 
			
		||||
 419 0098 FEB7      		in r31,__SP_H__
 | 
			
		||||
 420 009a 3196      		adiw r30,1
 | 
			
		||||
 421 009c 20E0      		ldi r18,lo8(__c.3935)
 | 
			
		||||
 422 009e 30E0      		ldi r19,hi8(__c.3935)
 | 
			
		||||
 423               	.L23:
 | 
			
		||||
 424 00a0 ADB7      		in r26,__SP_L__
 | 
			
		||||
 425 00a2 BEB7      		in r27,__SP_H__
 | 
			
		||||
 426 00a4 1296      		adiw r26,1+1
 | 
			
		||||
 427 00a6 3C93      		st X,r19
 | 
			
		||||
 428 00a8 2E93      		st -X,r18
 | 
			
		||||
 429 00aa 1197      		sbiw r26,1
 | 
			
		||||
 430 00ac 8283      		std Z+2,r24
 | 
			
		||||
 431 00ae 00C0      		rjmp .L22
 | 
			
		||||
 432               	.L16:
 | 
			
		||||
 433               	.LSM52:
 | 
			
		||||
 434 00b0 2091 0000 		lds r18,StreamingEndpointAddress
 | 
			
		||||
 435 00b4 82E2      		ldi r24,lo8(34)
 | 
			
		||||
 436               	.LVL15:
 | 
			
		||||
 437 00b6 8093 0000 		sts USB_ControlRequest,r24
 | 
			
		||||
 438 00ba 81E0      		ldi r24,lo8(1)
 | 
			
		||||
 439 00bc 8093 0000 		sts USB_ControlRequest+1,r24
 | 
			
		||||
 440 00c0 80E0      		ldi r24,lo8(256)
 | 
			
		||||
 441 00c2 91E0      		ldi r25,hi8(256)
 | 
			
		||||
 442 00c4 9093 0000 		sts USB_ControlRequest+2+1,r25
 | 
			
		||||
 443 00c8 8093 0000 		sts USB_ControlRequest+2,r24
 | 
			
		||||
 444 00cc 2093 0000 		sts USB_ControlRequest+4,r18
 | 
			
		||||
 445 00d0 1092 0000 		sts USB_ControlRequest+5,__zero_reg__
 | 
			
		||||
 446 00d4 83E0      		ldi r24,lo8(3)
 | 
			
		||||
 447 00d6 90E0      		ldi r25,hi8(3)
 | 
			
		||||
 448 00d8 9093 0000 		sts USB_ControlRequest+6+1,r25
 | 
			
		||||
 449 00dc 8093 0000 		sts USB_ControlRequest+6,r24
 | 
			
		||||
 450               	.LSM53:
 | 
			
		||||
 451 00e0 DE01      		movw r26,r28
 | 
			
		||||
 452 00e2 1196      		adiw r26,1
 | 
			
		||||
 453 00e4 E0E0      		ldi r30,lo8(C.5.5024)
 | 
			
		||||
 454 00e6 F0E0      		ldi r31,hi8(C.5.5024)
 | 
			
		||||
 455 00e8 83E0      		ldi r24,lo8(3)
 | 
			
		||||
 456               	.L17:
 | 
			
		||||
 457 00ea 0190      		ld r0,Z+
 | 
			
		||||
 458 00ec 0D92      		st X+,r0
 | 
			
		||||
 459 00ee 8150      		subi r24,lo8(-(-1))
 | 
			
		||||
 460 00f0 01F4      		brne .L17
 | 
			
		||||
 461               	.LVL16:
 | 
			
		||||
 462               	.LBB48:
 | 
			
		||||
 463               	.LBB49:
 | 
			
		||||
 464               	.LSM54:
 | 
			
		||||
 465 00f2 1092 A700 		sts 167,__zero_reg__
 | 
			
		||||
 466               	.LBE49:
 | 
			
		||||
 467               	.LBE48:
 | 
			
		||||
 468               	.LSM55:
 | 
			
		||||
 469 00f6 CE01      		movw r24,r28
 | 
			
		||||
 470 00f8 0196      		adiw r24,1
 | 
			
		||||
 471 00fa 0E94 0000 		call USB_Host_SendControlRequest
 | 
			
		||||
 472               	.LVL17:
 | 
			
		||||
 473 00fe 8823      		tst r24
 | 
			
		||||
 474 0100 01F0      		breq .L18
 | 
			
		||||
 475               	.LVL18:
 | 
			
		||||
 476               	.L21:
 | 
			
		||||
 477               	.LSM56:
 | 
			
		||||
 478 0102 80E9      		ldi r24,lo8(-112)
 | 
			
		||||
 479 0104 0E94 0000 		call LEDs_SetAllLEDs
 | 
			
		||||
 480               	.LSM57:
 | 
			
		||||
 481 0108 1092 0000 		sts USB_HostState,__zero_reg__
 | 
			
		||||
 482               	.LSM58:
 | 
			
		||||
 483 010c 00C0      		rjmp .L9
 | 
			
		||||
 484               	.LVL19:
 | 
			
		||||
 485               	.L18:
 | 
			
		||||
 486               	.LSM59:
 | 
			
		||||
 487 010e 82E0      		ldi r24,lo8(2)
 | 
			
		||||
 488               	.LVL20:
 | 
			
		||||
 489 0110 8093 6E00 		sts 110,r24
 | 
			
		||||
 490               	.LSM60:
 | 
			
		||||
 491 0114 9CE7      		ldi r25,lo8(124)
 | 
			
		||||
 492 0116 97BD      		out 71-32,r25
 | 
			
		||||
 493               	.LSM61:
 | 
			
		||||
 494 0118 84BD      		out 68-32,r24
 | 
			
		||||
 495               	.LSM62:
 | 
			
		||||
 496 011a 85BD      		out 69-32,r24
 | 
			
		||||
 497               	.LSM63:
 | 
			
		||||
 498 011c 3E9A      		sbi 39-32,6
 | 
			
		||||
 499               	.LSM64:
 | 
			
		||||
 500 011e 81EF      		ldi r24,lo8(-15)
 | 
			
		||||
 501 0120 8093 9000 		sts 144,r24
 | 
			
		||||
 502               	.LSM65:
 | 
			
		||||
 503 0124 89E0      		ldi r24,lo8(9)
 | 
			
		||||
 504 0126 8093 9100 		sts 145,r24
 | 
			
		||||
 505               	.LSM66:
 | 
			
		||||
 506 012a 80E0      		ldi r24,lo8(__c.3939)
 | 
			
		||||
 507 012c 90E0      		ldi r25,hi8(__c.3939)
 | 
			
		||||
 508 012e 0E94 0000 		call puts_P
 | 
			
		||||
 509               	.LSM67:
 | 
			
		||||
 510 0132 8CE0      		ldi r24,lo8(12)
 | 
			
		||||
 511 0134 8093 0000 		sts USB_HostState,r24
 | 
			
		||||
 512               	.LVL21:
 | 
			
		||||
 513               	.L9:
 | 
			
		||||
 514               	/* epilogue start */
 | 
			
		||||
 515               	.LBE47:
 | 
			
		||||
 516               	.LSM68:
 | 
			
		||||
 517 0138 0F90      		pop __tmp_reg__
 | 
			
		||||
 518 013a 0F90      		pop __tmp_reg__
 | 
			
		||||
 519 013c 0F90      		pop __tmp_reg__
 | 
			
		||||
 520 013e CF91      		pop r28
 | 
			
		||||
 521 0140 DF91      		pop r29
 | 
			
		||||
 522 0142 1F91      		pop r17
 | 
			
		||||
 523 0144 0895      		ret
 | 
			
		||||
 524               	.LFE138:
 | 
			
		||||
 526               		.section	.text.main,"ax",@progbits
 | 
			
		||||
 527               	.global	main
 | 
			
		||||
 529               	main:
 | 
			
		||||
 530               	.LFB131:
 | 
			
		||||
 531               	.LSM69:
 | 
			
		||||
 532               	/* prologue: function */
 | 
			
		||||
 533               	/* frame size = 0 */
 | 
			
		||||
 534               	/* stack size = 0 */
 | 
			
		||||
 535               	.L__stack_usage = 0
 | 
			
		||||
 536               	.LSM70:
 | 
			
		||||
 537 0000 0E94 0000 		call SetupHardware
 | 
			
		||||
 538               	.LSM71:
 | 
			
		||||
 539 0004 80E0      		ldi r24,lo8(__c.3888)
 | 
			
		||||
 540 0006 90E0      		ldi r25,hi8(__c.3888)
 | 
			
		||||
 541 0008 0E94 0000 		call puts_P
 | 
			
		||||
 542               	.LSM72:
 | 
			
		||||
 543 000c 80E1      		ldi r24,lo8(16)
 | 
			
		||||
 544 000e 0E94 0000 		call LEDs_SetAllLEDs
 | 
			
		||||
 545               	.LSM73:
 | 
			
		||||
 546               	/* #APP */
 | 
			
		||||
 547               	 ;  49 "AudioInputHost.c" 1
 | 
			
		||||
 548 0012 7894      		sei
 | 
			
		||||
 549               	 ;  0 "" 2
 | 
			
		||||
 550               	/* #NOAPP */
 | 
			
		||||
 551               	.L25:
 | 
			
		||||
 552               	.LSM74:
 | 
			
		||||
 553 0014 0E94 0000 		call Audio_Task
 | 
			
		||||
 554               	.LSM75:
 | 
			
		||||
 555 0018 0E94 0000 		call USB_USBTask
 | 
			
		||||
 556 001c 00C0      		rjmp .L25
 | 
			
		||||
 557               	.LFE131:
 | 
			
		||||
 559               		.section	.text.__vector_21,"ax",@progbits
 | 
			
		||||
 560               	.global	__vector_21
 | 
			
		||||
 562               	__vector_21:
 | 
			
		||||
 563               	.LFB139:
 | 
			
		||||
 564               	.LSM76:
 | 
			
		||||
 565 0000 1F92      		push __zero_reg__
 | 
			
		||||
 566 0002 0F92      		push r0
 | 
			
		||||
 567 0004 0FB6      		in r0,__SREG__
 | 
			
		||||
 568 0006 0F92      		push r0
 | 
			
		||||
 569 0008 0BB6      		in r0,91-32
 | 
			
		||||
 570 000a 0F92      		push r0
 | 
			
		||||
 571 000c 1124      		clr __zero_reg__
 | 
			
		||||
 572 000e 1F93      		push r17
 | 
			
		||||
 573 0010 2F93      		push r18
 | 
			
		||||
 574 0012 3F93      		push r19
 | 
			
		||||
 575 0014 4F93      		push r20
 | 
			
		||||
 576 0016 5F93      		push r21
 | 
			
		||||
 577 0018 6F93      		push r22
 | 
			
		||||
 578 001a 7F93      		push r23
 | 
			
		||||
 579 001c 8F93      		push r24
 | 
			
		||||
 580 001e 9F93      		push r25
 | 
			
		||||
 581 0020 AF93      		push r26
 | 
			
		||||
 582 0022 BF93      		push r27
 | 
			
		||||
 583 0024 EF93      		push r30
 | 
			
		||||
 584 0026 FF93      		push r31
 | 
			
		||||
 585               	/* prologue: Signal */
 | 
			
		||||
 586               	/* frame size = 0 */
 | 
			
		||||
 587               	/* stack size = 17 */
 | 
			
		||||
 588               	.L__stack_usage = 17
 | 
			
		||||
 589               	.LBB50:
 | 
			
		||||
 590               	.LBB51:
 | 
			
		||||
 591               	.LSM77:
 | 
			
		||||
 592 0028 1091 A700 		lds r17,167
 | 
			
		||||
 593 002c 1770      		andi r17,lo8(7)
 | 
			
		||||
 594               	.LVL22:
 | 
			
		||||
 595               	.LBE51:
 | 
			
		||||
 596               	.LBE50:
 | 
			
		||||
 597               	.LBB52:
 | 
			
		||||
 598               	.LBB53:
 | 
			
		||||
 599               	.LSM78:
 | 
			
		||||
 600 002e 81E0      		ldi r24,lo8(1)
 | 
			
		||||
 601 0030 8093 A700 		sts 167,r24
 | 
			
		||||
 602               	.LBE53:
 | 
			
		||||
 603               	.LBE52:
 | 
			
		||||
 604               	.LBB54:
 | 
			
		||||
 605               	.LBB55:
 | 
			
		||||
 606               	.LSM79:
 | 
			
		||||
 607 0034 8091 A900 		lds r24,169
 | 
			
		||||
 608 0038 8F7B      		andi r24,lo8(-65)
 | 
			
		||||
 609 003a 8093 A900 		sts 169,r24
 | 
			
		||||
 610               	.LBE55:
 | 
			
		||||
 611               	.LBE54:
 | 
			
		||||
 612               	.LBB56:
 | 
			
		||||
 613               	.LBB57:
 | 
			
		||||
 614               	.LSM80:
 | 
			
		||||
 615 003e 8091 A600 		lds r24,166
 | 
			
		||||
 616               	.LBE57:
 | 
			
		||||
 617               	.LBE56:
 | 
			
		||||
 618               	.LSM81:
 | 
			
		||||
 619 0042 80FF      		sbrs r24,0
 | 
			
		||||
 620 0044 00C0      		rjmp .L27
 | 
			
		||||
 621               	.LBB58:
 | 
			
		||||
 622               	.LBB59:
 | 
			
		||||
 623               	.LBB60:
 | 
			
		||||
 624               	.LSM82:
 | 
			
		||||
 625 0046 8091 AF00 		lds r24,175
 | 
			
		||||
 626               	.LSM83:
 | 
			
		||||
 627 004a 4091 AF00 		lds r20,175
 | 
			
		||||
 628               	.LVL23:
 | 
			
		||||
 629               	.LBE60:
 | 
			
		||||
 630               	.LBE59:
 | 
			
		||||
 631               	.LBB61:
 | 
			
		||||
 632               	.LBB62:
 | 
			
		||||
 633               	.LSM84:
 | 
			
		||||
 634 004e 8091 A600 		lds r24,166
 | 
			
		||||
 635               	.LBE62:
 | 
			
		||||
 636               	.LBE61:
 | 
			
		||||
 637               	.LSM85:
 | 
			
		||||
 638 0052 85FD      		sbrc r24,5
 | 
			
		||||
 639 0054 00C0      		rjmp .L28
 | 
			
		||||
 640               	.LBB63:
 | 
			
		||||
 641               	.LBB64:
 | 
			
		||||
 642               	.LSM86:
 | 
			
		||||
 643 0056 8091 A600 		lds r24,166
 | 
			
		||||
 644 005a 8E77      		andi r24,lo8(126)
 | 
			
		||||
 645 005c 8093 A600 		sts 166,r24
 | 
			
		||||
 646               	.L28:
 | 
			
		||||
 647               	.LBE64:
 | 
			
		||||
 648               	.LBE63:
 | 
			
		||||
 649               	.LSM87:
 | 
			
		||||
 650 0060 842F      		mov r24,r20
 | 
			
		||||
 651 0062 9927      		clr r25
 | 
			
		||||
 652 0064 87FD      		sbrc r24,7
 | 
			
		||||
 653 0066 9095      		com r25
 | 
			
		||||
 654 0068 20E8      		ldi r18,lo8(128)
 | 
			
		||||
 655 006a 30E0      		ldi r19,hi8(128)
 | 
			
		||||
 656 006c 8227      		eor r24,r18
 | 
			
		||||
 657 006e 9327      		eor r25,r19
 | 
			
		||||
 658 0070 9093 9900 		sts 152+1,r25
 | 
			
		||||
 659 0074 8093 9800 		sts 152,r24
 | 
			
		||||
 660               	.LVL24:
 | 
			
		||||
 661               	.LSM88:
 | 
			
		||||
 662 0078 4131      		cpi r20,lo8(17)
 | 
			
		||||
 663 007a 04F4      		brge .L30
 | 
			
		||||
 664               	.LSM89:
 | 
			
		||||
 665 007c 4930      		cpi r20,lo8(9)
 | 
			
		||||
 666 007e 04F4      		brge .L31
 | 
			
		||||
 667               	.LSM90:
 | 
			
		||||
 668 0080 4530      		cpi r20,lo8(5)
 | 
			
		||||
 669 0082 04F4      		brge .L32
 | 
			
		||||
 670               	.LSM91:
 | 
			
		||||
 671 0084 4330      		cpi r20,lo8(3)
 | 
			
		||||
 672 0086 04F4      		brge .L33
 | 
			
		||||
 673               	.LSM92:
 | 
			
		||||
 674 0088 80E0      		ldi r24,lo8(0)
 | 
			
		||||
 675 008a 00C0      		rjmp .L29
 | 
			
		||||
 676               	.L30:
 | 
			
		||||
 677               	.LSM93:
 | 
			
		||||
 678 008c 80EF      		ldi r24,lo8(-16)
 | 
			
		||||
 679 008e 00C0      		rjmp .L29
 | 
			
		||||
 680               	.L31:
 | 
			
		||||
 681               	.LSM94:
 | 
			
		||||
 682 0090 80EB      		ldi r24,lo8(-80)
 | 
			
		||||
 683 0092 00C0      		rjmp .L29
 | 
			
		||||
 684               	.L32:
 | 
			
		||||
 685               	.LSM95:
 | 
			
		||||
 686 0094 80E3      		ldi r24,lo8(48)
 | 
			
		||||
 687 0096 00C0      		rjmp .L29
 | 
			
		||||
 688               	.L33:
 | 
			
		||||
 689               	.LSM96:
 | 
			
		||||
 690 0098 80E1      		ldi r24,lo8(16)
 | 
			
		||||
 691               	.L29:
 | 
			
		||||
 692               	.LVL25:
 | 
			
		||||
 693               	.LSM97:
 | 
			
		||||
 694 009a 0E94 0000 		call LEDs_SetAllLEDs
 | 
			
		||||
 695               	.LVL26:
 | 
			
		||||
 696               	.L27:
 | 
			
		||||
 697               	.LBE58:
 | 
			
		||||
 698               	.LBB65:
 | 
			
		||||
 699               	.LBB66:
 | 
			
		||||
 700               	.LSM98:
 | 
			
		||||
 701 009e 8091 A900 		lds r24,169
 | 
			
		||||
 702 00a2 8064      		ori r24,lo8(64)
 | 
			
		||||
 703 00a4 8093 A900 		sts 169,r24
 | 
			
		||||
 704               	.LVL27:
 | 
			
		||||
 705               	.LBE66:
 | 
			
		||||
 706               	.LBE65:
 | 
			
		||||
 707               	.LBB67:
 | 
			
		||||
 708               	.LBB68:
 | 
			
		||||
 709               	.LSM99:
 | 
			
		||||
 710 00a8 1093 A700 		sts 167,r17
 | 
			
		||||
 711               	/* epilogue start */
 | 
			
		||||
 712               	.LBE68:
 | 
			
		||||
 713               	.LBE67:
 | 
			
		||||
 714               	.LSM100:
 | 
			
		||||
 715 00ac FF91      		pop r31
 | 
			
		||||
 716 00ae EF91      		pop r30
 | 
			
		||||
 717 00b0 BF91      		pop r27
 | 
			
		||||
 718 00b2 AF91      		pop r26
 | 
			
		||||
 719 00b4 9F91      		pop r25
 | 
			
		||||
 720 00b6 8F91      		pop r24
 | 
			
		||||
 721 00b8 7F91      		pop r23
 | 
			
		||||
 722 00ba 6F91      		pop r22
 | 
			
		||||
 723 00bc 5F91      		pop r21
 | 
			
		||||
 724 00be 4F91      		pop r20
 | 
			
		||||
 725 00c0 3F91      		pop r19
 | 
			
		||||
 726 00c2 2F91      		pop r18
 | 
			
		||||
 727 00c4 1F91      		pop r17
 | 
			
		||||
 728               	.LVL28:
 | 
			
		||||
 729 00c6 0F90      		pop r0
 | 
			
		||||
 730 00c8 0BBE      		out 91-32,r0
 | 
			
		||||
 731 00ca 0F90      		pop r0
 | 
			
		||||
 732 00cc 0FBE      		out __SREG__,r0
 | 
			
		||||
 733 00ce 0F90      		pop r0
 | 
			
		||||
 734 00d0 1F90      		pop __zero_reg__
 | 
			
		||||
 735 00d2 1895      		reti
 | 
			
		||||
 736               	.LFE139:
 | 
			
		||||
 738               		.section	.progmem.data,"a",@progbits
 | 
			
		||||
 741               	__c.3939:
 | 
			
		||||
 742 0000 4D69 6372 		.string	"Microphone Enumerated.\r\n"
 | 
			
		||||
 742      6F70 686F 
 | 
			
		||||
 742      6E65 2045 
 | 
			
		||||
 742      6E75 6D65 
 | 
			
		||||
 742      7261 7465 
 | 
			
		||||
 745               	__c.3935:
 | 
			
		||||
 746 0019 1B5B 3331 		.ascii	"\033[31mCould not set alt"
 | 
			
		||||
 746      6D43 6F75 
 | 
			
		||||
 746      6C64 206E 
 | 
			
		||||
 746      6F74 2073 
 | 
			
		||||
 746      6574 2061 
 | 
			
		||||
 747 002f 6572 6E61 		.string	"ernative streaming interface setting.\r\n -- Error Code: %d\r\n\033[37m"
 | 
			
		||||
 747      7469 7665 
 | 
			
		||||
 747      2073 7472 
 | 
			
		||||
 747      6561 6D69 
 | 
			
		||||
 747      6E67 2069 
 | 
			
		||||
 750               	__c.3933:
 | 
			
		||||
 751 0070 1B5B      		.ascii	"\033["
 | 
			
		||||
 752 0072 3331 6D43 		.string	"31mControl Error (Set Configuration).\r\n -- Error Code: %d\r\n\033[37m"
 | 
			
		||||
 752      6F6E 7472 
 | 
			
		||||
 752      6F6C 2045 
 | 
			
		||||
 752      7272 6F72 
 | 
			
		||||
 752      2028 5365 
 | 
			
		||||
 755               	__c.3930:
 | 
			
		||||
 756 00b3 202D 2D20 		.string	" -- Error Code: %d\r\n\033[37m"
 | 
			
		||||
 756      4572 726F 
 | 
			
		||||
 756      7220 436F 
 | 
			
		||||
 756      6465 3A20 
 | 
			
		||||
 756      2564 0D0A 
 | 
			
		||||
 759               	__c.3928:
 | 
			
		||||
 760 00cd 1B5B 3331 		.string	"\033[31mInvalid Device.\r\n"
 | 
			
		||||
 760      6D49 6E76 
 | 
			
		||||
 760      616C 6964 
 | 
			
		||||
 760      2044 6576 
 | 
			
		||||
 760      6963 652E 
 | 
			
		||||
 763               	__c.3926:
 | 
			
		||||
 764 00e4 1B5B 3331 		.string	"\033[31mControl Error (Get Configuration).\r\n"
 | 
			
		||||
 764      6D43 6F6E 
 | 
			
		||||
 764      7472 6F6C 
 | 
			
		||||
 764      2045 7272 
 | 
			
		||||
 764      6F72 2028 
 | 
			
		||||
 767               	__c.3924:
 | 
			
		||||
 768 010e 4765 7474 		.string	"Getting Config Data.\r\n"
 | 
			
		||||
 768      696E 6720 
 | 
			
		||||
 768      436F 6E66 
 | 
			
		||||
 768      6967 2044 
 | 
			
		||||
 768      6174 612E 
 | 
			
		||||
 769               		.data
 | 
			
		||||
 772               	C.5.5024:
 | 
			
		||||
 773 0000 80        		.byte	-128
 | 
			
		||||
 774 0001 BB        		.byte	-69
 | 
			
		||||
 775 0002 00        		.byte	0
 | 
			
		||||
 776               		.section	.progmem.data
 | 
			
		||||
 779               	__c.3917:
 | 
			
		||||
 780 0125 1B5B 3331 		.ascii	"\033[31mDev Enum Error\r\n"
 | 
			
		||||
 780      6D44 6576 
 | 
			
		||||
 780      2045 6E75 
 | 
			
		||||
 780      6D20 4572 
 | 
			
		||||
 780      726F 720D 
 | 
			
		||||
 781 013a 202D 2D20 		.string	" -- Error Code %d\r\n -- Sub Error Code %d\r\n -- In State %d\r\n\033[37m"
 | 
			
		||||
 781      4572 726F 
 | 
			
		||||
 781      7220 436F 
 | 
			
		||||
 781      6465 2025 
 | 
			
		||||
 781      640D 0A20 
 | 
			
		||||
 784               	__c.3910:
 | 
			
		||||
 785 017b 1B5B 3331 		.string	"\033[31mHost Mode Error\r\n -- Error Code %d\r\n\033[37m"
 | 
			
		||||
 785      6D48 6F73 
 | 
			
		||||
 785      7420 4D6F 
 | 
			
		||||
 785      6465 2045 
 | 
			
		||||
 785      7272 6F72 
 | 
			
		||||
 788               	__c.3902:
 | 
			
		||||
 789 01aa 1B5B 3332 		.string	"\033[32mDevice Unattached.\r\n\033[37m"
 | 
			
		||||
 789      6D44 6576 
 | 
			
		||||
 789      6963 6520 
 | 
			
		||||
 789      556E 6174 
 | 
			
		||||
 789      7461 6368 
 | 
			
		||||
 792               	__c.3897:
 | 
			
		||||
 793 01c9 1B5B 3332 		.string	"\033[32mDevice Attached.\r\n\033[37m"
 | 
			
		||||
 793      6D44 6576 
 | 
			
		||||
 793      6963 6520 
 | 
			
		||||
 793      4174 7461 
 | 
			
		||||
 793      6368 6564 
 | 
			
		||||
 796               	__c.3888:
 | 
			
		||||
 797 01e6 1B5B 3336 		.string	"\033[36mAudio Host Demo running.\r\n\033[37m"
 | 
			
		||||
 797      6D41 7564 
 | 
			
		||||
 797      696F 2048 
 | 
			
		||||
 797      6F73 7420 
 | 
			
		||||
 797      4465 6D6F 
 | 
			
		||||
 894               	.Letext0:
 | 
			
		||||
DEFINED SYMBOLS
 | 
			
		||||
                            *ABS*:00000000 AudioInputHost.c
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:2      *ABS*:0000003f __SREG__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:3      *ABS*:0000003e __SP_H__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:4      *ABS*:0000003d __SP_L__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:5      *ABS*:00000034 __CCP__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:6      *ABS*:00000000 __tmp_reg__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:7      *ABS*:00000001 __zero_reg__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:18     .text.LEDs_SetAllLEDs:00000000 LEDs_SetAllLEDs
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:39     .text.SetupHardware:00000000 SetupHardware
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:151    .text.EVENT_USB_Host_DeviceAttached:00000000 EVENT_USB_Host_DeviceAttached
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:792    .progmem.data:000001c9 __c.3897
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:173    .text.EVENT_USB_Host_DeviceUnattached:00000000 EVENT_USB_Host_DeviceUnattached
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:788    .progmem.data:000001aa __c.3902
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:195    .text.EVENT_USB_Host_DeviceEnumerationComplete:00000000 EVENT_USB_Host_DeviceEnumerationComplete
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:213    .text.EVENT_USB_Host_HostError:00000000 EVENT_USB_Host_HostError
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:784    .progmem.data:0000017b __c.3910
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:262    .text.EVENT_USB_Host_DeviceEnumerationFailed:00000000 EVENT_USB_Host_DeviceEnumerationFailed
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:779    .progmem.data:00000125 __c.3917
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:320    .text.Audio_Task:00000000 Audio_Task
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:767    .progmem.data:0000010e __c.3924
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:763    .progmem.data:000000e4 __c.3926
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:759    .progmem.data:000000cd __c.3928
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:755    .progmem.data:000000b3 __c.3930
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:750    .progmem.data:00000070 __c.3933
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:745    .progmem.data:00000019 __c.3935
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:772    .data:00000000 C.5.5024
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:741    .progmem.data:00000000 __c.3939
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:529    .text.main:00000000 main
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:796    .progmem.data:000001e6 __c.3888
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\ccMWbd5S.s:562    .text.__vector_21:00000000 __vector_21
 | 
			
		||||
 | 
			
		||||
UNDEFINED SYMBOLS
 | 
			
		||||
USB_Init
 | 
			
		||||
USARTSerialStream
 | 
			
		||||
__iob
 | 
			
		||||
Serial_putchar
 | 
			
		||||
Serial_getchar
 | 
			
		||||
puts_P
 | 
			
		||||
USB_Disable
 | 
			
		||||
printf_P
 | 
			
		||||
USB_HostState
 | 
			
		||||
ProcessConfigurationDescriptor
 | 
			
		||||
USB_Host_SetDeviceConfiguration
 | 
			
		||||
StreamingInterfaceIndex
 | 
			
		||||
StreamingInterfaceAltSetting
 | 
			
		||||
USB_Host_SetInterfaceAltSetting
 | 
			
		||||
StreamingEndpointAddress
 | 
			
		||||
USB_ControlRequest
 | 
			
		||||
USB_Host_SendControlRequest
 | 
			
		||||
USB_USBTask
 | 
			
		||||
__do_copy_data
 | 
			
		||||
							
								
								
									
										1169
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1169
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.map
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										267
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.sym
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										267
									
								
								Demos/Host/Incomplete/AudioInputHost/AudioInputHost.sym
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,267 @@
 | 
			
		||||
         U CALLBACK_HIDParser_FilterHIDReportItem
 | 
			
		||||
00000000 W __heap_end
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 a __tmp_reg__
 | 
			
		||||
00000000 W __vector_default
 | 
			
		||||
00000000 T __vectors
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000001 a __zero_reg__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
00000034 a __CCP__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003d a __SP_L__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003e a __SP_H__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
0000003f a __SREG__
 | 
			
		||||
00000098 t __c.3939
 | 
			
		||||
000000b1 t __c.3935
 | 
			
		||||
00000108 t __c.3933
 | 
			
		||||
0000014b t __c.3930
 | 
			
		||||
00000165 t __c.3928
 | 
			
		||||
0000017c t __c.3926
 | 
			
		||||
000001a6 t __c.3924
 | 
			
		||||
000001bd t __c.3917
 | 
			
		||||
00000213 t __c.3910
 | 
			
		||||
00000242 t __c.3902
 | 
			
		||||
00000261 t __c.3897
 | 
			
		||||
0000027e t __c.3888
 | 
			
		||||
000002a4 T __ctors_end
 | 
			
		||||
000002a4 T __ctors_start
 | 
			
		||||
000002a4 T __dtors_end
 | 
			
		||||
000002a4 T __dtors_start
 | 
			
		||||
000002a4 W __init
 | 
			
		||||
000002a4 T __trampolines_end
 | 
			
		||||
000002a4 T __trampolines_start
 | 
			
		||||
000002b0 T __do_copy_data
 | 
			
		||||
000002ca T __do_clear_bss
 | 
			
		||||
000002d2 t .do_clear_bss_loop
 | 
			
		||||
000002d4 t .do_clear_bss_start
 | 
			
		||||
000002e0 T __bad_interrupt
 | 
			
		||||
000002e0 W __vector_1
 | 
			
		||||
000002e0 W __vector_11
 | 
			
		||||
000002e0 W __vector_12
 | 
			
		||||
000002e0 W __vector_13
 | 
			
		||||
000002e0 W __vector_14
 | 
			
		||||
000002e0 W __vector_15
 | 
			
		||||
000002e0 W __vector_16
 | 
			
		||||
000002e0 W __vector_17
 | 
			
		||||
000002e0 W __vector_18
 | 
			
		||||
000002e0 W __vector_19
 | 
			
		||||
000002e0 W __vector_2
 | 
			
		||||
000002e0 W __vector_20
 | 
			
		||||
000002e0 W __vector_22
 | 
			
		||||
000002e0 W __vector_23
 | 
			
		||||
000002e0 W __vector_24
 | 
			
		||||
000002e0 W __vector_25
 | 
			
		||||
000002e0 W __vector_26
 | 
			
		||||
000002e0 W __vector_27
 | 
			
		||||
000002e0 W __vector_28
 | 
			
		||||
000002e0 W __vector_29
 | 
			
		||||
000002e0 W __vector_3
 | 
			
		||||
000002e0 W __vector_30
 | 
			
		||||
000002e0 W __vector_31
 | 
			
		||||
000002e0 W __vector_32
 | 
			
		||||
000002e0 W __vector_33
 | 
			
		||||
000002e0 W __vector_34
 | 
			
		||||
000002e0 W __vector_35
 | 
			
		||||
000002e0 W __vector_36
 | 
			
		||||
000002e0 W __vector_37
 | 
			
		||||
000002e0 W __vector_4
 | 
			
		||||
000002e0 W __vector_5
 | 
			
		||||
000002e0 W __vector_6
 | 
			
		||||
000002e0 W __vector_7
 | 
			
		||||
000002e0 W __vector_8
 | 
			
		||||
000002e0 W __vector_9
 | 
			
		||||
000002e2 t LEDs_SetAllLEDs
 | 
			
		||||
000002ec T SetupHardware
 | 
			
		||||
0000037e T EVENT_USB_Host_DeviceAttached
 | 
			
		||||
00000388 T EVENT_USB_Host_DeviceUnattached
 | 
			
		||||
00000392 T EVENT_USB_Host_DeviceEnumerationComplete
 | 
			
		||||
00000396 T EVENT_USB_Host_HostError
 | 
			
		||||
000003d4 T EVENT_USB_Host_DeviceEnumerationFailed
 | 
			
		||||
00000424 T Audio_Task
 | 
			
		||||
00000558 T main
 | 
			
		||||
0000056c T __vector_21
 | 
			
		||||
0000063e T DComp_NextAudioControlInterface
 | 
			
		||||
00000660 T DComp_NextAudioStreamInterface
 | 
			
		||||
00000682 T DComp_NextAudioInterfaceDataEndpoint
 | 
			
		||||
000006a4 T ProcessConfigurationDescriptor
 | 
			
		||||
000007d6 t USB_Host_ResetDevice
 | 
			
		||||
0000087e T USB_Host_WaitMS
 | 
			
		||||
00000928 T USB_Host_ProcessNextHostState
 | 
			
		||||
00000b8c T USB_Host_SetDeviceConfiguration
 | 
			
		||||
00000bb8 T USB_Host_SetInterfaceAltSetting
 | 
			
		||||
00000be6 T Pipe_ConfigurePipe
 | 
			
		||||
00000cb4 T Pipe_ClearPipes
 | 
			
		||||
00000cdc T USB_Disable
 | 
			
		||||
00000d0c T USB_ResetInterface
 | 
			
		||||
00000da8 T USB_Init
 | 
			
		||||
00000dba T USB_INT_DisableAllInterrupts
 | 
			
		||||
00000dca T USB_INT_ClearAllInterrupts
 | 
			
		||||
00000dd4 T __vector_10
 | 
			
		||||
00000efa T USB_Host_GetDeviceConfigDescriptor
 | 
			
		||||
00000fa8 T USB_GetNextDescriptorComp
 | 
			
		||||
0000102e W EVENT_USB_Host_StartOfFrame
 | 
			
		||||
0000102e T USB_Event_Stub
 | 
			
		||||
00001030 t USB_Host_WaitForIOS
 | 
			
		||||
00001082 T USB_Host_SendControlRequest
 | 
			
		||||
000012ae T USB_USBTask
 | 
			
		||||
000012ca T Serial_putchar
 | 
			
		||||
000012dc T Serial_getchar
 | 
			
		||||
00001302 T printf_P
 | 
			
		||||
00001340 T puts_P
 | 
			
		||||
000013b0 T vfprintf
 | 
			
		||||
000017b6 T strnlen_P
 | 
			
		||||
000017cc T strnlen
 | 
			
		||||
000017e2 T fputc
 | 
			
		||||
0000183a T __ultoa_invert
 | 
			
		||||
000018f6 T _exit
 | 
			
		||||
000018f6 W exit
 | 
			
		||||
000018f8 t __stop_program
 | 
			
		||||
000018fa A __data_load_start
 | 
			
		||||
000018fa T _etext
 | 
			
		||||
00001916 A __data_load_end
 | 
			
		||||
000020ff W __stack
 | 
			
		||||
00800100 d C.5.5024
 | 
			
		||||
00800100 D __data_start
 | 
			
		||||
00800103 d C.0.3420
 | 
			
		||||
0080010b d C.10.3637
 | 
			
		||||
00800113 d C.7.3627
 | 
			
		||||
0080011b D USB_ControlPipeSize
 | 
			
		||||
0080011c B StreamingInterfaceIndex
 | 
			
		||||
0080011c B __bss_start
 | 
			
		||||
0080011c D __data_end
 | 
			
		||||
0080011c D _edata
 | 
			
		||||
0080011d B StreamingInterfaceAltSetting
 | 
			
		||||
0080011e B StreamingEndpointAddress
 | 
			
		||||
0080011f b PostWaitState.2492
 | 
			
		||||
00800120 b WaitMSRemaining.2491
 | 
			
		||||
00800122 B USB_IsInitialized
 | 
			
		||||
00800123 B USB_ControlRequest
 | 
			
		||||
0080012b B USB_HostState
 | 
			
		||||
0080012c B USARTSerialStream
 | 
			
		||||
0080013a B __iob
 | 
			
		||||
00800140 B __bss_end
 | 
			
		||||
00800140 N _end
 | 
			
		||||
00810000 N __eeprom_end
 | 
			
		||||
							
								
								
									
										183
									
								
								Demos/Host/Incomplete/AudioInputHost/ConfigDescriptor.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										183
									
								
								Demos/Host/Incomplete/AudioInputHost/ConfigDescriptor.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,183 @@
 | 
			
		||||
/*
 | 
			
		||||
             LUFA Library
 | 
			
		||||
     Copyright (C) Dean Camera, 2011.
 | 
			
		||||
 | 
			
		||||
  dean [at] fourwalledcubicle [dot] com
 | 
			
		||||
           www.lufa-lib.org
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 | 
			
		||||
 | 
			
		||||
  Permission to use, copy, modify, distribute, and sell this
 | 
			
		||||
  software and its documentation for any purpose is hereby granted
 | 
			
		||||
  without fee, provided that the above copyright notice appear in
 | 
			
		||||
  all copies and that both that the copyright notice and this
 | 
			
		||||
  permission notice and warranty disclaimer appear in supporting
 | 
			
		||||
  documentation, and that the name of the author not be used in
 | 
			
		||||
  advertising or publicity pertaining to distribution of the
 | 
			
		||||
  software without specific, written prior permission.
 | 
			
		||||
 | 
			
		||||
  The author disclaim all warranties with regard to this
 | 
			
		||||
  software, including all implied warranties of merchantability
 | 
			
		||||
  and fitness.  In no event shall the author be liable for any
 | 
			
		||||
  special, indirect or consequential damages or any damages
 | 
			
		||||
  whatsoever resulting from loss of use, data or profits, whether
 | 
			
		||||
  in an action of contract, negligence or other tortious action,
 | 
			
		||||
  arising out of or in connection with the use or performance of
 | 
			
		||||
  this software.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/** \file
 | 
			
		||||
 *
 | 
			
		||||
 *  USB Device Configuration Descriptor processing routines, to determine the correct pipe configurations
 | 
			
		||||
 *  needed to communication with an attached USB device. Descriptors are special  computer-readable structures
 | 
			
		||||
 *  which the host requests upon device enumeration, to determine the device's capabilities and functions.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "ConfigDescriptor.h"
 | 
			
		||||
 | 
			
		||||
uint8_t StreamingInterfaceIndex      = 0;
 | 
			
		||||
uint8_t StreamingInterfaceAltSetting = 0;
 | 
			
		||||
uint8_t StreamingEndpointAddress     = 0;
 | 
			
		||||
 | 
			
		||||
uint8_t ProcessConfigurationDescriptor(void)
 | 
			
		||||
{
 | 
			
		||||
	uint8_t  ConfigDescriptorData[512];
 | 
			
		||||
	void*    CurrConfigLocation = ConfigDescriptorData;
 | 
			
		||||
	uint16_t CurrConfigBytesRem;
 | 
			
		||||
 | 
			
		||||
	USB_Descriptor_Interface_t* AudioControlInterface   = NULL;
 | 
			
		||||
	USB_Descriptor_Interface_t* AudioStreamingInterface = NULL;
 | 
			
		||||
	USB_Descriptor_Endpoint_t*  DataINEndpoint          = NULL;
 | 
			
		||||
 | 
			
		||||
	/* Retrieve the entire configuration descriptor into the allocated buffer */
 | 
			
		||||
	switch (USB_Host_GetDeviceConfigDescriptor(1, &CurrConfigBytesRem, ConfigDescriptorData, sizeof(ConfigDescriptorData)))
 | 
			
		||||
	{
 | 
			
		||||
		case HOST_GETCONFIG_Successful:
 | 
			
		||||
			break;
 | 
			
		||||
		case HOST_GETCONFIG_InvalidData:
 | 
			
		||||
			return InvalidConfigDataReturned;
 | 
			
		||||
		case HOST_GETCONFIG_BuffOverflow:
 | 
			
		||||
			return DescriptorTooLarge;
 | 
			
		||||
		default:
 | 
			
		||||
			return ControlError;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	while (!(DataINEndpoint))
 | 
			
		||||
	{
 | 
			
		||||
		if (!(AudioControlInterface) ||
 | 
			
		||||
		    USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
 | 
			
		||||
		                              DComp_NextAudioInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
 | 
			
		||||
		{
 | 
			
		||||
			if (!(AudioControlInterface))
 | 
			
		||||
			{
 | 
			
		||||
				if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
 | 
			
		||||
											  DComp_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
 | 
			
		||||
				{
 | 
			
		||||
					/* Descriptor not found, error out */
 | 
			
		||||
					return NoCompatibleInterfaceFound;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				/* Save the interface in case we need to refer back to it later */
 | 
			
		||||
				AudioControlInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);			
 | 
			
		||||
			}
 | 
			
		||||
		
 | 
			
		||||
			if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
 | 
			
		||||
										  DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)
 | 
			
		||||
			{
 | 
			
		||||
				if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
 | 
			
		||||
											  DComp_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
 | 
			
		||||
				{
 | 
			
		||||
					/* Descriptor not found, error out */
 | 
			
		||||
					return NoCompatibleInterfaceFound;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				/* Save the interface in case we need to refer back to it later */
 | 
			
		||||
				AudioControlInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/* Save the interface in case we need to refer back to it later */
 | 
			
		||||
			AudioStreamingInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
 | 
			
		||||
 | 
			
		||||
			/* Skip the remainder of the loop as we have not found an endpoint yet */
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* Retrieve the endpoint address from the endpoint descriptor */
 | 
			
		||||
		USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
 | 
			
		||||
 | 
			
		||||
		/* If the endpoint is a IN type endpoint */
 | 
			
		||||
		if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
 | 
			
		||||
		  DataINEndpoint = EndpointData;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	StreamingInterfaceIndex      = AudioStreamingInterface->InterfaceNumber;
 | 
			
		||||
	StreamingInterfaceAltSetting = AudioStreamingInterface->AlternateSetting;
 | 
			
		||||
	StreamingEndpointAddress     = DataINEndpoint->EndpointAddress;
 | 
			
		||||
 | 
			
		||||
	/* Configure the HID data IN pipe */
 | 
			
		||||
	Pipe_ConfigurePipe(AUDIO_DATA_IN_PIPE, EP_TYPE_ISOCHRONOUS, PIPE_TOKEN_IN,
 | 
			
		||||
	                   DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_DOUBLE);
 | 
			
		||||
 | 
			
		||||
	/* Valid data found, return success */
 | 
			
		||||
	return SuccessfulConfigRead;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t DComp_NextAudioControlInterface(void* CurrentDescriptor)
 | 
			
		||||
{
 | 
			
		||||
	USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
 | 
			
		||||
 | 
			
		||||
	if (Header->Type == DTYPE_Interface)
 | 
			
		||||
	{
 | 
			
		||||
		USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
 | 
			
		||||
 | 
			
		||||
		if ((Interface->Class    == AUDIO_CSCP_AudioClass) &&
 | 
			
		||||
		    (Interface->SubClass == AUDIO_CSCP_ControlSubclass) &&
 | 
			
		||||
		    (Interface->Protocol == AUDIO_CSCP_ControlProtocol))
 | 
			
		||||
		{
 | 
			
		||||
			return DESCRIPTOR_SEARCH_Found;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return DESCRIPTOR_SEARCH_NotFound;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t DComp_NextAudioStreamInterface(void* CurrentDescriptor)
 | 
			
		||||
{
 | 
			
		||||
	USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
 | 
			
		||||
 | 
			
		||||
	if (Header->Type == DTYPE_Interface)
 | 
			
		||||
	{
 | 
			
		||||
		USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
 | 
			
		||||
 | 
			
		||||
		if ((Interface->Class    == AUDIO_CSCP_AudioClass) &&
 | 
			
		||||
		    (Interface->SubClass == AUDIO_CSCP_AudioStreamingSubclass) &&
 | 
			
		||||
		    (Interface->Protocol == AUDIO_CSCP_StreamingProtocol))
 | 
			
		||||
		{
 | 
			
		||||
			return DESCRIPTOR_SEARCH_Found;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return DESCRIPTOR_SEARCH_NotFound;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor)
 | 
			
		||||
{
 | 
			
		||||
	USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
 | 
			
		||||
 | 
			
		||||
	if (Header->Type == DTYPE_Endpoint)
 | 
			
		||||
	{
 | 
			
		||||
		USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
 | 
			
		||||
 | 
			
		||||
		if ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_ISOCHRONOUS)
 | 
			
		||||
		  return DESCRIPTOR_SEARCH_Found;
 | 
			
		||||
	}
 | 
			
		||||
	else if (Header->Type == DTYPE_Interface)
 | 
			
		||||
	{
 | 
			
		||||
		return DESCRIPTOR_SEARCH_Fail;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return DESCRIPTOR_SEARCH_NotFound;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										72
									
								
								Demos/Host/Incomplete/AudioInputHost/ConfigDescriptor.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								Demos/Host/Incomplete/AudioInputHost/ConfigDescriptor.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,72 @@
 | 
			
		||||
/*
 | 
			
		||||
             LUFA Library
 | 
			
		||||
     Copyright (C) Dean Camera, 2011.
 | 
			
		||||
 | 
			
		||||
  dean [at] fourwalledcubicle [dot] com
 | 
			
		||||
           www.lufa-lib.org
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 | 
			
		||||
 | 
			
		||||
  Permission to use, copy, modify, distribute, and sell this
 | 
			
		||||
  software and its documentation for any purpose is hereby granted
 | 
			
		||||
  without fee, provided that the above copyright notice appear in
 | 
			
		||||
  all copies and that both that the copyright notice and this
 | 
			
		||||
  permission notice and warranty disclaimer appear in supporting
 | 
			
		||||
  documentation, and that the name of the author not be used in
 | 
			
		||||
  advertising or publicity pertaining to distribution of the
 | 
			
		||||
  software without specific, written prior permission.
 | 
			
		||||
 | 
			
		||||
  The author disclaim all warranties with regard to this
 | 
			
		||||
  software, including all implied warranties of merchantability
 | 
			
		||||
  and fitness.  In no event shall the author be liable for any
 | 
			
		||||
  special, indirect or consequential damages or any damages
 | 
			
		||||
  whatsoever resulting from loss of use, data or profits, whether
 | 
			
		||||
  in an action of contract, negligence or other tortious action,
 | 
			
		||||
  arising out of or in connection with the use or performance of
 | 
			
		||||
  this software.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/** \file
 | 
			
		||||
 *
 | 
			
		||||
 *  Header file for ConfigDescriptor.c.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _CONFIGDESCRIPTOR_H_
 | 
			
		||||
#define _CONFIGDESCRIPTOR_H_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <LUFA/Drivers/USB/USB.h>
 | 
			
		||||
 | 
			
		||||
		#include "AudioInputHost.h"
 | 
			
		||||
 | 
			
		||||
	/* Macros: */
 | 
			
		||||
		/** Pipe number for the Audio data IN pipe. */
 | 
			
		||||
		#define AUDIO_DATA_IN_PIPE          1
 | 
			
		||||
 | 
			
		||||
	/* Enums: */
 | 
			
		||||
		/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */
 | 
			
		||||
		enum KeyboardHost_GetConfigDescriptorDataCodes_t
 | 
			
		||||
		{
 | 
			
		||||
			SuccessfulConfigRead            = 0, /**< Configuration Descriptor was processed successfully */
 | 
			
		||||
			ControlError                    = 1, /**< A control request to the device failed to complete successfully */
 | 
			
		||||
			DescriptorTooLarge              = 2, /**< The device's Configuration Descriptor is too large to process */
 | 
			
		||||
			InvalidConfigDataReturned       = 3, /**< The device returned an invalid Configuration Descriptor */
 | 
			
		||||
			NoCompatibleInterfaceFound      = 4, /**< A compatible interface with the required endpoints was not found */
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
	/* External Variables: */
 | 
			
		||||
		extern uint8_t StreamingInterfaceIndex;
 | 
			
		||||
		extern uint8_t StreamingInterfaceAltSetting;
 | 
			
		||||
		extern uint8_t StreamingEndpointAddress;
 | 
			
		||||
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
		uint8_t ProcessConfigurationDescriptor(void);
 | 
			
		||||
 | 
			
		||||
		uint8_t DComp_NextAudioControlInterface(void* CurrentDescriptor);
 | 
			
		||||
		uint8_t DComp_NextAudioStreamInterface(void* CurrentDescriptor);
 | 
			
		||||
		uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										400
									
								
								Demos/Host/Incomplete/AudioInputHost/ConfigDescriptor.lst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										400
									
								
								Demos/Host/Incomplete/AudioInputHost/ConfigDescriptor.lst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,400 @@
 | 
			
		||||
   1               		.file	"ConfigDescriptor.c"
 | 
			
		||||
   2               	__SREG__ = 0x3f
 | 
			
		||||
   3               	__SP_H__ = 0x3e
 | 
			
		||||
   4               	__SP_L__ = 0x3d
 | 
			
		||||
   5               	__CCP__ = 0x34
 | 
			
		||||
   6               	__tmp_reg__ = 0
 | 
			
		||||
   7               	__zero_reg__ = 1
 | 
			
		||||
  15               	.Ltext0:
 | 
			
		||||
  16               		.section	.text.DComp_NextAudioControlInterface,"ax",@progbits
 | 
			
		||||
  17               	.global	DComp_NextAudioControlInterface
 | 
			
		||||
  19               	DComp_NextAudioControlInterface:
 | 
			
		||||
  20               	.LFB132:
 | 
			
		||||
  21               	.LSM0:
 | 
			
		||||
  22               	.LVL0:
 | 
			
		||||
  23               	/* prologue: function */
 | 
			
		||||
  24               	/* frame size = 0 */
 | 
			
		||||
  25               	/* stack size = 0 */
 | 
			
		||||
  26               	.L__stack_usage = 0
 | 
			
		||||
  27 0000 FC01      		movw r30,r24
 | 
			
		||||
  28               	.LVL1:
 | 
			
		||||
  29               	.LSM1:
 | 
			
		||||
  30 0002 8181      		ldd r24,Z+1
 | 
			
		||||
  31               	.LVL2:
 | 
			
		||||
  32 0004 8430      		cpi r24,lo8(4)
 | 
			
		||||
  33 0006 01F4      		brne .L5
 | 
			
		||||
  34               	.LVL3:
 | 
			
		||||
  35               	.LBB2:
 | 
			
		||||
  36               	.LSM2:
 | 
			
		||||
  37 0008 8581      		ldd r24,Z+5
 | 
			
		||||
  38 000a 8130      		cpi r24,lo8(1)
 | 
			
		||||
  39 000c 01F4      		brne .L5
 | 
			
		||||
  40               	.LSM3:
 | 
			
		||||
  41 000e 8681      		ldd r24,Z+6
 | 
			
		||||
  42 0010 8130      		cpi r24,lo8(1)
 | 
			
		||||
  43 0012 01F4      		brne .L5
 | 
			
		||||
  44               	.LSM4:
 | 
			
		||||
  45 0014 8781      		ldd r24,Z+7
 | 
			
		||||
  46 0016 8823      		tst r24
 | 
			
		||||
  47 0018 01F0      		breq .L6
 | 
			
		||||
  48               	.LVL4:
 | 
			
		||||
  49               	.L5:
 | 
			
		||||
  50               	.LSM5:
 | 
			
		||||
  51 001a 82E0      		ldi r24,lo8(2)
 | 
			
		||||
  52 001c 0895      		ret
 | 
			
		||||
  53               	.LVL5:
 | 
			
		||||
  54               	.L6:
 | 
			
		||||
  55               	.LSM6:
 | 
			
		||||
  56 001e 80E0      		ldi r24,lo8(0)
 | 
			
		||||
  57               	.LBE2:
 | 
			
		||||
  58               	.LSM7:
 | 
			
		||||
  59 0020 0895      		ret
 | 
			
		||||
  60               	.LFE132:
 | 
			
		||||
  62               		.section	.text.DComp_NextAudioStreamInterface,"ax",@progbits
 | 
			
		||||
  63               	.global	DComp_NextAudioStreamInterface
 | 
			
		||||
  65               	DComp_NextAudioStreamInterface:
 | 
			
		||||
  66               	.LFB133:
 | 
			
		||||
  67               	.LSM8:
 | 
			
		||||
  68               	.LVL6:
 | 
			
		||||
  69               	/* prologue: function */
 | 
			
		||||
  70               	/* frame size = 0 */
 | 
			
		||||
  71               	/* stack size = 0 */
 | 
			
		||||
  72               	.L__stack_usage = 0
 | 
			
		||||
  73 0000 FC01      		movw r30,r24
 | 
			
		||||
  74               	.LVL7:
 | 
			
		||||
  75               	.LSM9:
 | 
			
		||||
  76 0002 8181      		ldd r24,Z+1
 | 
			
		||||
  77               	.LVL8:
 | 
			
		||||
  78 0004 8430      		cpi r24,lo8(4)
 | 
			
		||||
  79 0006 01F4      		brne .L11
 | 
			
		||||
  80               	.LVL9:
 | 
			
		||||
  81               	.LBB3:
 | 
			
		||||
  82               	.LSM10:
 | 
			
		||||
  83 0008 8581      		ldd r24,Z+5
 | 
			
		||||
  84 000a 8130      		cpi r24,lo8(1)
 | 
			
		||||
  85 000c 01F4      		brne .L11
 | 
			
		||||
  86               	.LSM11:
 | 
			
		||||
  87 000e 8681      		ldd r24,Z+6
 | 
			
		||||
  88 0010 8230      		cpi r24,lo8(2)
 | 
			
		||||
  89 0012 01F4      		brne .L11
 | 
			
		||||
  90               	.LSM12:
 | 
			
		||||
  91 0014 8781      		ldd r24,Z+7
 | 
			
		||||
  92 0016 8823      		tst r24
 | 
			
		||||
  93 0018 01F0      		breq .L12
 | 
			
		||||
  94               	.LVL10:
 | 
			
		||||
  95               	.L11:
 | 
			
		||||
  96               	.LSM13:
 | 
			
		||||
  97 001a 82E0      		ldi r24,lo8(2)
 | 
			
		||||
  98 001c 0895      		ret
 | 
			
		||||
  99               	.LVL11:
 | 
			
		||||
 100               	.L12:
 | 
			
		||||
 101               	.LSM14:
 | 
			
		||||
 102 001e 80E0      		ldi r24,lo8(0)
 | 
			
		||||
 103               	.LBE3:
 | 
			
		||||
 104               	.LSM15:
 | 
			
		||||
 105 0020 0895      		ret
 | 
			
		||||
 106               	.LFE133:
 | 
			
		||||
 108               		.section	.text.DComp_NextAudioInterfaceDataEndpoint,"ax",@progbits
 | 
			
		||||
 109               	.global	DComp_NextAudioInterfaceDataEndpoint
 | 
			
		||||
 111               	DComp_NextAudioInterfaceDataEndpoint:
 | 
			
		||||
 112               	.LFB134:
 | 
			
		||||
 113               	.LSM16:
 | 
			
		||||
 114               	.LVL12:
 | 
			
		||||
 115               	/* prologue: function */
 | 
			
		||||
 116               	/* frame size = 0 */
 | 
			
		||||
 117               	/* stack size = 0 */
 | 
			
		||||
 118               	.L__stack_usage = 0
 | 
			
		||||
 119 0000 FC01      		movw r30,r24
 | 
			
		||||
 120               	.LVL13:
 | 
			
		||||
 121               	.LSM17:
 | 
			
		||||
 122 0002 8181      		ldd r24,Z+1
 | 
			
		||||
 123               	.LVL14:
 | 
			
		||||
 124 0004 8530      		cpi r24,lo8(5)
 | 
			
		||||
 125 0006 01F4      		brne .L14
 | 
			
		||||
 126               	.LVL15:
 | 
			
		||||
 127               	.LBB4:
 | 
			
		||||
 128               	.LSM18:
 | 
			
		||||
 129 0008 8381      		ldd r24,Z+3
 | 
			
		||||
 130 000a 8370      		andi r24,lo8(3)
 | 
			
		||||
 131 000c 8130      		cpi r24,lo8(1)
 | 
			
		||||
 132 000e 01F4      		brne .L18
 | 
			
		||||
 133 0010 00C0      		rjmp .L16
 | 
			
		||||
 134               	.LVL16:
 | 
			
		||||
 135               	.L14:
 | 
			
		||||
 136               	.LBE4:
 | 
			
		||||
 137               	.LSM19:
 | 
			
		||||
 138 0012 8430      		cpi r24,lo8(4)
 | 
			
		||||
 139 0014 01F0      		breq .L17
 | 
			
		||||
 140               	.L18:
 | 
			
		||||
 141               	.LSM20:
 | 
			
		||||
 142 0016 82E0      		ldi r24,lo8(2)
 | 
			
		||||
 143 0018 0895      		ret
 | 
			
		||||
 144               	.LVL17:
 | 
			
		||||
 145               	.L16:
 | 
			
		||||
 146               	.LBB5:
 | 
			
		||||
 147               	.LSM21:
 | 
			
		||||
 148 001a 80E0      		ldi r24,lo8(0)
 | 
			
		||||
 149 001c 0895      		ret
 | 
			
		||||
 150               	.LVL18:
 | 
			
		||||
 151               	.L17:
 | 
			
		||||
 152               	.LBE5:
 | 
			
		||||
 153               	.LSM22:
 | 
			
		||||
 154 001e 81E0      		ldi r24,lo8(1)
 | 
			
		||||
 155               	.LSM23:
 | 
			
		||||
 156 0020 0895      		ret
 | 
			
		||||
 157               	.LFE134:
 | 
			
		||||
 159               		.section	.text.ProcessConfigurationDescriptor,"ax",@progbits
 | 
			
		||||
 160               	.global	ProcessConfigurationDescriptor
 | 
			
		||||
 162               	ProcessConfigurationDescriptor:
 | 
			
		||||
 163               	.LFB131:
 | 
			
		||||
 164               	.LSM24:
 | 
			
		||||
 165 0000 AF92      		push r10
 | 
			
		||||
 166 0002 BF92      		push r11
 | 
			
		||||
 167 0004 CF92      		push r12
 | 
			
		||||
 168 0006 DF92      		push r13
 | 
			
		||||
 169 0008 EF92      		push r14
 | 
			
		||||
 170 000a FF92      		push r15
 | 
			
		||||
 171 000c 0F93      		push r16
 | 
			
		||||
 172 000e 1F93      		push r17
 | 
			
		||||
 173 0010 DF93      		push r29
 | 
			
		||||
 174 0012 CF93      		push r28
 | 
			
		||||
 175 0014 CDB7      		in r28,__SP_L__
 | 
			
		||||
 176 0016 DEB7      		in r29,__SP_H__
 | 
			
		||||
 177 0018 C450      		subi r28,lo8(-(-516))
 | 
			
		||||
 178 001a D240      		sbci r29,hi8(-(-516))
 | 
			
		||||
 179 001c 0FB6      		in __tmp_reg__,__SREG__
 | 
			
		||||
 180 001e F894      		cli
 | 
			
		||||
 181 0020 DEBF      		out __SP_H__,r29
 | 
			
		||||
 182 0022 0FBE      		out __SREG__,__tmp_reg__
 | 
			
		||||
 183 0024 CDBF      		out __SP_L__,r28
 | 
			
		||||
 184               	/* prologue: function */
 | 
			
		||||
 185               	/* frame size = 516 */
 | 
			
		||||
 186               	/* stack size = 526 */
 | 
			
		||||
 187               	.L__stack_usage = 526
 | 
			
		||||
 188               	.LSM25:
 | 
			
		||||
 189 0026 AE01      		movw r20,r28
 | 
			
		||||
 190 0028 4B5F      		subi r20,lo8(-(5))
 | 
			
		||||
 191 002a 5F4F      		sbci r21,hi8(-(5))
 | 
			
		||||
 192 002c 5A83      		std Y+2,r21
 | 
			
		||||
 193 002e 4983      		std Y+1,r20
 | 
			
		||||
 194               	.LVL19:
 | 
			
		||||
 195               	.LSM26:
 | 
			
		||||
 196 0030 23E0      		ldi r18,lo8(3)
 | 
			
		||||
 197 0032 E22E      		mov r14,r18
 | 
			
		||||
 198 0034 F12C      		mov r15,__zero_reg__
 | 
			
		||||
 199 0036 EC0E      		add r14,r28
 | 
			
		||||
 200 0038 FD1E      		adc r15,r29
 | 
			
		||||
 201 003a 81E0      		ldi r24,lo8(1)
 | 
			
		||||
 202 003c B701      		movw r22,r14
 | 
			
		||||
 203 003e 20E0      		ldi r18,lo8(512)
 | 
			
		||||
 204 0040 32E0      		ldi r19,hi8(512)
 | 
			
		||||
 205 0042 0E94 0000 		call USB_Host_GetDeviceConfigDescriptor
 | 
			
		||||
 206 0046 8530      		cpi r24,lo8(5)
 | 
			
		||||
 207 0048 01F4      		brne .+2
 | 
			
		||||
 208 004a 00C0      		rjmp .L31
 | 
			
		||||
 209 004c 8630      		cpi r24,lo8(6)
 | 
			
		||||
 210 004e 01F0      		breq .L23
 | 
			
		||||
 211 0050 8823      		tst r24
 | 
			
		||||
 212 0052 01F4      		brne .L34
 | 
			
		||||
 213 0054 00E0      		ldi r16,lo8(0)
 | 
			
		||||
 214 0056 10E0      		ldi r17,hi8(0)
 | 
			
		||||
 215 0058 CC24      		clr r12
 | 
			
		||||
 216 005a DD24      		clr r13
 | 
			
		||||
 217 005c 5701      		movw r10,r14
 | 
			
		||||
 218 005e 7E01      		movw r14,r28
 | 
			
		||||
 219 0060 0894      		sec
 | 
			
		||||
 220 0062 E11C      		adc r14,__zero_reg__
 | 
			
		||||
 221 0064 F11C      		adc r15,__zero_reg__
 | 
			
		||||
 222 0066 00C0      		rjmp .L24
 | 
			
		||||
 223               	.L23:
 | 
			
		||||
 224               	.LSM27:
 | 
			
		||||
 225 0068 83E0      		ldi r24,lo8(3)
 | 
			
		||||
 226 006a 00C0      		rjmp .L22
 | 
			
		||||
 227               	.L34:
 | 
			
		||||
 228               	.LSM28:
 | 
			
		||||
 229 006c 81E0      		ldi r24,lo8(1)
 | 
			
		||||
 230 006e 00C0      		rjmp .L22
 | 
			
		||||
 231               	.LVL20:
 | 
			
		||||
 232               	.L30:
 | 
			
		||||
 233               	.LSM29:
 | 
			
		||||
 234 0070 9C01      		movw r18,r24
 | 
			
		||||
 235 0072 032F      		mov r16,r19
 | 
			
		||||
 236 0074 182F      		mov r17,r24
 | 
			
		||||
 237               	.LVL21:
 | 
			
		||||
 238               	.L24:
 | 
			
		||||
 239               	.LBB6:
 | 
			
		||||
 240               	.LSM30:
 | 
			
		||||
 241 0076 C114      		cp r12,__zero_reg__
 | 
			
		||||
 242 0078 D104      		cpc r13,__zero_reg__
 | 
			
		||||
 243 007a 01F0      		breq .L25
 | 
			
		||||
 244               	.LSM31:
 | 
			
		||||
 245 007c C501      		movw r24,r10
 | 
			
		||||
 246 007e B701      		movw r22,r14
 | 
			
		||||
 247 0080 40E0      		ldi r20,lo8(gs(DComp_NextAudioInterfaceDataEndpoint))
 | 
			
		||||
 248 0082 50E0      		ldi r21,hi8(gs(DComp_NextAudioInterfaceDataEndpoint))
 | 
			
		||||
 249 0084 0E94 0000 		call USB_GetNextDescriptorComp
 | 
			
		||||
 250               	.LSM32:
 | 
			
		||||
 251 0088 8823      		tst r24
 | 
			
		||||
 252 008a 01F4      		brne .L26
 | 
			
		||||
 253 008c 00C0      		rjmp .L36
 | 
			
		||||
 254               	.L25:
 | 
			
		||||
 255               	.LSM33:
 | 
			
		||||
 256 008e C501      		movw r24,r10
 | 
			
		||||
 257 0090 B701      		movw r22,r14
 | 
			
		||||
 258 0092 40E0      		ldi r20,lo8(gs(DComp_NextAudioControlInterface))
 | 
			
		||||
 259 0094 50E0      		ldi r21,hi8(gs(DComp_NextAudioControlInterface))
 | 
			
		||||
 260 0096 0E94 0000 		call USB_GetNextDescriptorComp
 | 
			
		||||
 261 009a 8823      		tst r24
 | 
			
		||||
 262 009c 01F4      		brne .L33
 | 
			
		||||
 263               	.LSM34:
 | 
			
		||||
 264 009e C980      		ldd r12,Y+1
 | 
			
		||||
 265 00a0 DA80      		ldd r13,Y+2
 | 
			
		||||
 266               	.LVL22:
 | 
			
		||||
 267               	.L26:
 | 
			
		||||
 268               	.LSM35:
 | 
			
		||||
 269 00a2 C501      		movw r24,r10
 | 
			
		||||
 270 00a4 B701      		movw r22,r14
 | 
			
		||||
 271 00a6 40E0      		ldi r20,lo8(gs(DComp_NextAudioStreamInterface))
 | 
			
		||||
 272 00a8 50E0      		ldi r21,hi8(gs(DComp_NextAudioStreamInterface))
 | 
			
		||||
 273 00aa 0E94 0000 		call USB_GetNextDescriptorComp
 | 
			
		||||
 274 00ae 8823      		tst r24
 | 
			
		||||
 275 00b0 01F0      		breq .L28
 | 
			
		||||
 276               	.LSM36:
 | 
			
		||||
 277 00b2 C501      		movw r24,r10
 | 
			
		||||
 278 00b4 B701      		movw r22,r14
 | 
			
		||||
 279 00b6 40E0      		ldi r20,lo8(gs(DComp_NextAudioControlInterface))
 | 
			
		||||
 280 00b8 50E0      		ldi r21,hi8(gs(DComp_NextAudioControlInterface))
 | 
			
		||||
 281 00ba 0E94 0000 		call USB_GetNextDescriptorComp
 | 
			
		||||
 282 00be 8823      		tst r24
 | 
			
		||||
 283 00c0 01F4      		brne .L33
 | 
			
		||||
 284               	.LSM37:
 | 
			
		||||
 285 00c2 C980      		ldd r12,Y+1
 | 
			
		||||
 286 00c4 DA80      		ldd r13,Y+2
 | 
			
		||||
 287               	.LVL23:
 | 
			
		||||
 288               	.L28:
 | 
			
		||||
 289               	.LSM38:
 | 
			
		||||
 290 00c6 0981      		ldd r16,Y+1
 | 
			
		||||
 291 00c8 1A81      		ldd r17,Y+2
 | 
			
		||||
 292               	.LVL24:
 | 
			
		||||
 293               	.LSM39:
 | 
			
		||||
 294 00ca 00C0      		rjmp .L29
 | 
			
		||||
 295               	.LVL25:
 | 
			
		||||
 296               	.L36:
 | 
			
		||||
 297               	.LSM40:
 | 
			
		||||
 298 00cc E981      		ldd r30,Y+1
 | 
			
		||||
 299 00ce FA81      		ldd r31,Y+2
 | 
			
		||||
 300               	.LVL26:
 | 
			
		||||
 301               	.LSM41:
 | 
			
		||||
 302 00d0 8281      		ldd r24,Z+2
 | 
			
		||||
 303 00d2 87FF      		sbrs r24,7
 | 
			
		||||
 304 00d4 00C0      		rjmp .L29
 | 
			
		||||
 305               	.LSM42:
 | 
			
		||||
 306 00d6 902F      		mov r25,r16
 | 
			
		||||
 307 00d8 812F      		mov r24,r17
 | 
			
		||||
 308               	.LVL27:
 | 
			
		||||
 309               	.LBE6:
 | 
			
		||||
 310               	.LSM43:
 | 
			
		||||
 311 00da 3097      		sbiw r30,0
 | 
			
		||||
 312 00dc 01F0      		breq .L30
 | 
			
		||||
 313               	.LSM44:
 | 
			
		||||
 314 00de D801      		movw r26,r16
 | 
			
		||||
 315 00e0 1296      		adiw r26,2
 | 
			
		||||
 316 00e2 8C91      		ld r24,X
 | 
			
		||||
 317 00e4 1297      		sbiw r26,2
 | 
			
		||||
 318 00e6 8093 0000 		sts StreamingInterfaceIndex,r24
 | 
			
		||||
 319               	.LSM45:
 | 
			
		||||
 320 00ea 1396      		adiw r26,3
 | 
			
		||||
 321 00ec 8C91      		ld r24,X
 | 
			
		||||
 322 00ee 8093 0000 		sts StreamingInterfaceAltSetting,r24
 | 
			
		||||
 323               	.LSM46:
 | 
			
		||||
 324 00f2 2281      		ldd r18,Z+2
 | 
			
		||||
 325 00f4 2093 0000 		sts StreamingEndpointAddress,r18
 | 
			
		||||
 326               	.LSM47:
 | 
			
		||||
 327 00f8 0481      		ldd r16,Z+4
 | 
			
		||||
 328 00fa 1581      		ldd r17,Z+5
 | 
			
		||||
 329               	.LVL28:
 | 
			
		||||
 330 00fc 81E0      		ldi r24,lo8(1)
 | 
			
		||||
 331 00fe 61E0      		ldi r22,lo8(1)
 | 
			
		||||
 332 0100 40E1      		ldi r20,lo8(16)
 | 
			
		||||
 333 0102 94E0      		ldi r25,lo8(4)
 | 
			
		||||
 334 0104 E92E      		mov r14,r25
 | 
			
		||||
 335               	.LVL29:
 | 
			
		||||
 336 0106 0E94 0000 		call Pipe_ConfigurePipe
 | 
			
		||||
 337               	.LVL30:
 | 
			
		||||
 338               	.LSM48:
 | 
			
		||||
 339 010a 80E0      		ldi r24,lo8(0)
 | 
			
		||||
 340 010c 00C0      		rjmp .L22
 | 
			
		||||
 341               	.LVL31:
 | 
			
		||||
 342               	.L31:
 | 
			
		||||
 343               	.LSM49:
 | 
			
		||||
 344 010e 82E0      		ldi r24,lo8(2)
 | 
			
		||||
 345 0110 00C0      		rjmp .L22
 | 
			
		||||
 346               	.LVL32:
 | 
			
		||||
 347               	.L33:
 | 
			
		||||
 348               	.LBB7:
 | 
			
		||||
 349               	.LSM50:
 | 
			
		||||
 350 0112 84E0      		ldi r24,lo8(4)
 | 
			
		||||
 351               	.L22:
 | 
			
		||||
 352               	/* epilogue start */
 | 
			
		||||
 353               	.LBE7:
 | 
			
		||||
 354               	.LSM51:
 | 
			
		||||
 355 0114 CC5F      		subi r28,lo8(-(516))
 | 
			
		||||
 356 0116 DD4F      		sbci r29,hi8(-(516))
 | 
			
		||||
 357 0118 0FB6      		in __tmp_reg__,__SREG__
 | 
			
		||||
 358 011a F894      		cli
 | 
			
		||||
 359 011c DEBF      		out __SP_H__,r29
 | 
			
		||||
 360 011e 0FBE      		out __SREG__,__tmp_reg__
 | 
			
		||||
 361 0120 CDBF      		out __SP_L__,r28
 | 
			
		||||
 362 0122 CF91      		pop r28
 | 
			
		||||
 363 0124 DF91      		pop r29
 | 
			
		||||
 364 0126 1F91      		pop r17
 | 
			
		||||
 365 0128 0F91      		pop r16
 | 
			
		||||
 366 012a FF90      		pop r15
 | 
			
		||||
 367 012c EF90      		pop r14
 | 
			
		||||
 368 012e DF90      		pop r13
 | 
			
		||||
 369 0130 CF90      		pop r12
 | 
			
		||||
 370 0132 BF90      		pop r11
 | 
			
		||||
 371 0134 AF90      		pop r10
 | 
			
		||||
 372 0136 0895      		ret
 | 
			
		||||
 373               	.L29:
 | 
			
		||||
 374               	.LVL33:
 | 
			
		||||
 375               	.LSM52:
 | 
			
		||||
 376 0138 902F      		mov r25,r16
 | 
			
		||||
 377 013a 812F      		mov r24,r17
 | 
			
		||||
 378 013c 00C0      		rjmp .L30
 | 
			
		||||
 379               	.LFE131:
 | 
			
		||||
 381               	.global	StreamingInterfaceIndex
 | 
			
		||||
 382               	.global	StreamingInterfaceIndex
 | 
			
		||||
 383               		.section .bss
 | 
			
		||||
 386               	StreamingInterfaceIndex:
 | 
			
		||||
 387 0000 00        		.skip 1,0
 | 
			
		||||
 388               	.global	StreamingInterfaceAltSetting
 | 
			
		||||
 389               	.global	StreamingInterfaceAltSetting
 | 
			
		||||
 392               	StreamingInterfaceAltSetting:
 | 
			
		||||
 393 0001 00        		.skip 1,0
 | 
			
		||||
 394               	.global	StreamingEndpointAddress
 | 
			
		||||
 395               	.global	StreamingEndpointAddress
 | 
			
		||||
 398               	StreamingEndpointAddress:
 | 
			
		||||
 399 0002 00        		.skip 1,0
 | 
			
		||||
 448               	.Letext0:
 | 
			
		||||
DEFINED SYMBOLS
 | 
			
		||||
                            *ABS*:00000000 ConfigDescriptor.c
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:2      *ABS*:0000003f __SREG__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:3      *ABS*:0000003e __SP_H__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:4      *ABS*:0000003d __SP_L__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:5      *ABS*:00000034 __CCP__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:6      *ABS*:00000000 __tmp_reg__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:7      *ABS*:00000001 __zero_reg__
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:19     .text.DComp_NextAudioControlInterface:00000000 DComp_NextAudioControlInterface
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:65     .text.DComp_NextAudioStreamInterface:00000000 DComp_NextAudioStreamInterface
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:111    .text.DComp_NextAudioInterfaceDataEndpoint:00000000 DComp_NextAudioInterfaceDataEndpoint
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:162    .text.ProcessConfigurationDescriptor:00000000 ProcessConfigurationDescriptor
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:386    .bss:00000000 StreamingInterfaceIndex
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:392    .bss:00000001 StreamingInterfaceAltSetting
 | 
			
		||||
C:\Users\Dean\AppData\Local\Temp\cc2CU2Sj.s:398    .bss:00000002 StreamingEndpointAddress
 | 
			
		||||
 | 
			
		||||
UNDEFINED SYMBOLS
 | 
			
		||||
USB_Host_GetDeviceConfigDescriptor
 | 
			
		||||
USB_GetNextDescriptorComp
 | 
			
		||||
Pipe_ConfigurePipe
 | 
			
		||||
__do_clear_bss
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Demos/Host/Incomplete/AudioInputHost/ConfigDescriptor.o
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Demos/Host/Incomplete/AudioInputHost/ConfigDescriptor.o
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										714
									
								
								Demos/Host/Incomplete/AudioInputHost/makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										714
									
								
								Demos/Host/Incomplete/AudioInputHost/makefile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,714 @@
 | 
			
		||||
# Hey Emacs, this is a -*- makefile -*-
 | 
			
		||||
#----------------------------------------------------------------------------
 | 
			
		||||
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
 | 
			
		||||
#  >> Modified for use with the LUFA project. <<
 | 
			
		||||
#
 | 
			
		||||
# Released to the Public Domain
 | 
			
		||||
#
 | 
			
		||||
# Additional material for this makefile was written by:
 | 
			
		||||
# Peter Fleury
 | 
			
		||||
# Tim Henigan
 | 
			
		||||
# Colin O'Flynn
 | 
			
		||||
# Reiner Patommel
 | 
			
		||||
# Markus Pfaff
 | 
			
		||||
# Sander Pool
 | 
			
		||||
# Frederik Rouleau
 | 
			
		||||
# Carlos Lamas
 | 
			
		||||
# Dean Camera
 | 
			
		||||
# Opendous Inc.
 | 
			
		||||
# Denver Gingerich
 | 
			
		||||
#
 | 
			
		||||
#----------------------------------------------------------------------------
 | 
			
		||||
# On command line:
 | 
			
		||||
#
 | 
			
		||||
# make all = Make software.
 | 
			
		||||
#
 | 
			
		||||
# make clean = Clean out built project files.
 | 
			
		||||
#
 | 
			
		||||
# make coff = Convert ELF to AVR COFF.
 | 
			
		||||
#
 | 
			
		||||
# make extcoff = Convert ELF to AVR Extended COFF.
 | 
			
		||||
#
 | 
			
		||||
# make program = Download the hex file to the device, using avrdude.
 | 
			
		||||
#                Please customize the avrdude settings below first!
 | 
			
		||||
#
 | 
			
		||||
# make dfu = Download the hex file to the device, using dfu-programmer (must
 | 
			
		||||
#            have dfu-programmer installed).
 | 
			
		||||
#
 | 
			
		||||
# make flip = Download the hex file to the device, using Atmel FLIP (must
 | 
			
		||||
#             have Atmel FLIP installed).
 | 
			
		||||
#
 | 
			
		||||
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
 | 
			
		||||
#               (must have dfu-programmer installed).
 | 
			
		||||
#
 | 
			
		||||
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
 | 
			
		||||
#                (must have Atmel FLIP installed).
 | 
			
		||||
#
 | 
			
		||||
# make doxygen = Generate DoxyGen documentation for the project (must have
 | 
			
		||||
#                DoxyGen installed)
 | 
			
		||||
#
 | 
			
		||||
# 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.
 | 
			
		||||
#
 | 
			
		||||
# make filename.i = Create a preprocessed source file for use in submitting
 | 
			
		||||
#                   bug reports to the GCC project.
 | 
			
		||||
#
 | 
			
		||||
# To rebuild project do "make clean" then "make all".
 | 
			
		||||
#----------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# MCU name
 | 
			
		||||
MCU = at90usb1287
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Target architecture (see library "Board Types" documentation).
 | 
			
		||||
ARCH = AVR8
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# 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
 | 
			
		||||
# "Board" inside the application directory.
 | 
			
		||||
BOARD = USBKEY
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# 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
 | 
			
		||||
#     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.
 | 
			
		||||
#
 | 
			
		||||
#     This will be an integer division of F_USB below, as it is sourced by
 | 
			
		||||
#     F_USB after it has run through any CPU prescalers. Note that this value
 | 
			
		||||
#     does not *change* the processor frequency - it should merely be updated to
 | 
			
		||||
#     reflect the processor speed set externally so that the code can use accurate
 | 
			
		||||
#     software delays.
 | 
			
		||||
F_CPU = 8000000
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Input clock frequency.
 | 
			
		||||
#     This will define a symbol, F_USB, 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
 | 
			
		||||
#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
 | 
			
		||||
#     at the end, this will be done automatically to create a 32-bit value in your
 | 
			
		||||
#     source code.
 | 
			
		||||
#
 | 
			
		||||
#     If no clock division is performed on the input clock inside the AVR (via the
 | 
			
		||||
#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
 | 
			
		||||
F_USB = $(F_CPU)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Output format. (can be srec, ihex, binary)
 | 
			
		||||
FORMAT = ihex
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Target file name (without extension).
 | 
			
		||||
TARGET = AudioInputHost
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Object files directory
 | 
			
		||||
#     To put object files in current directory, use a dot (.), do NOT make
 | 
			
		||||
#     this an empty or blank macro!
 | 
			
		||||
OBJDIR = .
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Path to the LUFA library
 | 
			
		||||
LUFA_PATH = ../../../..
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# LUFA library compile-time options and predefined tokens
 | 
			
		||||
LUFA_OPTS  = -D USB_HOST_ONLY
 | 
			
		||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Create the LUFA source path variables by including the LUFA root makefile
 | 
			
		||||
include $(LUFA_PATH)/LUFA/makefile
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# List C source files here. (C dependencies are automatically generated.)
 | 
			
		||||
SRC = $(TARGET).c                                                 \
 | 
			
		||||
	  ConfigDescriptor.c                                          \
 | 
			
		||||
	  $(LUFA_SRC_USB)                                             \
 | 
			
		||||
	  $(LUFA_SRC_SERIAL)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# List C++ source files here. (C dependencies are automatically generated.)
 | 
			
		||||
CPPSRC =
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# List Assembler source files here.
 | 
			
		||||
#     Make them always end in a capital .S.  Files ending in a lowercase .s
 | 
			
		||||
#     will not be considered source files but generated files (assembler
 | 
			
		||||
#     output from the compiler), and will be deleted upon "make clean"!
 | 
			
		||||
#     Even though the DOS/Win* filesystem matches both .s and .S the same,
 | 
			
		||||
#     it will preserve the spelling of the filenames, and gcc itself does
 | 
			
		||||
#     care about how the name is spelled on its command-line.
 | 
			
		||||
ASRC =
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# 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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Debugging format.
 | 
			
		||||
#     Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
 | 
			
		||||
#     AVR Studio 4.10 requires dwarf-2.
 | 
			
		||||
#     AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
 | 
			
		||||
DEBUG = dwarf-2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# List any extra directories to look for include files here.
 | 
			
		||||
#     Each directory must be seperated by a space.
 | 
			
		||||
#     Use forward slashes for directory separators.
 | 
			
		||||
#     For a directory that has spaces, enclose it in quotes.
 | 
			
		||||
EXTRAINCDIRS = $(LUFA_PATH)/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Compiler flag to set the C Standard level.
 | 
			
		||||
#     c89   = "ANSI" C
 | 
			
		||||
#     gnu89 = c89 plus GCC extensions
 | 
			
		||||
#     c99   = ISO C99 standard (not yet fully implemented)
 | 
			
		||||
#     gnu99 = c99 plus GCC extensions
 | 
			
		||||
CSTANDARD = -std=c99
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Place -D or -U options here for C sources
 | 
			
		||||
CDEFS  = -DF_CPU=$(F_CPU)UL
 | 
			
		||||
CDEFS += -DF_USB=$(F_USB)UL
 | 
			
		||||
CDEFS += -DBOARD=BOARD_$(BOARD) -DARCH=ARCH_$(ARCH)
 | 
			
		||||
CDEFS += $(LUFA_OPTS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Place -D or -U options here for ASM sources
 | 
			
		||||
ADEFS  = -DF_CPU=$(F_CPU)
 | 
			
		||||
ADEFS += -DF_USB=$(F_USB)UL
 | 
			
		||||
ADEFS += -DBOARD=BOARD_$(BOARD)
 | 
			
		||||
ADEFS += $(LUFA_OPTS)
 | 
			
		||||
 | 
			
		||||
# Place -D or -U options here for C++ sources
 | 
			
		||||
CPPDEFS  = -DF_CPU=$(F_CPU)UL
 | 
			
		||||
CPPDEFS += -DF_USB=$(F_USB)UL
 | 
			
		||||
CPPDEFS += -DBOARD=BOARD_$(BOARD)
 | 
			
		||||
CPPDEFS += $(LUFA_OPTS)
 | 
			
		||||
#CPPDEFS += -D__STDC_LIMIT_MACROS
 | 
			
		||||
#CPPDEFS += -D__STDC_CONSTANT_MACROS
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#---------------- Compiler Options C ----------------
 | 
			
		||||
#  -g*:          generate debugging information
 | 
			
		||||
#  -O*:          optimization level
 | 
			
		||||
#  -f...:        tuning, see GCC manual and avr-libc documentation
 | 
			
		||||
#  -Wall...:     warning level
 | 
			
		||||
#  -Wa,...:      tell GCC to pass this to the assembler.
 | 
			
		||||
#    -adhlns...: create assembler listing
 | 
			
		||||
CFLAGS = -g$(DEBUG)
 | 
			
		||||
CFLAGS += $(CDEFS)
 | 
			
		||||
CFLAGS += -O$(OPT)
 | 
			
		||||
CFLAGS += -funsigned-char
 | 
			
		||||
CFLAGS += -funsigned-bitfields
 | 
			
		||||
CFLAGS += -ffunction-sections
 | 
			
		||||
CFLAGS += -fno-inline-small-functions
 | 
			
		||||
CFLAGS += -fpack-struct
 | 
			
		||||
CFLAGS += -fshort-enums
 | 
			
		||||
CFLAGS += -fno-strict-aliasing
 | 
			
		||||
CFLAGS += -Wall
 | 
			
		||||
CFLAGS += -Wstrict-prototypes
 | 
			
		||||
#CFLAGS += -mshort-calls
 | 
			
		||||
#CFLAGS += -fno-unit-at-a-time
 | 
			
		||||
#CFLAGS += -Wundef
 | 
			
		||||
#CFLAGS += -Wunreachable-code
 | 
			
		||||
#CFLAGS += -Wsign-compare
 | 
			
		||||
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
 | 
			
		||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
 | 
			
		||||
CFLAGS += $(CSTANDARD)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#---------------- Compiler Options C++ ----------------
 | 
			
		||||
#  -g*:          generate debugging information
 | 
			
		||||
#  -O*:          optimization level
 | 
			
		||||
#  -f...:        tuning, see GCC manual and avr-libc documentation
 | 
			
		||||
#  -Wall...:     warning level
 | 
			
		||||
#  -Wa,...:      tell GCC to pass this to the assembler.
 | 
			
		||||
#    -adhlns...: create assembler listing
 | 
			
		||||
CPPFLAGS = -g$(DEBUG)
 | 
			
		||||
CPPFLAGS += $(CPPDEFS)
 | 
			
		||||
CPPFLAGS += -O$(OPT)
 | 
			
		||||
CPPFLAGS += -funsigned-char
 | 
			
		||||
CPPFLAGS += -funsigned-bitfields
 | 
			
		||||
CPPFLAGS += -fpack-struct
 | 
			
		||||
CPPFLAGS += -fshort-enums
 | 
			
		||||
CPPFLAGS += -fno-exceptions
 | 
			
		||||
CPPFLAGS += -Wall
 | 
			
		||||
CPPFLAGS += -Wundef
 | 
			
		||||
#CPPFLAGS += -mshort-calls
 | 
			
		||||
#CPPFLAGS += -fno-unit-at-a-time
 | 
			
		||||
#CPPFLAGS += -Wstrict-prototypes
 | 
			
		||||
#CPPFLAGS += -Wunreachable-code
 | 
			
		||||
#CPPFLAGS += -Wsign-compare
 | 
			
		||||
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
 | 
			
		||||
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
 | 
			
		||||
#CPPFLAGS += $(CSTANDARD)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#---------------- Assembler Options ----------------
 | 
			
		||||
#  -Wa,...:   tell GCC to pass this to the assembler.
 | 
			
		||||
#  -adhlns:   create listing
 | 
			
		||||
#  -gstabs:   have the assembler create line number information; note that
 | 
			
		||||
#             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
 | 
			
		||||
#       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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#---------------- Library Options ----------------
 | 
			
		||||
# Minimalistic printf version
 | 
			
		||||
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
 | 
			
		||||
 | 
			
		||||
# Floating point printf version (requires MATH_LIB = -lm below)
 | 
			
		||||
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_MIN)
 | 
			
		||||
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Minimalistic scanf version
 | 
			
		||||
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
 | 
			
		||||
 | 
			
		||||
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
 | 
			
		||||
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_MIN)
 | 
			
		||||
#SCANF_LIB = $(SCANF_LIB_FLOAT)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MATH_LIB = -lm
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# List any extra directories to look for libraries here.
 | 
			
		||||
#     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 =
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#---------------- External Memory Options ----------------
 | 
			
		||||
 | 
			
		||||
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
 | 
			
		||||
# used for variables (.data/.bss) and heap (malloc()).
 | 
			
		||||
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
 | 
			
		||||
 | 
			
		||||
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
 | 
			
		||||
# only used for heap (malloc()).
 | 
			
		||||
#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
 | 
			
		||||
 | 
			
		||||
EXTMEMOPTS =
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#---------------- Linker Options ----------------
 | 
			
		||||
#  -Wl,...:     tell GCC to pass this to linker.
 | 
			
		||||
#    -Map:      create map file
 | 
			
		||||
#    --cref:    add cross reference to  map file
 | 
			
		||||
LDFLAGS  = -Wl,-Map=$(TARGET).map,--cref
 | 
			
		||||
LDFLAGS += -Wl,--relax
 | 
			
		||||
LDFLAGS += -Wl,--gc-sections
 | 
			
		||||
LDFLAGS += $(EXTMEMOPTS)
 | 
			
		||||
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
 | 
			
		||||
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
 | 
			
		||||
#LDFLAGS += -T linker_script.x
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#---------------- Programming Options (avrdude) ----------------
 | 
			
		||||
 | 
			
		||||
# Programming hardware
 | 
			
		||||
# Type: avrdude -c ?
 | 
			
		||||
# to get a full listing.
 | 
			
		||||
#
 | 
			
		||||
AVRDUDE_PROGRAMMER = jtagmkII
 | 
			
		||||
 | 
			
		||||
# com1 = serial port. Use lpt1 to connect to parallel port.
 | 
			
		||||
AVRDUDE_PORT = usb
 | 
			
		||||
 | 
			
		||||
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
 | 
			
		||||
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Uncomment the following if you want avrdude's erase cycle counter.
 | 
			
		||||
# Note that this counter needs to be initialized first using -Yn,
 | 
			
		||||
# see avrdude manual.
 | 
			
		||||
#AVRDUDE_ERASE_COUNTER = -y
 | 
			
		||||
 | 
			
		||||
# Uncomment the following if you do /not/ wish a verification to be
 | 
			
		||||
# performed after programming the device.
 | 
			
		||||
#AVRDUDE_NO_VERIFY = -V
 | 
			
		||||
 | 
			
		||||
# Increase verbosity level.  Please use this when submitting bug
 | 
			
		||||
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
 | 
			
		||||
# to submit bug reports.
 | 
			
		||||
#AVRDUDE_VERBOSE = -v -v
 | 
			
		||||
 | 
			
		||||
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
 | 
			
		||||
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
 | 
			
		||||
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
 | 
			
		||||
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#---------------- Debugging Options ----------------
 | 
			
		||||
 | 
			
		||||
# For simulavr only - target MCU frequency.
 | 
			
		||||
DEBUG_MFREQ = $(F_CPU)
 | 
			
		||||
 | 
			
		||||
# Set the DEBUG_UI to either gdb or insight.
 | 
			
		||||
# DEBUG_UI = gdb
 | 
			
		||||
DEBUG_UI = insight
 | 
			
		||||
 | 
			
		||||
# Set the debugging back-end to either avarice, simulavr.
 | 
			
		||||
DEBUG_BACKEND = avarice
 | 
			
		||||
#DEBUG_BACKEND = simulavr
 | 
			
		||||
 | 
			
		||||
# GDB Init Filename.
 | 
			
		||||
GDBINIT_FILE = __avr_gdbinit
 | 
			
		||||
 | 
			
		||||
# When using avarice settings for the JTAG
 | 
			
		||||
JTAG_DEV = /dev/com1
 | 
			
		||||
 | 
			
		||||
# Debugging port used to communicate between GDB / avarice / simulavr.
 | 
			
		||||
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
 | 
			
		||||
#     avarice is running on a different computer.
 | 
			
		||||
DEBUG_HOST = localhost
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#============================================================================
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Define programs and commands.
 | 
			
		||||
SHELL = sh
 | 
			
		||||
CC = avr-gcc
 | 
			
		||||
OBJCOPY = avr-objcopy
 | 
			
		||||
OBJDUMP = avr-objdump
 | 
			
		||||
SIZE = avr-size
 | 
			
		||||
AR = avr-ar rcs
 | 
			
		||||
NM = avr-nm
 | 
			
		||||
AVRDUDE = avrdude
 | 
			
		||||
REMOVE = rm -f
 | 
			
		||||
REMOVEDIR = rm -rf
 | 
			
		||||
COPY = cp
 | 
			
		||||
WINSHELL = cmd
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Define Messages
 | 
			
		||||
# English
 | 
			
		||||
MSG_ERRORS_NONE = Errors: none
 | 
			
		||||
MSG_BEGIN = -------- begin --------
 | 
			
		||||
MSG_END = --------  end  --------
 | 
			
		||||
MSG_SIZE_BEFORE = Size before:
 | 
			
		||||
MSG_SIZE_AFTER = Size after:
 | 
			
		||||
MSG_COFF = Converting to AVR COFF:
 | 
			
		||||
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
 | 
			
		||||
MSG_FLASH = Creating load file for Flash:
 | 
			
		||||
MSG_EEPROM = Creating load file for EEPROM:
 | 
			
		||||
MSG_EXTENDED_LISTING = Creating Extended Listing:
 | 
			
		||||
MSG_SYMBOL_TABLE = Creating Symbol Table:
 | 
			
		||||
MSG_LINKING = Linking:
 | 
			
		||||
MSG_COMPILING = Compiling C:
 | 
			
		||||
MSG_COMPILING_CPP = Compiling C++:
 | 
			
		||||
MSG_ASSEMBLING = Assembling:
 | 
			
		||||
MSG_CLEANING = Cleaning project:
 | 
			
		||||
MSG_CREATING_LIBRARY = Creating library:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Define all object files.
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Compiler flags to generate dependency files.
 | 
			
		||||
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Combine all necessary flags and optional flags.
 | 
			
		||||
# Add target processor to flags.
 | 
			
		||||
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
 | 
			
		||||
ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
 | 
			
		||||
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Default target.
 | 
			
		||||
all: begin gccversion sizebefore build sizeafter end
 | 
			
		||||
 | 
			
		||||
# Change the build target to build a HEX file or a library.
 | 
			
		||||
build: elf hex eep lss sym
 | 
			
		||||
#build: lib
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
elf: $(TARGET).elf
 | 
			
		||||
hex: $(TARGET).hex
 | 
			
		||||
eep: $(TARGET).eep
 | 
			
		||||
lss: $(TARGET).lss
 | 
			
		||||
sym: $(TARGET).sym
 | 
			
		||||
LIBNAME=lib$(TARGET).a
 | 
			
		||||
lib: $(LIBNAME)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Eye candy.
 | 
			
		||||
# AVR Studio 3.x does not check make's exit code but relies on
 | 
			
		||||
# the following magic strings to be generated by the compile job.
 | 
			
		||||
begin:
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_BEGIN)
 | 
			
		||||
 | 
			
		||||
end:
 | 
			
		||||
	@echo $(MSG_END)
 | 
			
		||||
	@echo
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Display size of file.
 | 
			
		||||
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
 | 
			
		||||
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
 | 
			
		||||
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
 | 
			
		||||
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sizebefore:
 | 
			
		||||
	@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
 | 
			
		||||
	2>/dev/null; echo; fi
 | 
			
		||||
 | 
			
		||||
sizeafter:
 | 
			
		||||
	@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
 | 
			
		||||
	2>/dev/null; echo; fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Display compiler version information.
 | 
			
		||||
gccversion :
 | 
			
		||||
	@$(CC) --version
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Program the device.
 | 
			
		||||
program: $(TARGET).hex $(TARGET).eep
 | 
			
		||||
	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
 | 
			
		||||
 | 
			
		||||
flip: $(TARGET).hex
 | 
			
		||||
	batchisp -hardware usb -device $(MCU) -operation erase f
 | 
			
		||||
	batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
 | 
			
		||||
	batchisp -hardware usb -device $(MCU) -operation start reset 0
 | 
			
		||||
 | 
			
		||||
dfu: $(TARGET).hex
 | 
			
		||||
	dfu-programmer $(MCU) erase
 | 
			
		||||
	dfu-programmer $(MCU) flash $(TARGET).hex
 | 
			
		||||
	dfu-programmer $(MCU) reset
 | 
			
		||||
 | 
			
		||||
flip-ee: $(TARGET).hex $(TARGET).eep
 | 
			
		||||
	$(COPY) $(TARGET).eep $(TARGET)eep.hex
 | 
			
		||||
	batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
 | 
			
		||||
	batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
 | 
			
		||||
	batchisp -hardware usb -device $(MCU) -operation start reset 0
 | 
			
		||||
	$(REMOVE) $(TARGET)eep.hex
 | 
			
		||||
 | 
			
		||||
dfu-ee: $(TARGET).hex $(TARGET).eep
 | 
			
		||||
	dfu-programmer $(MCU) eeprom-flash $(TARGET).eep
 | 
			
		||||
	dfu-programmer $(MCU) reset
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Generate avr-gdb config/init file which does the following:
 | 
			
		||||
#     define the reset signal, load the target file, connect to target, and set
 | 
			
		||||
#     a breakpoint at main().
 | 
			
		||||
gdb-config:
 | 
			
		||||
	@$(REMOVE) $(GDBINIT_FILE)
 | 
			
		||||
	@echo define reset >> $(GDBINIT_FILE)
 | 
			
		||||
	@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
 | 
			
		||||
	@echo end >> $(GDBINIT_FILE)
 | 
			
		||||
	@echo file $(TARGET).elf >> $(GDBINIT_FILE)
 | 
			
		||||
	@echo target remote $(DEBUG_HOST):$(DEBUG_PORT)  >> $(GDBINIT_FILE)
 | 
			
		||||
ifeq ($(DEBUG_BACKEND),simulavr)
 | 
			
		||||
	@echo load  >> $(GDBINIT_FILE)
 | 
			
		||||
endif
 | 
			
		||||
	@echo break main >> $(GDBINIT_FILE)
 | 
			
		||||
 | 
			
		||||
debug: gdb-config $(TARGET).elf
 | 
			
		||||
ifeq ($(DEBUG_BACKEND), avarice)
 | 
			
		||||
	@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
 | 
			
		||||
	@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
 | 
			
		||||
	$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
 | 
			
		||||
	@$(WINSHELL) /c pause
 | 
			
		||||
 | 
			
		||||
else
 | 
			
		||||
	@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
 | 
			
		||||
	$(DEBUG_MFREQ) --port $(DEBUG_PORT)
 | 
			
		||||
endif
 | 
			
		||||
	@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
 | 
			
		||||
COFFCONVERT = $(OBJCOPY) --debugging
 | 
			
		||||
COFFCONVERT += --change-section-address .data-0x800000
 | 
			
		||||
COFFCONVERT += --change-section-address .bss-0x800000
 | 
			
		||||
COFFCONVERT += --change-section-address .noinit-0x800000
 | 
			
		||||
COFFCONVERT += --change-section-address .eeprom-0x810000
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
coff: $(TARGET).elf
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_COFF) $(TARGET).cof
 | 
			
		||||
	$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extcoff: $(TARGET).elf
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
 | 
			
		||||
	$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Create final output files (.hex, .eep) from ELF output file.
 | 
			
		||||
%.hex: %.elf
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_FLASH) $@
 | 
			
		||||
	$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@
 | 
			
		||||
 | 
			
		||||
%.eep: %.elf
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_EEPROM) $@
 | 
			
		||||
	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
 | 
			
		||||
	--change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
 | 
			
		||||
 | 
			
		||||
# Create extended listing file from ELF output file.
 | 
			
		||||
%.lss: %.elf
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_EXTENDED_LISTING) $@
 | 
			
		||||
	$(OBJDUMP) -h -S -z $< > $@
 | 
			
		||||
 | 
			
		||||
# Create a symbol table from ELF output file.
 | 
			
		||||
%.sym: %.elf
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_SYMBOL_TABLE) $@
 | 
			
		||||
	$(NM) -n $< > $@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Create library from object files.
 | 
			
		||||
.SECONDARY : $(TARGET).a
 | 
			
		||||
.PRECIOUS : $(OBJ)
 | 
			
		||||
%.a: $(OBJ)
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_CREATING_LIBRARY) $@
 | 
			
		||||
	$(AR) $@ $(OBJ)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Link: create ELF output file from object files.
 | 
			
		||||
.SECONDARY : $(TARGET).elf
 | 
			
		||||
.PRECIOUS : $(OBJ)
 | 
			
		||||
%.elf: $(OBJ)
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_LINKING) $@
 | 
			
		||||
	$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Compile: create object files from C source files.
 | 
			
		||||
$(OBJDIR)/%.o : %.c
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_COMPILING) $<
 | 
			
		||||
	$(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 $@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Compile: create assembler files from C source files.
 | 
			
		||||
%.s : %.c
 | 
			
		||||
	$(CC) -S $(ALL_CFLAGS) $< -o $@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Compile: create assembler files from C++ source files.
 | 
			
		||||
%.s : %.cpp
 | 
			
		||||
	$(CC) -S $(ALL_CPPFLAGS) $< -o $@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Assemble: create object files from assembler source files.
 | 
			
		||||
$(OBJDIR)/%.o : %.S
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_ASSEMBLING) $<
 | 
			
		||||
	$(CC) -c $(ALL_ASFLAGS) $< -o $@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Create preprocessed source for use in sending a bug report.
 | 
			
		||||
%.i : %.c
 | 
			
		||||
	$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Target: clean project.
 | 
			
		||||
clean: begin clean_list end
 | 
			
		||||
 | 
			
		||||
clean_list :
 | 
			
		||||
	@echo
 | 
			
		||||
	@echo $(MSG_CLEANING)
 | 
			
		||||
	$(REMOVE) $(TARGET).hex
 | 
			
		||||
	$(REMOVE) $(TARGET).eep
 | 
			
		||||
	$(REMOVE) $(TARGET).cof
 | 
			
		||||
	$(REMOVE) $(TARGET).elf
 | 
			
		||||
	$(REMOVE) $(TARGET).map
 | 
			
		||||
	$(REMOVE) $(TARGET).sym
 | 
			
		||||
	$(REMOVE) $(TARGET).lss
 | 
			
		||||
	$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
 | 
			
		||||
	$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
 | 
			
		||||
	$(REMOVE) $(SRC:.c=.s)
 | 
			
		||||
	$(REMOVE) $(SRC:.c=.d)
 | 
			
		||||
	$(REMOVE) $(SRC:.c=.i)
 | 
			
		||||
	$(REMOVEDIR) .dep
 | 
			
		||||
 | 
			
		||||
doxygen:
 | 
			
		||||
	@echo Generating Project Documentation...
 | 
			
		||||
	@doxygen Doxygen.conf
 | 
			
		||||
	@echo Documentation Generation Complete.
 | 
			
		||||
 | 
			
		||||
clean_doxygen:
 | 
			
		||||
	rm -rf Documentation
 | 
			
		||||
 | 
			
		||||
# Create object files directory
 | 
			
		||||
$(shell mkdir $(OBJDIR) 2>/dev/null)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Include the dependency files.
 | 
			
		||||
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Listing of phony targets.
 | 
			
		||||
.PHONY : all begin finish end sizebefore sizeafter gccversion \
 | 
			
		||||
build elf hex eep lss sym coff extcoff doxygen clean          \
 | 
			
		||||
clean_list clean_doxygen program dfu flip flip-ee dfu-ee      \
 | 
			
		||||
debug gdb-config
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -204,7 +204,7 @@
 | 
			
		||||
		 *
 | 
			
		||||
		 *  \param[in] freq  Required audio sampling frequency in HZ
 | 
			
		||||
		 */
 | 
			
		||||
		#define AUDIO_SAMPLE_FREQ(freq)           {.Byte1 = (freq & 0x0000FF), .Byte2 = ((freq >> 8) & 0xFF), .Byte3 = ((freq >> 16) & 0xFF)}
 | 
			
		||||
		#define AUDIO_SAMPLE_FREQ(freq)           {.Byte1 = ((uint32_t)freq & 0x0000FF), .Byte2 = (((uint32_t)freq >> 8) & 0xFF), .Byte3 = (((uint32_t)freq >> 16) & 0xFF)}
 | 
			
		||||
 | 
			
		||||
		/** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint
 | 
			
		||||
		 *  accepts only filled endpoint packets of audio samples.
 | 
			
		||||
@ -215,7 +215,7 @@
 | 
			
		||||
		 *  will accept partially filled endpoint packets of audio samples.
 | 
			
		||||
		 */
 | 
			
		||||
		#define AUDIO_EP_ACCEPTS_SMALL_PACKETS    (0 << 7)
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
	/* Enums: */
 | 
			
		||||
		/** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Audio
 | 
			
		||||
		 *  device class.
 | 
			
		||||
@ -269,6 +269,22 @@
 | 
			
		||||
			AUDIO_DSUBTYPE_CSEndpoint_General         = 0x01, /**< Audio class specific endpoint general descriptor. */
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		/** Enum for the Audio class specific control requests that can be issued by the USB bus host. */
 | 
			
		||||
		enum Audio_ClassRequests_t
 | 
			
		||||
		{
 | 
			
		||||
			AUDIO_REQ_SetCurrent    = 0x01, /**< Audio class-specific request to set the current value of a parameter within the device. */
 | 
			
		||||
			AUDIO_REQ_SetMinimum    = 0x02, /**< Audio class-specific request to set the minimum value of a parameter within the device. */
 | 
			
		||||
			AUDIO_REQ_SetMaximum    = 0x03, /**< Audio class-specific request to set the maximum value of a parameter within the device. */
 | 
			
		||||
			AUDIO_REQ_SetResolution = 0x04, /**< Audio class-specific request to set the resolution value of a parameter within the device. */
 | 
			
		||||
			AUDIO_REQ_SetMemory     = 0x05, /**< Audio class-specific request to set the memory value of a parameter within the device. */
 | 
			
		||||
			AUDIO_REQ_GetCurrent    = 0x81, /**< Audio class-specific request to get the current value of a parameter within the device. */
 | 
			
		||||
			AUDIO_REQ_GetMinimum    = 0x82, /**< Audio class-specific request to get the minimum value of a parameter within the device. */
 | 
			
		||||
			AUDIO_REQ_GetMaximum    = 0x83, /**< Audio class-specific request to get the maximum value of a parameter within the device. */
 | 
			
		||||
			AUDIO_REQ_GetResolution = 0x84, /**< Audio class-specific request to get the resolution value of a parameter within the device. */
 | 
			
		||||
			AUDIO_REQ_GetMemory     = 0x85, /**< Audio class-specific request to get the memory value of a parameter within the device. */
 | 
			
		||||
			AUDIO_REQ_GetStatus     = 0xFF, /**< Audio class-specific request to get the device status. */
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
	/* Type Defines: */
 | 
			
		||||
		/** \brief Audio class-specific Input Terminal Descriptor (LUFA naming conventions).
 | 
			
		||||
		 *
 | 
			
		||||
 | 
			
		||||
@ -57,6 +57,13 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			break;
 | 
			
		||||
		case AUDIO_REQ_GetStatus:
 | 
			
		||||
			if ((USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) ||
 | 
			
		||||
			    (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT)))
 | 
			
		||||
			{
 | 
			
		||||
				Endpoint_ClearSETUP();
 | 
			
		||||
				Endpoint_ClearStatusStage();
 | 
			
		||||
			}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -12,14 +12,16 @@
 | 
			
		||||
  *   - Added USE_LUFA_CONFIG_HEADER compile time option to include a LUFAConfig.h header in the user director for LUFA configuration
 | 
			
		||||
  *     tokens as an alternative to tokens defined in the project makefile
 | 
			
		||||
  *   - Added new USB_Host_SetInterfaceAltSetting() convenience function for the selection of an interface's alternative setting
 | 
			
		||||
  *   - Added Audio class control request definitions
 | 
			
		||||
  *  - Library Applications:
 | 
			
		||||
  *   - Added RNDIS device mode to the Webserver project
 | 
			
		||||
  *   - Added new MediaControl project
 | 
			
		||||
  *   - Added new incomplete AndroidAccessoryHost Host LowLevel demo
 | 
			
		||||
  *   - Added RNDIS device mode to the Webserver project
 | 
			
		||||
  *   - Added new incomplete AudioInputHost Host LowLevel demo
 | 
			
		||||
  *
 | 
			
		||||
  *  <b>Changed:</b>
 | 
			
		||||
  *  - Core:
 | 
			
		||||
  *   - <i>None</i>
 | 
			
		||||
  *   - Added support for the Audio class GET STATUS request so that it is correctly ACKed when sent by the host
 | 
			
		||||
  *  - Library Applications:
 | 
			
		||||
  *   - <i>None</i>
 | 
			
		||||
  *
 | 
			
		||||
 | 
			
		||||
@ -29,11 +29,10 @@
 | 
			
		||||
  *  - Demos/Projects
 | 
			
		||||
  *      -# Device/Host USB bridge
 | 
			
		||||
  *      -# Alternative (USB-IF endorsed) USB-CDC Ethernet Class
 | 
			
		||||
  *      -# Finish Test and Measurement Class demo
 | 
			
		||||
  *      -# Finish BluetoothHost demo
 | 
			
		||||
  *      -# Finish SideShow demo
 | 
			
		||||
  *      -# Finish StandaloneProgrammer project
 | 
			
		||||
  *      -# Arduino Uno compatible USB-MIDI, USB-HID
 | 
			
		||||
  *      -# Finish incomplete demos and projects
 | 
			
		||||
  *      -# Add class driver support for Audio Host class
 | 
			
		||||
  *      -# Add class driver support for Test and Measurement class
 | 
			
		||||
  *      -# Fix up Audio class support - add support for mixers, etc., add support for GET/SET commands
 | 
			
		||||
  *  - Ports
 | 
			
		||||
  *      -# Atmel ARM7 series microcontrollers
 | 
			
		||||
  *      -# Other (commercial) C compilers
 | 
			
		||||
 | 
			
		||||
@ -45,14 +45,14 @@ int main(void)
 | 
			
		||||
	V2Protocol_Init();
 | 
			
		||||
 | 
			
		||||
	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
 | 
			
		||||
	sei();
 | 
			
		||||
 | 
			
		||||
	GlobalInterruptEnable();
 | 
			
		||||
	
 | 
			
		||||
	for (;;)
 | 
			
		||||
	{
 | 
			
		||||
		#if (BOARD == BOARD_USBTINYMKII)
 | 
			
		||||
		/* On the USBTINY-MKII target, there is a secondary LED which indicates the current selected power
 | 
			
		||||
		   mode - either VBUS, or sourced from the VTARGET pin of the programming connectors */
 | 
			
		||||
		LEDs_ChangeLEDs(LEDMASK_VBUSPOWER, (PIND & (1 << 0)) ? 0 : LEDMASK_VBUSPOWER);
 | 
			
		||||
			/* On the USBTINY-MKII board target, there is a secondary LED which indicates the current selected
 | 
			
		||||
			   power mode - either VBUS, or sourced from the VTARGET pin of the programming connectors */
 | 
			
		||||
			LEDs_ChangeLEDs(LEDS_LED3, (PIND & (1 << 0)) ? 0 : LEDS_LED3);
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		AVRISP_Task();
 | 
			
		||||
@ -63,13 +63,35 @@ int main(void)
 | 
			
		||||
/** Configures the board hardware and chip peripherals for the demo's functionality. */
 | 
			
		||||
void SetupHardware(void)
 | 
			
		||||
{
 | 
			
		||||
	/* Disable watchdog if enabled by bootloader/fuses */
 | 
			
		||||
	MCUSR &= ~(1 << WDRF);
 | 
			
		||||
	wdt_disable();
 | 
			
		||||
	#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);
 | 
			
		||||
		/* Disable clock division */
 | 
			
		||||
		clock_prescale_set(clock_div_1);
 | 
			
		||||
	#elif (ARCH == ARCH_UC3)
 | 
			
		||||
		/* Select slow startup, external high frequency crystal attached to OSC0 */
 | 
			
		||||
		AVR32_PM.OSCCTRL0.mode    = 7;
 | 
			
		||||
		AVR32_PM.OSCCTRL0.startup = 6;
 | 
			
		||||
		AVR32_PM.MCCTRL.osc0en    = true;
 | 
			
		||||
		while (!(AVR32_PM.POSCSR.osc0rdy));
 | 
			
		||||
 | 
			
		||||
		/* Switch CPU core to use OSC0 as the system clock */
 | 
			
		||||
		AVR32_PM.MCCTRL.mcsel     = 1;
 | 
			
		||||
 | 
			
		||||
		/* Start PLL1 to feed into the USB generic clock module */
 | 
			
		||||
		AVR32_PM.PLL[1].pllmul    = (F_USB / F_CPU) ? (((F_USB / F_CPU) - 1) / 2) : 0;
 | 
			
		||||
		AVR32_PM.PLL[1].plldiv    = 0;
 | 
			
		||||
		AVR32_PM.PLL[1].pllosc    = 0;	
 | 
			
		||||
		AVR32_PM.PLL[1].pllen     = true;
 | 
			
		||||
		while (!(AVR32_PM.POSCSR.lock1));
 | 
			
		||||
	
 | 
			
		||||
		/* Configure interrupt management peripheral */
 | 
			
		||||
//		INTC_Init();
 | 
			
		||||
		INTC_RegisterGroupHandler(AVR32_USBB_IRQ, AVR32_INTC_INT0, USB_GEN_vect);	
 | 
			
		||||
	#endif
 | 
			
		||||
	
 | 
			
		||||
	/* Hardware Initialization */
 | 
			
		||||
	LEDs_Init();
 | 
			
		||||
	USB_Init();
 | 
			
		||||
 | 
			
		||||
@ -37,11 +37,7 @@
 | 
			
		||||
#define _AVRISP_H_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <avr/wdt.h>
 | 
			
		||||
		#include <avr/interrupt.h>
 | 
			
		||||
		#include <avr/power.h>
 | 
			
		||||
 | 
			
		||||
		#include <LUFA/Common/Common.h>
 | 
			
		||||
		#include <LUFA/Version.h>
 | 
			
		||||
		#include <LUFA/Drivers/Board/LEDs.h>
 | 
			
		||||
		#include <LUFA/Drivers/USB/USB.h>
 | 
			
		||||
@ -50,6 +46,17 @@
 | 
			
		||||
			#include <LUFA/Drivers/Peripheral/ADC.h>
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		#if (ARCH == ARCH_AVR8)
 | 
			
		||||
			#include <avr/io.h>
 | 
			
		||||
			#include <avr/wdt.h>
 | 
			
		||||
			#include <avr/interrupt.h>
 | 
			
		||||
			#include <avr/power.h>
 | 
			
		||||
		#elif (ARCH == ARCH_UC3)
 | 
			
		||||
			#include <avr32/io.h>
 | 
			
		||||
 | 
			
		||||
			#include <LUFA/Platform/UC3/INTC_UC3.h> // TODO: FIXME
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		#include "Descriptors.h"
 | 
			
		||||
		#include "Lib/V2Protocol.h"
 | 
			
		||||
 | 
			
		||||
@ -69,9 +76,6 @@
 | 
			
		||||
		/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
 | 
			
		||||
		#define LEDMASK_BUSY             (LEDS_LED1 | LEDS_LED2)
 | 
			
		||||
 | 
			
		||||
		/** LED mask for the library LED driver, to indicate that the target is being powered by VBUS. */
 | 
			
		||||
		#define LEDMASK_VBUSPOWER         LEDS_LED3
 | 
			
		||||
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
		void SetupHardware(void);
 | 
			
		||||
		void AVRISP_Task(void);
 | 
			
		||||
 | 
			
		||||
@ -53,8 +53,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
 | 
			
		||||
 | 
			
		||||
	.Endpoint0Size          = FIXED_CONTROL_ENDPOINT_SIZE,
 | 
			
		||||
 | 
			
		||||
	.VendorID               = 0x03EB,
 | 
			
		||||
	.ProductID              = 0x2104,
 | 
			
		||||
	.VendorID               = CPU_TO_LE16(0x03EB),
 | 
			
		||||
	.ProductID              = CPU_TO_LE16(0x2104),
 | 
			
		||||
	.ReleaseNumber          = VERSION_BCD(02.00),
 | 
			
		||||
 | 
			
		||||
	.ManufacturerStrIndex   = 0x01,
 | 
			
		||||
@ -75,7 +75,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 | 
			
		||||
		{
 | 
			
		||||
			.Header                 = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
 | 
			
		||||
 | 
			
		||||
			.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
 | 
			
		||||
			.TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)),
 | 
			
		||||
			.TotalInterfaces        = 1,
 | 
			
		||||
 | 
			
		||||
			.ConfigurationNumber    = 1,
 | 
			
		||||
@ -108,7 +108,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 | 
			
		||||
 | 
			
		||||
			.EndpointAddress        = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_IN_EPNUM),
 | 
			
		||||
			.Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
 | 
			
		||||
			.EndpointSize           = AVRISP_DATA_EPSIZE,
 | 
			
		||||
			.EndpointSize           = CPU_TO_LE16(AVRISP_DATA_EPSIZE),
 | 
			
		||||
			.PollingIntervalMS      = 0x0A
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
@ -118,7 +118,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 | 
			
		||||
 | 
			
		||||
			.EndpointAddress        = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_OUT_EPNUM),
 | 
			
		||||
			.Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
 | 
			
		||||
			.EndpointSize           = AVRISP_DATA_EPSIZE,
 | 
			
		||||
			.EndpointSize           = CPU_TO_LE16(AVRISP_DATA_EPSIZE),
 | 
			
		||||
			.PollingIntervalMS      = 0x0A
 | 
			
		||||
		},
 | 
			
		||||
};
 | 
			
		||||
@ -142,7 +142,17 @@ const USB_Descriptor_String_t PROGMEM ManufacturerString =
 | 
			
		||||
{
 | 
			
		||||
	.Header                 = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
 | 
			
		||||
 | 
			
		||||
	.UnicodeString          = L"Dean Camera"
 | 
			
		||||
	.UnicodeString          = {CPU_TO_LE16('D'),
 | 
			
		||||
	                           CPU_TO_LE16('e'), 
 | 
			
		||||
	                           CPU_TO_LE16('a'), 
 | 
			
		||||
	                           CPU_TO_LE16('n'), 
 | 
			
		||||
	                           CPU_TO_LE16(' '), 
 | 
			
		||||
	                           CPU_TO_LE16('C'), 
 | 
			
		||||
	                           CPU_TO_LE16('a'), 
 | 
			
		||||
	                           CPU_TO_LE16('m'), 
 | 
			
		||||
	                           CPU_TO_LE16('e'), 
 | 
			
		||||
	                           CPU_TO_LE16('r'), 
 | 
			
		||||
	                           CPU_TO_LE16('a')}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
 | 
			
		||||
@ -153,7 +163,28 @@ const USB_Descriptor_String_t PROGMEM ProductString =
 | 
			
		||||
{
 | 
			
		||||
	.Header                 = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
 | 
			
		||||
 | 
			
		||||
	.UnicodeString          = L"LUFA AVRISP MkII Clone"
 | 
			
		||||
	.UnicodeString          = {CPU_TO_LE16('L'), 
 | 
			
		||||
	                           CPU_TO_LE16('U'), 
 | 
			
		||||
	                           CPU_TO_LE16('F'), 
 | 
			
		||||
	                           CPU_TO_LE16('A'), 
 | 
			
		||||
	                           CPU_TO_LE16(' '), 
 | 
			
		||||
	                           CPU_TO_LE16('A'), 
 | 
			
		||||
	                           CPU_TO_LE16('V'), 
 | 
			
		||||
	                           CPU_TO_LE16('R'), 
 | 
			
		||||
	                           CPU_TO_LE16('I'), 
 | 
			
		||||
	                           CPU_TO_LE16('S'), 
 | 
			
		||||
	                           CPU_TO_LE16('P'), 
 | 
			
		||||
	                           CPU_TO_LE16(' '), 
 | 
			
		||||
	                           CPU_TO_LE16('M'), 
 | 
			
		||||
	                           CPU_TO_LE16('k'), 
 | 
			
		||||
	                           CPU_TO_LE16('I'), 
 | 
			
		||||
	                           CPU_TO_LE16('I'), 
 | 
			
		||||
	                           CPU_TO_LE16(' '), 
 | 
			
		||||
	                           CPU_TO_LE16('C'), 
 | 
			
		||||
	                           CPU_TO_LE16('l'), 
 | 
			
		||||
	                           CPU_TO_LE16('o'), 
 | 
			
		||||
	                           CPU_TO_LE16('n'), 
 | 
			
		||||
	                           CPU_TO_LE16('e')}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a
 | 
			
		||||
@ -163,7 +194,19 @@ const USB_Descriptor_String_t PROGMEM SerialString =
 | 
			
		||||
{
 | 
			
		||||
	.Header                 = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
 | 
			
		||||
 | 
			
		||||
	.UnicodeString          = L"0000A00128255"
 | 
			
		||||
	.UnicodeString          = {CPU_TO_LE16('0'), 
 | 
			
		||||
	                           CPU_TO_LE16('0'), 
 | 
			
		||||
	                           CPU_TO_LE16('0'), 
 | 
			
		||||
	                           CPU_TO_LE16('0'), 
 | 
			
		||||
	                           CPU_TO_LE16('A'), 
 | 
			
		||||
	                           CPU_TO_LE16('0'), 
 | 
			
		||||
	                           CPU_TO_LE16('0'), 
 | 
			
		||||
	                           CPU_TO_LE16('1'), 
 | 
			
		||||
	                           CPU_TO_LE16('2'), 
 | 
			
		||||
	                           CPU_TO_LE16('8'), 
 | 
			
		||||
	                           CPU_TO_LE16('2'), 
 | 
			
		||||
	                           CPU_TO_LE16('5'), 
 | 
			
		||||
	                           CPU_TO_LE16('5')}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
 | 
			
		||||
 | 
			
		||||
@ -37,11 +37,18 @@
 | 
			
		||||
#define _DESCRIPTORS_H_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/pgmspace.h>
 | 
			
		||||
 | 
			
		||||
		#include <LUFA/Common/Common.h>
 | 
			
		||||
		#include <LUFA/Drivers/USB/USB.h>
 | 
			
		||||
 | 
			
		||||
		#if (ARCH == ARCH_AVR8)
 | 
			
		||||
			#include <avr/pgmspace.h>
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
	/* Macros: */
 | 
			
		||||
		#if (ARCH == ARCH_UC3) // TODO: FIXME
 | 
			
		||||
			#define PROGMEM const
 | 
			
		||||
		#endif
 | 
			
		||||
	
 | 
			
		||||
		#if !defined(LIBUSB_DRIVER_COMPAT)
 | 
			
		||||
			/** Endpoint number of the AVRISP data OUT endpoint. */
 | 
			
		||||
			#define AVRISP_DATA_OUT_EPNUM      2
 | 
			
		||||
@ -70,7 +77,7 @@
 | 
			
		||||
			USB_Descriptor_Interface_t               AVRISP_Interface;
 | 
			
		||||
			USB_Descriptor_Endpoint_t                AVRISP_DataInEndpoint;
 | 
			
		||||
			USB_Descriptor_Endpoint_t                AVRISP_DataOutEndpoint;
 | 
			
		||||
		} USB_Descriptor_Configuration_t;
 | 
			
		||||
		} ATTR_PACKED USB_Descriptor_Configuration_t;
 | 
			
		||||
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
		uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
 | 
			
		||||
 | 
			
		||||
@ -52,7 +52,7 @@ void ISPProtocol_EnterISPMode(void)
 | 
			
		||||
		uint8_t PollValue;
 | 
			
		||||
		uint8_t PollIndex;
 | 
			
		||||
		uint8_t EnterProgBytes[4];
 | 
			
		||||
	} Enter_ISP_Params;
 | 
			
		||||
	} ATTR_PACKED Enter_ISP_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&Enter_ISP_Params, sizeof(Enter_ISP_Params), NULL);
 | 
			
		||||
 | 
			
		||||
@ -107,7 +107,7 @@ void ISPProtocol_LeaveISPMode(void)
 | 
			
		||||
	{
 | 
			
		||||
		uint8_t PreDelayMS;
 | 
			
		||||
		uint8_t PostDelayMS;
 | 
			
		||||
	} Leave_ISP_Params;
 | 
			
		||||
	} ATTR_PACKED Leave_ISP_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&Leave_ISP_Params, sizeof(Leave_ISP_Params), NULL);
 | 
			
		||||
 | 
			
		||||
@ -141,12 +141,12 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
 | 
			
		||||
		uint8_t  ProgrammingCommands[3];
 | 
			
		||||
		uint8_t  PollValue1;
 | 
			
		||||
		uint8_t  PollValue2;
 | 
			
		||||
		uint8_t  ProgData[256]; // Note, the Jungo driver has a very short ACK timeout period, need to buffer the
 | 
			
		||||
	} Write_Memory_Params;      // whole page and ACK the packet as fast as possible to prevent it from aborting
 | 
			
		||||
		uint8_t  ProgData[256];        // Note, the Jungo driver has a very short ACK timeout period, need to buffer the
 | 
			
		||||
	} ATTR_PACKED Write_Memory_Params; // whole page and ACK the packet as fast as possible to prevent it from aborting
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&Write_Memory_Params, (sizeof(Write_Memory_Params) -
 | 
			
		||||
	                                               sizeof(Write_Memory_Params.ProgData)), NULL);
 | 
			
		||||
	Write_Memory_Params.BytesToWrite = SwapEndian_16(Write_Memory_Params.BytesToWrite);
 | 
			
		||||
	Write_Memory_Params.BytesToWrite = be16_to_cpu(Write_Memory_Params.BytesToWrite);
 | 
			
		||||
	
 | 
			
		||||
	if (Write_Memory_Params.BytesToWrite > sizeof(Write_Memory_Params.ProgData))
 | 
			
		||||
	{
 | 
			
		||||
@ -286,10 +286,10 @@ void ISPProtocol_ReadMemory(uint8_t V2Command)
 | 
			
		||||
	{
 | 
			
		||||
		uint16_t BytesToRead;
 | 
			
		||||
		uint8_t  ReadMemoryCommand;
 | 
			
		||||
	} Read_Memory_Params;
 | 
			
		||||
	} ATTR_PACKED Read_Memory_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&Read_Memory_Params, sizeof(Read_Memory_Params), NULL);
 | 
			
		||||
	Read_Memory_Params.BytesToRead = SwapEndian_16(Read_Memory_Params.BytesToRead);
 | 
			
		||||
	Read_Memory_Params.BytesToRead = be16_to_cpu(Read_Memory_Params.BytesToRead);
 | 
			
		||||
	
 | 
			
		||||
	Endpoint_ClearOUT();
 | 
			
		||||
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
 | 
			
		||||
@ -360,7 +360,7 @@ void ISPProtocol_ChipErase(void)
 | 
			
		||||
		uint8_t EraseDelayMS;
 | 
			
		||||
		uint8_t PollMethod;
 | 
			
		||||
		uint8_t EraseCommandBytes[4];
 | 
			
		||||
	} Erase_Chip_Params;
 | 
			
		||||
	} ATTR_PACKED Erase_Chip_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&Erase_Chip_Params, sizeof(Erase_Chip_Params), NULL);
 | 
			
		||||
 | 
			
		||||
@ -396,7 +396,7 @@ void ISPProtocol_ReadFuseLockSigOSCCAL(uint8_t V2Command)
 | 
			
		||||
	{
 | 
			
		||||
		uint8_t RetByte;
 | 
			
		||||
		uint8_t ReadCommandBytes[4];
 | 
			
		||||
	} Read_FuseLockSigOSCCAL_Params;
 | 
			
		||||
	} ATTR_PACKED Read_FuseLockSigOSCCAL_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&Read_FuseLockSigOSCCAL_Params, sizeof(Read_FuseLockSigOSCCAL_Params), NULL);
 | 
			
		||||
 | 
			
		||||
@ -427,7 +427,7 @@ void ISPProtocol_WriteFuseLock(uint8_t V2Command)
 | 
			
		||||
	struct
 | 
			
		||||
	{
 | 
			
		||||
		uint8_t WriteCommandBytes[4];
 | 
			
		||||
	} Write_FuseLockSig_Params;
 | 
			
		||||
	} ATTR_PACKED Write_FuseLockSig_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&Write_FuseLockSig_Params, sizeof(Write_FuseLockSig_Params), NULL);
 | 
			
		||||
 | 
			
		||||
@ -454,7 +454,7 @@ void ISPProtocol_SPIMulti(void)
 | 
			
		||||
		uint8_t RxBytes;
 | 
			
		||||
		uint8_t RxStartAddr;
 | 
			
		||||
		uint8_t TxData[255];
 | 
			
		||||
	} SPI_Multi_Params;
 | 
			
		||||
	} ATTR_PACKED SPI_Multi_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&SPI_Multi_Params, (sizeof(SPI_Multi_Params) - sizeof(SPI_Multi_Params.TxData)), NULL);
 | 
			
		||||
	Endpoint_Read_Stream_LE(&SPI_Multi_Params.TxData, SPI_Multi_Params.TxBytes, NULL);
 | 
			
		||||
 | 
			
		||||
@ -37,10 +37,14 @@
 | 
			
		||||
#define _ISP_PROTOCOL_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <util/delay.h>
 | 
			
		||||
 | 
			
		||||
		#include <LUFA/Common/Common.h>
 | 
			
		||||
		#include <LUFA/Drivers/USB/USB.h>
 | 
			
		||||
		
 | 
			
		||||
		#if (ARCH == ARCH_AVR8)
 | 
			
		||||
			#include <avr/io.h>
 | 
			
		||||
		#elif (ARCH == ARCH_UC3)
 | 
			
		||||
			#include <avr32/io.h>			
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		#include "../V2Protocol.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -37,12 +37,19 @@
 | 
			
		||||
#define _ISP_TARGET_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <avr/pgmspace.h>
 | 
			
		||||
		#include <util/delay.h>
 | 
			
		||||
 | 
			
		||||
		#include <LUFA/Common/Common.h>
 | 
			
		||||
		#include <LUFA/Drivers/USB/USB.h>
 | 
			
		||||
		#include <LUFA/Drivers/Peripheral/SPI.h>
 | 
			
		||||
		
 | 
			
		||||
		#if defined(ENABLE_ISP_PROTOCOL) || defined(__DOXYGEN__)
 | 
			
		||||
			#include <LUFA/Drivers/Peripheral/SPI.h> // TODO: FIXME
 | 
			
		||||
		#endif
 | 
			
		||||
		
 | 
			
		||||
		#if (ARCH == ARCH_AVR8)
 | 
			
		||||
			#include <avr/io.h>
 | 
			
		||||
			#include <avr/pgmspace.h>
 | 
			
		||||
		#elif (ARCH == ARCH_UC3)
 | 
			
		||||
			#include <avr32/io.h>			
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		#include "../V2ProtocolParams.h"
 | 
			
		||||
 | 
			
		||||
@ -84,6 +91,7 @@
 | 
			
		||||
		                                      const uint8_t ReadMemCommand);
 | 
			
		||||
 | 
			
		||||
	/* Inline Functions: */
 | 
			
		||||
		#if defined(ENABLE_ISP_PROTOCOL) || defined(__DOXYGEN__)
 | 
			
		||||
		/** Sends a byte of ISP data to the attached target, using the appropriate SPI hardware or
 | 
			
		||||
		 *  software routines depending on the selected ISP speed.
 | 
			
		||||
		 *
 | 
			
		||||
@ -124,6 +132,7 @@
 | 
			
		||||
			else
 | 
			
		||||
			  return ISPTarget_TransferSoftSPIByte(Byte);
 | 
			
		||||
		}
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -42,13 +42,17 @@ uint32_t CurrentAddress;
 | 
			
		||||
/** Flag to indicate that the next read/write operation must update the device's current extended FLASH address */
 | 
			
		||||
bool MustLoadExtendedAddress;
 | 
			
		||||
 | 
			
		||||
/** Command timeout expiration flag. */
 | 
			
		||||
volatile bool TimeoutExpired;
 | 
			
		||||
 | 
			
		||||
#if (ARCH == ARCH_AVR8) // TODO: FIXME
 | 
			
		||||
/** ISR to manage timeouts whilst processing a V2Protocol command */
 | 
			
		||||
ISR(WDT_vect, ISR_BLOCK)
 | 
			
		||||
{
 | 
			
		||||
	TimeoutExpired = true;
 | 
			
		||||
	wdt_disable();
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/** Initialises the hardware and software associated with the V2 protocol command handling. */
 | 
			
		||||
void V2Protocol_Init(void)
 | 
			
		||||
@ -75,10 +79,12 @@ void V2Protocol_ProcessCommand(void)
 | 
			
		||||
{
 | 
			
		||||
	uint8_t V2Command = Endpoint_Read_8();
 | 
			
		||||
 | 
			
		||||
	#if (ARCH == ARCH_AVR8) // TODO: FIXME
 | 
			
		||||
	/* Start the watchdog with timeout interrupt enabled to manage the timeout */
 | 
			
		||||
	TimeoutExpired = false;
 | 
			
		||||
	wdt_enable(WDTO_1S);
 | 
			
		||||
	WDTCSR |= (1 << WDIE);
 | 
			
		||||
	#endif
 | 
			
		||||
 | 
			
		||||
	switch (V2Command)
 | 
			
		||||
	{
 | 
			
		||||
@ -140,8 +146,10 @@ void V2Protocol_ProcessCommand(void)
 | 
			
		||||
			break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	#if (ARCH == ARCH_AVR8) // TODO: FIXME
 | 
			
		||||
	/* Disable the timeout management watchdog timer */
 | 
			
		||||
	wdt_disable();
 | 
			
		||||
	#endif
 | 
			
		||||
 | 
			
		||||
	Endpoint_WaitUntilReady();
 | 
			
		||||
	Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
 | 
			
		||||
 | 
			
		||||
@ -37,12 +37,17 @@
 | 
			
		||||
#define _V2_PROTOCOL_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <avr/interrupt.h>
 | 
			
		||||
		#include <avr/wdt.h>
 | 
			
		||||
	
 | 
			
		||||
		#include <LUFA/Common/Common.h>
 | 
			
		||||
		#include <LUFA/Drivers/USB/USB.h>
 | 
			
		||||
 | 
			
		||||
		#if (ARCH == ARCH_AVR8)
 | 
			
		||||
			#include <avr/io.h>
 | 
			
		||||
			#include <avr/interrupt.h>
 | 
			
		||||
			#include <avr/wdt.h>
 | 
			
		||||
		#elif (ARCH == ARCH_UC3)
 | 
			
		||||
			#include <avr32/io.h>
 | 
			
		||||
		#endif
 | 
			
		||||
		
 | 
			
		||||
		#include "../Descriptors.h"
 | 
			
		||||
		#include "V2ProtocolConstants.h"
 | 
			
		||||
		#include "V2ProtocolParams.h"
 | 
			
		||||
@ -69,15 +74,13 @@
 | 
			
		||||
		/** Timeout period for each issued command from the host before it is aborted (in 10ms ticks). */
 | 
			
		||||
		#define COMMAND_TIMEOUT_TICKS      100
 | 
			
		||||
 | 
			
		||||
		/** Command timeout expiration flag, GPIOR for speed. */
 | 
			
		||||
		#define TimeoutExpired             GPIOR1
 | 
			
		||||
 | 
			
		||||
		/** MUX mask for the VTARGET ADC channel number. */
 | 
			
		||||
		#define VTARGET_ADC_CHANNEL_MASK   ADC_GET_CHANNEL_MASK(VTARGET_ADC_CHANNEL)
 | 
			
		||||
 | 
			
		||||
	/* External Variables: */
 | 
			
		||||
		extern uint32_t CurrentAddress;
 | 
			
		||||
		extern bool     MustLoadExtendedAddress;
 | 
			
		||||
		extern uint32_t      CurrentAddress;
 | 
			
		||||
		extern bool          MustLoadExtendedAddress;
 | 
			
		||||
		extern volatile bool TimeoutExpired;
 | 
			
		||||
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
		void V2Protocol_Init(void);
 | 
			
		||||
 | 
			
		||||
@ -73,6 +73,7 @@
 | 
			
		||||
		#define STATUS_CONN_FAIL_SCK        0x04
 | 
			
		||||
		#define STATUS_TGT_NOT_DETECTED     0x10
 | 
			
		||||
		#define STATUS_TGT_REVERSE_INSERTED 0x20
 | 
			
		||||
		#define STATUS_ANSWER_CKSUM_ERROR 	0xB0
 | 
			
		||||
 | 
			
		||||
		#define PARAM_BUILD_NUMBER_LOW      0x80
 | 
			
		||||
		#define PARAM_BUILD_NUMBER_HIGH     0x81
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@
 | 
			
		||||
#include "V2ProtocolParams.h"
 | 
			
		||||
 | 
			
		||||
/* Non-Volatile Parameter Values for EEPROM storage */
 | 
			
		||||
static uint8_t EEMEM EEPROM_Rest_Polarity = 0x00;
 | 
			
		||||
static uint8_t EEMEM EEPROM_Reset_Polarity = 0x00;
 | 
			
		||||
 | 
			
		||||
/* Volatile Parameter Values for RAM storage */
 | 
			
		||||
static ParameterItem_t ParameterTable[] =
 | 
			
		||||
@ -88,7 +88,7 @@ static ParameterItem_t ParameterTable[] =
 | 
			
		||||
void V2Params_LoadNonVolatileParamValues(void)
 | 
			
		||||
{
 | 
			
		||||
	/* Target RESET line polarity is a non-volatile value, retrieve current parameter value from EEPROM */
 | 
			
		||||
	V2Params_GetParamFromTable(PARAM_RESET_POLARITY)->ParamValue = eeprom_read_byte(&EEPROM_Rest_Polarity);
 | 
			
		||||
	V2Params_GetParamFromTable(PARAM_RESET_POLARITY)->ParamValue = eeprom_read_byte(&EEPROM_Reset_Polarity);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Updates any parameter values that are sourced from hardware rather than explicitly set by the host, such as
 | 
			
		||||
@ -163,7 +163,7 @@ void V2Params_SetParameterValue(const uint8_t ParamID,
 | 
			
		||||
 | 
			
		||||
	/* The target RESET line polarity is a non-volatile parameter, save to EEPROM when changed */
 | 
			
		||||
	if (ParamID == PARAM_RESET_POLARITY)
 | 
			
		||||
	  eeprom_update_byte(&EEPROM_Rest_Polarity, Value);
 | 
			
		||||
	  eeprom_update_byte(&EEPROM_Reset_Polarity, Value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Retrieves a parameter entry (including ID, value and privileges) from the parameter table that matches the given
 | 
			
		||||
 | 
			
		||||
@ -37,15 +37,20 @@
 | 
			
		||||
#define _V2_PROTOCOL_PARAMS_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <avr/eeprom.h>
 | 
			
		||||
 | 
			
		||||
		#include <LUFA/Common/Common.h>
 | 
			
		||||
		#include <LUFA/Version.h>
 | 
			
		||||
 | 
			
		||||
		#if defined(ADC)
 | 
			
		||||
			#include <LUFA/Drivers/Peripheral/ADC.h>
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		#if (ARCH == ARCH_AVR8)
 | 
			
		||||
			#include <avr/io.h>
 | 
			
		||||
			#include <avr/eeprom.h>
 | 
			
		||||
		#elif (ARCH == ARCH_UC3)
 | 
			
		||||
			#include <avr32/io.h>		
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		#include "V2Protocol.h"
 | 
			
		||||
		#include "V2ProtocolConstants.h"
 | 
			
		||||
		#include "ISP/ISPTarget.h"
 | 
			
		||||
@ -59,6 +64,12 @@
 | 
			
		||||
 | 
			
		||||
		/** Total number of parameters in the parameter table */
 | 
			
		||||
		#define TABLE_PARAM_COUNT   (sizeof(ParameterTable) / sizeof(ParameterTable[0]))
 | 
			
		||||
		
 | 
			
		||||
		#if (ARCH == ARCH_UC3) // TODO: FIXME
 | 
			
		||||
			#define EEMEM
 | 
			
		||||
			#define eeprom_read_byte(x) *x
 | 
			
		||||
			#define eeprom_update_byte(x,y) *x=y
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
	/* Type Defines: */
 | 
			
		||||
		/** Type define for a parameter table entry indicating a PC readable or writable device parameter. */
 | 
			
		||||
 | 
			
		||||
@ -37,12 +37,17 @@
 | 
			
		||||
#define _TINY_NVM_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <avr/interrupt.h>
 | 
			
		||||
		#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
		#include <LUFA/Common/Common.h>
 | 
			
		||||
 | 
			
		||||
		#if (ARCH == ARCH_AVR8)
 | 
			
		||||
			#include <avr/io.h>
 | 
			
		||||
			#include <avr/interrupt.h>
 | 
			
		||||
		#elif (ARCH == ARCH_UC3)
 | 
			
		||||
			#include <avr32/io.h>			
 | 
			
		||||
		#endif
 | 
			
		||||
		
 | 
			
		||||
		#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
		#include "XPROGProtocol.h"
 | 
			
		||||
		#include "XPROGTarget.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -37,12 +37,17 @@
 | 
			
		||||
#define _XMEGA_NVM_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <avr/interrupt.h>
 | 
			
		||||
		#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
		#include <LUFA/Common/Common.h>
 | 
			
		||||
 | 
			
		||||
		#if (ARCH == ARCH_AVR8)
 | 
			
		||||
			#include <avr/io.h>
 | 
			
		||||
			#include <avr/interrupt.h>
 | 
			
		||||
		#elif (ARCH == ARCH_UC3)
 | 
			
		||||
			#include <avr32/io.h>			
 | 
			
		||||
		#endif
 | 
			
		||||
		
 | 
			
		||||
		#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
		#include "XPROGProtocol.h"
 | 
			
		||||
		#include "XPROGTarget.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -60,7 +60,7 @@ void XPROGProtocol_SetMode(void)
 | 
			
		||||
	struct
 | 
			
		||||
	{
 | 
			
		||||
		uint8_t Protocol;
 | 
			
		||||
	} SetMode_XPROG_Params;
 | 
			
		||||
	} ATTR_PACKED SetMode_XPROG_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&SetMode_XPROG_Params, sizeof(SetMode_XPROG_Params), NULL);
 | 
			
		||||
 | 
			
		||||
@ -163,10 +163,10 @@ static void XPROGProtocol_Erase(void)
 | 
			
		||||
	{
 | 
			
		||||
		uint8_t  MemoryType;
 | 
			
		||||
		uint32_t Address;
 | 
			
		||||
	} Erase_XPROG_Params;
 | 
			
		||||
	} ATTR_PACKED Erase_XPROG_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&Erase_XPROG_Params, sizeof(Erase_XPROG_Params), NULL);
 | 
			
		||||
	Erase_XPROG_Params.Address = SwapEndian_32(Erase_XPROG_Params.Address);
 | 
			
		||||
	Erase_XPROG_Params.Address = be32_to_cpu(Erase_XPROG_Params.Address);
 | 
			
		||||
 | 
			
		||||
	Endpoint_ClearOUT();
 | 
			
		||||
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
 | 
			
		||||
@ -242,12 +242,12 @@ static void XPROGProtocol_WriteMemory(void)
 | 
			
		||||
		uint32_t Address;
 | 
			
		||||
		uint16_t Length;
 | 
			
		||||
		uint8_t  ProgData[256];
 | 
			
		||||
	} WriteMemory_XPROG_Params;
 | 
			
		||||
	} ATTR_PACKED WriteMemory_XPROG_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&WriteMemory_XPROG_Params, (sizeof(WriteMemory_XPROG_Params) -
 | 
			
		||||
	                                                    sizeof(WriteMemory_XPROG_Params).ProgData), NULL);
 | 
			
		||||
	WriteMemory_XPROG_Params.Address = SwapEndian_32(WriteMemory_XPROG_Params.Address);
 | 
			
		||||
	WriteMemory_XPROG_Params.Length  = SwapEndian_16(WriteMemory_XPROG_Params.Length);
 | 
			
		||||
	WriteMemory_XPROG_Params.Address = be32_to_cpu(WriteMemory_XPROG_Params.Address);
 | 
			
		||||
	WriteMemory_XPROG_Params.Length  = be16_to_cpu(WriteMemory_XPROG_Params.Length);
 | 
			
		||||
	Endpoint_Read_Stream_LE(&WriteMemory_XPROG_Params.ProgData, WriteMemory_XPROG_Params.Length, NULL);
 | 
			
		||||
 | 
			
		||||
	// The driver will terminate transfers that are a round multiple of the endpoint bank in size with a ZLP, need
 | 
			
		||||
@ -335,11 +335,11 @@ static void XPROGProtocol_ReadMemory(void)
 | 
			
		||||
		uint8_t  MemoryType;
 | 
			
		||||
		uint32_t Address;
 | 
			
		||||
		uint16_t Length;
 | 
			
		||||
	} ReadMemory_XPROG_Params;
 | 
			
		||||
	} ATTR_PACKED ReadMemory_XPROG_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&ReadMemory_XPROG_Params, sizeof(ReadMemory_XPROG_Params), NULL);
 | 
			
		||||
	ReadMemory_XPROG_Params.Address = SwapEndian_32(ReadMemory_XPROG_Params.Address);
 | 
			
		||||
	ReadMemory_XPROG_Params.Length  = SwapEndian_16(ReadMemory_XPROG_Params.Length);
 | 
			
		||||
	ReadMemory_XPROG_Params.Address = be32_to_cpu(ReadMemory_XPROG_Params.Address);
 | 
			
		||||
	ReadMemory_XPROG_Params.Length  = be16_to_cpu(ReadMemory_XPROG_Params.Length);
 | 
			
		||||
 | 
			
		||||
	Endpoint_ClearOUT();
 | 
			
		||||
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
 | 
			
		||||
@ -380,7 +380,7 @@ static void XPROGProtocol_ReadCRC(void)
 | 
			
		||||
	struct
 | 
			
		||||
	{
 | 
			
		||||
		uint8_t CRCType;
 | 
			
		||||
	} ReadCRC_XPROG_Params;
 | 
			
		||||
	} ATTR_PACKED ReadCRC_XPROG_Params;
 | 
			
		||||
 | 
			
		||||
	Endpoint_Read_Stream_LE(&ReadCRC_XPROG_Params, sizeof(ReadCRC_XPROG_Params), NULL);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -37,12 +37,18 @@
 | 
			
		||||
#define _XPROG_PROTOCOL_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <util/delay.h>
 | 
			
		||||
		#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
		#include <LUFA/Common/Common.h>
 | 
			
		||||
		#include <LUFA/Drivers/USB/USB.h>
 | 
			
		||||
 | 
			
		||||
		#if (ARCH == ARCH_AVR8)
 | 
			
		||||
			#include <avr/io.h>
 | 
			
		||||
		#elif (ARCH == ARCH_UC3)
 | 
			
		||||
			#include <avr32/io.h>			
 | 
			
		||||
		#endif
 | 
			
		||||
		
 | 
			
		||||
		#include <stdbool.h>
 | 
			
		||||
		#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
		#include "../V2Protocol.h"
 | 
			
		||||
		#include "XMEGANVM.h"
 | 
			
		||||
		#include "TINYNVM.h"
 | 
			
		||||
 | 
			
		||||
@ -46,18 +46,22 @@ void XPROGTarget_EnableTargetPDI(void)
 | 
			
		||||
{
 | 
			
		||||
	IsSending = false;
 | 
			
		||||
 | 
			
		||||
	/* Set Tx and XCK as outputs, Rx as input */
 | 
			
		||||
	DDRD |=  (1 << 5) | (1 << 3);
 | 
			
		||||
	DDRD &= ~(1 << 2);
 | 
			
		||||
	#if (ARCH == ARCH_AVR8)
 | 
			
		||||
		/* Set Tx and XCK as outputs, Rx as input */
 | 
			
		||||
		DDRD |=  (1 << 5) | (1 << 3);
 | 
			
		||||
		DDRD &= ~(1 << 2);
 | 
			
		||||
 | 
			
		||||
	/* Set DATA line high for at least 90ns to disable /RESET functionality */
 | 
			
		||||
	PORTD |= (1 << 3);
 | 
			
		||||
	_delay_us(1);
 | 
			
		||||
		/* Set DATA line high for at least 90ns to disable /RESET functionality */
 | 
			
		||||
		PORTD |= (1 << 3);
 | 
			
		||||
		Delay_MS(1);
 | 
			
		||||
 | 
			
		||||
	/* Set up the synchronous USART for XMEGA communications - 8 data bits, even parity, 2 stop bits */
 | 
			
		||||
	UBRR1  = ((F_CPU / 2 / XPROG_HARDWARE_SPEED) - 1);
 | 
			
		||||
	UCSR1B = (1 << TXEN1);
 | 
			
		||||
	UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
 | 
			
		||||
		/* Set up the synchronous USART for XMEGA communications - 8 data bits, even parity, 2 stop bits */
 | 
			
		||||
		UBRR1  = ((F_CPU / 2 / XPROG_HARDWARE_SPEED) - 1);
 | 
			
		||||
		UCSR1B = (1 << TXEN1);
 | 
			
		||||
		UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
 | 
			
		||||
	#elif (ARCH == ARCH_UC3)
 | 
			
		||||
		// TODO: FIXME
 | 
			
		||||
	#endif
 | 
			
		||||
 | 
			
		||||
	/* Send two IDLEs of 12 bits each to enable PDI interface (need at least 16 idle bits) */
 | 
			
		||||
	XPROGTarget_SendIdle();
 | 
			
		||||
@ -69,19 +73,23 @@ void XPROGTarget_EnableTargetTPI(void)
 | 
			
		||||
{
 | 
			
		||||
	IsSending = false;
 | 
			
		||||
 | 
			
		||||
	/* Set /RESET line low for at least 400ns to enable TPI functionality */
 | 
			
		||||
	AUX_LINE_DDR  |=  AUX_LINE_MASK;
 | 
			
		||||
	AUX_LINE_PORT &= ~AUX_LINE_MASK;
 | 
			
		||||
	_delay_us(1);
 | 
			
		||||
	#if (ARCH == ARCH_AVR8)
 | 
			
		||||
		/* Set /RESET line low for at least 400ns to enable TPI functionality */
 | 
			
		||||
		AUX_LINE_DDR  |=  AUX_LINE_MASK;
 | 
			
		||||
		AUX_LINE_PORT &= ~AUX_LINE_MASK;
 | 
			
		||||
		Delay_MS(1);
 | 
			
		||||
 | 
			
		||||
	/* Set Tx and XCK as outputs, Rx as input */
 | 
			
		||||
	DDRD |=  (1 << 5) | (1 << 3);
 | 
			
		||||
	DDRD &= ~(1 << 2);
 | 
			
		||||
		/* Set Tx and XCK as outputs, Rx as input */
 | 
			
		||||
		DDRD |=  (1 << 5) | (1 << 3);
 | 
			
		||||
		DDRD &= ~(1 << 2);
 | 
			
		||||
 | 
			
		||||
	/* Set up the synchronous USART for TINY communications - 8 data bits, even parity, 2 stop bits */
 | 
			
		||||
	UBRR1  = ((F_CPU / 2 / XPROG_HARDWARE_SPEED) - 1);
 | 
			
		||||
	UCSR1B = (1 << TXEN1);
 | 
			
		||||
	UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
 | 
			
		||||
		/* Set up the synchronous USART for TINY communications - 8 data bits, even parity, 2 stop bits */
 | 
			
		||||
		UBRR1  = ((F_CPU / 2 / XPROG_HARDWARE_SPEED) - 1);
 | 
			
		||||
		UCSR1B = (1 << TXEN1);
 | 
			
		||||
		UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
 | 
			
		||||
	#elif (ARCH == ARCH_UC3)
 | 
			
		||||
		// TODO: FIXME
 | 
			
		||||
	#endif
 | 
			
		||||
 | 
			
		||||
	/* Send two IDLEs of 12 bits each to enable TPI interface (need at least 16 idle bits) */
 | 
			
		||||
	XPROGTarget_SendIdle();
 | 
			
		||||
@ -94,14 +102,18 @@ void XPROGTarget_DisableTargetPDI(void)
 | 
			
		||||
	/* Switch to Rx mode to ensure that all pending transmissions are complete */
 | 
			
		||||
	XPROGTarget_SetRxMode();
 | 
			
		||||
 | 
			
		||||
	/* Turn off receiver and transmitter of the USART, clear settings */
 | 
			
		||||
	UCSR1A  = ((1 << TXC1) | (1 << RXC1));
 | 
			
		||||
	UCSR1B  = 0;
 | 
			
		||||
	UCSR1C  = 0;
 | 
			
		||||
	#if (ARCH == ARCH_AVR8)
 | 
			
		||||
		/* Turn off receiver and transmitter of the USART, clear settings */
 | 
			
		||||
		UCSR1A  = ((1 << TXC1) | (1 << RXC1));
 | 
			
		||||
		UCSR1B  = 0;
 | 
			
		||||
		UCSR1C  = 0;
 | 
			
		||||
 | 
			
		||||
	/* Tristate all pins */
 | 
			
		||||
	DDRD  &= ~((1 << 5) | (1 << 3));
 | 
			
		||||
	PORTD &= ~((1 << 5) | (1 << 3) | (1 << 2));
 | 
			
		||||
		/* Tristate all pins */
 | 
			
		||||
		DDRD  &= ~((1 << 5) | (1 << 3));
 | 
			
		||||
		PORTD &= ~((1 << 5) | (1 << 3) | (1 << 2));
 | 
			
		||||
	#elif (ARCH == ARCH_UC3)
 | 
			
		||||
		// TODO: FIXME
 | 
			
		||||
	#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Disables the target's TPI interface, exits programming mode and starts the target's application. */
 | 
			
		||||
@ -110,18 +122,22 @@ void XPROGTarget_DisableTargetTPI(void)
 | 
			
		||||
	/* Switch to Rx mode to ensure that all pending transmissions are complete */
 | 
			
		||||
	XPROGTarget_SetRxMode();
 | 
			
		||||
 | 
			
		||||
	/* Turn off receiver and transmitter of the USART, clear settings */
 | 
			
		||||
	UCSR1A |= (1 << TXC1) | (1 << RXC1);
 | 
			
		||||
	UCSR1B  = 0;
 | 
			
		||||
	UCSR1C  = 0;
 | 
			
		||||
	#if (ARCH == ARCH_AVR8)
 | 
			
		||||
		/* Turn off receiver and transmitter of the USART, clear settings */
 | 
			
		||||
		UCSR1A |= (1 << TXC1) | (1 << RXC1);
 | 
			
		||||
		UCSR1B  = 0;
 | 
			
		||||
		UCSR1C  = 0;
 | 
			
		||||
 | 
			
		||||
	/* Set all USART lines as inputs, tristate */
 | 
			
		||||
	DDRD  &= ~((1 << 5) | (1 << 3));
 | 
			
		||||
	PORTD &= ~((1 << 5) | (1 << 3) | (1 << 2));
 | 
			
		||||
	
 | 
			
		||||
	/* Tristate target /RESET line */
 | 
			
		||||
	AUX_LINE_DDR  &= ~AUX_LINE_MASK;
 | 
			
		||||
	AUX_LINE_PORT &= ~AUX_LINE_MASK;
 | 
			
		||||
		/* Set all USART lines as inputs, tristate */
 | 
			
		||||
		DDRD  &= ~((1 << 5) | (1 << 3));
 | 
			
		||||
		PORTD &= ~((1 << 5) | (1 << 3) | (1 << 2));
 | 
			
		||||
		
 | 
			
		||||
		/* Tristate target /RESET line */
 | 
			
		||||
		AUX_LINE_DDR  &= ~AUX_LINE_MASK;
 | 
			
		||||
		AUX_LINE_PORT &= ~AUX_LINE_MASK;
 | 
			
		||||
	#elif (ARCH == ARCH_UC3)
 | 
			
		||||
		// TODO: FIXME
 | 
			
		||||
	#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Sends a byte via the USART.
 | 
			
		||||
@ -134,10 +150,14 @@ void XPROGTarget_SendByte(const uint8_t Byte)
 | 
			
		||||
	if (!(IsSending))
 | 
			
		||||
	  XPROGTarget_SetTxMode();
 | 
			
		||||
 | 
			
		||||
	/* Wait until there is space in the hardware Tx buffer before writing */
 | 
			
		||||
	while (!(UCSR1A & (1 << UDRE1)));
 | 
			
		||||
	UCSR1A |= (1 << TXC1);
 | 
			
		||||
	UDR1    = Byte;
 | 
			
		||||
	#if (ARCH == ARCH_AVR8)
 | 
			
		||||
		/* Wait until there is space in the hardware Tx buffer before writing */
 | 
			
		||||
		while (!(UCSR1A & (1 << UDRE1)));
 | 
			
		||||
		UCSR1A |= (1 << TXC1);
 | 
			
		||||
		UDR1    = Byte;
 | 
			
		||||
	#elif (ARCH == ARCH_UC3)
 | 
			
		||||
		// TODO: FIXME
 | 
			
		||||
	#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Receives a byte via the software USART, blocking until data is received.
 | 
			
		||||
@ -150,10 +170,15 @@ uint8_t XPROGTarget_ReceiveByte(void)
 | 
			
		||||
	if (IsSending)
 | 
			
		||||
	  XPROGTarget_SetRxMode();
 | 
			
		||||
 | 
			
		||||
	/* Wait until a byte has been received before reading */
 | 
			
		||||
	while (!(UCSR1A & (1 << RXC1)) && !(TimeoutExpired));
 | 
			
		||||
	#if (ARCH == ARCH_AVR8)
 | 
			
		||||
		/* Wait until a byte has been received before reading */
 | 
			
		||||
		while (!(UCSR1A & (1 << RXC1)) && !(TimeoutExpired));
 | 
			
		||||
 | 
			
		||||
	return UDR1;
 | 
			
		||||
		return UDR1;
 | 
			
		||||
	#elif (ARCH == ARCH_UC3)
 | 
			
		||||
		// TODO: FIXME
 | 
			
		||||
		return 0;
 | 
			
		||||
	#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Sends an IDLE via the USART to the attached target, consisting of a full frame of idle bits. */
 | 
			
		||||
@ -163,40 +188,52 @@ void XPROGTarget_SendIdle(void)
 | 
			
		||||
	if (!(IsSending))
 | 
			
		||||
	  XPROGTarget_SetTxMode();
 | 
			
		||||
	
 | 
			
		||||
	/* Need to do nothing for a full frame to send an IDLE */
 | 
			
		||||
	for (uint8_t i = 0; i < BITS_IN_USART_FRAME; i++)
 | 
			
		||||
	{
 | 
			
		||||
		/* Wait for a full cycle of the clock */
 | 
			
		||||
		while (PIND & (1 << 5));
 | 
			
		||||
		while (!(PIND & (1 << 5)));
 | 
			
		||||
	}
 | 
			
		||||
	#if (ARCH == ARCH_AVR8)
 | 
			
		||||
		/* Need to do nothing for a full frame to send an IDLE */
 | 
			
		||||
		for (uint8_t i = 0; i < BITS_IN_USART_FRAME; i++)
 | 
			
		||||
		{
 | 
			
		||||
			/* Wait for a full cycle of the clock */
 | 
			
		||||
			while (PIND & (1 << 5));
 | 
			
		||||
			while (!(PIND & (1 << 5)));
 | 
			
		||||
		}
 | 
			
		||||
	#elif (ARCH == ARCH_UC3)
 | 
			
		||||
		// TODO: FIXME
 | 
			
		||||
	#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void XPROGTarget_SetTxMode(void)
 | 
			
		||||
{
 | 
			
		||||
	/* Wait for a full cycle of the clock */
 | 
			
		||||
	while (PIND & (1 << 5));
 | 
			
		||||
	while (!(PIND & (1 << 5)));
 | 
			
		||||
	#if (ARCH == ARCH_AVR8)
 | 
			
		||||
		/* Wait for a full cycle of the clock */
 | 
			
		||||
		while (PIND & (1 << 5));
 | 
			
		||||
		while (!(PIND & (1 << 5)));
 | 
			
		||||
 | 
			
		||||
	PORTD  |=  (1 << 3);
 | 
			
		||||
	DDRD   |=  (1 << 3);
 | 
			
		||||
		PORTD  |=  (1 << 3);
 | 
			
		||||
		DDRD   |=  (1 << 3);
 | 
			
		||||
 | 
			
		||||
	UCSR1B &= ~(1 << RXEN1);
 | 
			
		||||
	UCSR1B |=  (1 << TXEN1);
 | 
			
		||||
		UCSR1B &= ~(1 << RXEN1);
 | 
			
		||||
		UCSR1B |=  (1 << TXEN1);
 | 
			
		||||
	#elif (ARCH == ARCH_UC3)
 | 
			
		||||
		// TODO: FIXME
 | 
			
		||||
	#endif
 | 
			
		||||
 | 
			
		||||
	IsSending = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void XPROGTarget_SetRxMode(void)
 | 
			
		||||
{
 | 
			
		||||
	while (!(UCSR1A & (1 << TXC1)));
 | 
			
		||||
	UCSR1A |=  (1 << TXC1);
 | 
			
		||||
	#if (ARCH == ARCH_AVR8)
 | 
			
		||||
		while (!(UCSR1A & (1 << TXC1)));
 | 
			
		||||
		UCSR1A |=  (1 << TXC1);
 | 
			
		||||
 | 
			
		||||
	UCSR1B &= ~(1 << TXEN1);
 | 
			
		||||
	UCSR1B |=  (1 << RXEN1);
 | 
			
		||||
		UCSR1B &= ~(1 << TXEN1);
 | 
			
		||||
		UCSR1B |=  (1 << RXEN1);
 | 
			
		||||
 | 
			
		||||
	DDRD   &= ~(1 << 3);
 | 
			
		||||
	PORTD  &= ~(1 << 3);
 | 
			
		||||
		DDRD   &= ~(1 << 3);
 | 
			
		||||
		PORTD  &= ~(1 << 3);
 | 
			
		||||
	#elif (ARCH == ARCH_UC3)
 | 
			
		||||
		// TODO: FIXME
 | 
			
		||||
	#endif
 | 
			
		||||
 | 
			
		||||
	IsSending = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -37,12 +37,15 @@
 | 
			
		||||
#define _XPROG_TARGET_
 | 
			
		||||
 | 
			
		||||
	/* Includes: */
 | 
			
		||||
		#include <avr/io.h>
 | 
			
		||||
		#include <avr/interrupt.h>
 | 
			
		||||
		#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
		#include <LUFA/Common/Common.h>
 | 
			
		||||
 | 
			
		||||
		#if (ARCH == ARCH_AVR8)
 | 
			
		||||
			#include <avr/io.h>
 | 
			
		||||
			#include <avr/interrupt.h>
 | 
			
		||||
		#elif (ARCH == ARCH_UC3)
 | 
			
		||||
			#include <avr32/io.h>			
 | 
			
		||||
		#endif
 | 
			
		||||
 | 
			
		||||
		#include "../V2Protocol.h"
 | 
			
		||||
		#include "XPROGProtocol.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -174,7 +174,7 @@ CPPSRC =
 | 
			
		||||
#     Even though the DOS/Win* filesystem matches both .s and .S the same,
 | 
			
		||||
#     it will preserve the spelling of the filenames, and gcc itself does
 | 
			
		||||
#     care about how the name is spelled on its command-line.
 | 
			
		||||
ASRC =
 | 
			
		||||
ASRC = 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Optimization level, can be [0, 1, 2, 3, s].
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user