bzr branch
http://bzr.ed.am/elec/audio-switcher
1
by Tim Marston
initial commit |
1 |
/* |
7
by Tim Marston
cleaned up project |
2 |
|
3 |
AUDIO SWITCHER |
|
4 |
||
5 |
Based on a serial device demonstration from the LUFA project |
|
6 |
(www.lufa-lib.org). LUFA is Copyright (C) Dean Camera, 2012. |
|
7 |
||
8 |
Changes made to the serial device demonstration program are |
|
9 |
Copyright (C) Tim Marston, 2012. |
|
10 |
||
11 |
For more information: |
|
12 |
* see README, or |
|
13 |
* visit http://ed.am/ |
|
14 |
||
1
by Tim Marston
initial commit |
15 |
*/ |
16 |
||
17 |
/* |
|
18 |
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
|
19 |
||
20 |
Permission to use, copy, modify, distribute, and sell this |
|
21 |
software and its documentation for any purpose is hereby granted |
|
22 |
without fee, provided that the above copyright notice appear in |
|
23 |
all copies and that both that the copyright notice and this |
|
24 |
permission notice and warranty disclaimer appear in supporting |
|
25 |
documentation, and that the name of the author not be used in |
|
26 |
advertising or publicity pertaining to distribution of the |
|
27 |
software without specific, written prior permission. |
|
28 |
||
29 |
The author disclaim all warranties with regard to this |
|
30 |
software, including all implied warranties of merchantability |
|
31 |
and fitness. In no event shall the author be liable for any |
|
32 |
special, indirect or consequential damages or any damages |
|
33 |
whatsoever resulting from loss of use, data or profits, whether |
|
34 |
in an action of contract, negligence or other tortious action, |
|
35 |
arising out of or in connection with the use or performance of |
|
36 |
this software. |
|
37 |
*/ |
|
38 |
||
39 |
/** \file |
|
40 |
* |
|
41 |
* Header file for Descriptors.c. |
|
42 |
*/ |
|
43 |
||
44 |
#ifndef _DESCRIPTORS_H_ |
|
45 |
#define _DESCRIPTORS_H_ |
|
46 |
||
47 |
/* Includes: */ |
|
48 |
#include <avr/pgmspace.h> |
|
49 |
||
50 |
#include <LUFA/Drivers/USB/USB.h> |
|
51 |
||
52 |
/* Macros: */ |
|
53 |
/** Endpoint address of the CDC device-to-host notification IN endpoint. */ |
|
54 |
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2) |
|
55 |
||
56 |
/** Endpoint address of the CDC device-to-host data IN endpoint. */ |
|
57 |
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3) |
|
58 |
||
59 |
/** Endpoint address of the CDC host-to-device data OUT endpoint. */ |
|
60 |
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4) |
|
61 |
||
62 |
/** Size in bytes of the CDC device-to-host notification IN endpoint. */ |
|
63 |
#define CDC_NOTIFICATION_EPSIZE 8 |
|
64 |
||
65 |
/** Size in bytes of the CDC data IN and OUT endpoints. */ |
|
66 |
#define CDC_TXRX_EPSIZE 16 |
|
67 |
||
68 |
/* Type Defines: */ |
|
69 |
/** Type define for the device configuration descriptor structure. This must be defined in the |
|
70 |
* application code, as the configuration descriptor contains several sub-descriptors which |
|
71 |
* vary between devices, and which describe the device's usage to the host. |
|
72 |
*/ |
|
73 |
typedef struct |
|
74 |
{ |
|
75 |
USB_Descriptor_Configuration_Header_t Config; |
|
76 |
||
77 |
// CDC Control Interface |
|
78 |
USB_Descriptor_Interface_t CDC_CCI_Interface; |
|
79 |
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header; |
|
80 |
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM; |
|
81 |
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union; |
|
82 |
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint; |
|
83 |
||
84 |
// CDC Data Interface |
|
85 |
USB_Descriptor_Interface_t CDC_DCI_Interface; |
|
86 |
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint; |
|
87 |
USB_Descriptor_Endpoint_t CDC_DataInEndpoint; |
|
88 |
} USB_Descriptor_Configuration_t; |
|
89 |
||
90 |
/* Function Prototypes: */ |
|
91 |
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, |
|
92 |
const uint8_t wIndex, |
|
93 |
const void** const DescriptorAddress) |
|
94 |
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); |
|
95 |
||
96 |
#endif |
|
97 |