Contiki 2.5
conf_usb.h
Go to the documentation of this file.
1 /* This file has been prepared for Doxygen automatic documentation generation.*/
2 /*! \file conf_usb.h **********************************************************
3  *
4  * \brief
5  * This file contains the possible external configuration of the USB.
6  *
7  * \addtogroup usbstick
8  *
9  * \author
10  * Atmel Corporation: http://www.atmel.com \n
11  * Support email: avr@atmel.com
12  *
13  ******************************************************************************/
14 /* Copyright (c) 2008 ATMEL Corporation
15  All rights reserved.
16 
17  Redistribution and use in source and binary forms, with or without
18  modification, are permitted provided that the following conditions are met:
19 
20  * Redistributions of source code must retain the above copyright
21  notice, this list of conditions and the following disclaimer.
22  * Redistributions in binary form must reproduce the above copyright
23  notice, this list of conditions and the following disclaimer in
24  the documentation and/or other materials provided with the
25  distribution.
26  * Neither the name of the copyright holders nor the names of
27  contributors may be used to endorse or promote products derived
28  from this software without specific prior written permission.
29 
30  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
34  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40  POSSIBILITY OF SUCH DAMAGE.
41 */
42 
43 #ifndef _CONF_USB_H_
44 #define _CONF_USB_H_
45 
46 
47 
48 /**
49  \ingroup usbstick
50  \defgroup usbconf USB Configuration
51  @{
52 */
53 
54 
55  // _________________ USB MODE CONFIGURATION ____________________________
56  //! @ingroup usbconf
57  //! @defgroup USB_op_mode USB operating modes configuration
58  //! defines to enable device or host usb operating modes
59  //! supported by the application
60  //! @{
61 
62  //! @brief ENABLE to activate the host software library support
63  //!
64  //! Possible values ENABLE or DISABLE
65  #define USB_HOST_FEATURE DISABLED
66 
67  //! @brief ENABLE to activate the device software library support
68  //!
69  //! Possible values ENABLE or DISABLE
70  #define USB_DEVICE_FEATURE ENABLED
71 
72  //! @}
73 
74  // _________________ USB REGULATOR CONFIGURATION _______________________
75  //! @ingroup usbconf
76  //! @defgroup USB_reg_mode USB regulator configuration
77  //! @{
78 
79  //! @brief Enable the internal regulator for USB pads
80  //!
81  //! When the application voltage is lower than 3.5V, to optimize power consumption
82  //! the internal USB pads regulatr can be disabled.
83 #ifndef USE_USB_PADS_REGULATOR
84  #define USE_USB_PADS_REGULATOR ENABLE // Possible values ENABLE or DISABLE
85 #endif
86  //! @}
87 
88 // _________________ DEVICE MODE CONFIGURATION __________________________
89 
90  //! @ingroup usbconf
91  //! @defgroup USB_device_mode_cfg USB device operating mode configuration
92  //!
93  //! @{
94 
95 /** USB RNDIS / Virtual com port setup **/
96 
97 #ifndef CDC_ECM_USES_INTERRUPT_ENDPOINT
98 #define CDC_ECM_USES_INTERRUPT_ENDPOINT 0
99 #endif
100 
101 #ifndef USB_ETH_EMULATE_WIFI
102 #define USB_ETH_EMULATE_WIFI 0
103 #endif
104 
105 #define NB_ENDPOINTS 7 //! number of endpoints in the application including control endpoint
106 #define VCP_RX_EP 0x06
107 #define VCP_TX_EP 0x05
108 #define VCP_INT_EP 0x04
109 #define TX_EP 0x01
110 #define RX_EP 0x02
111 #define INT_EP 0x03
112 
113 /** USB Mass Storage Setup **/
114 
115 #define NB_ENDPOINTS_MS 3 //! number of endpoints in the application including control endpoint
116 #define MS_IN_EP 0x01
117 #define MS_OUT_EP 0x02
118 
119 #define USB_LOW_SPEED_DEVICE DISABLE
120 
121 
122 #define Usb_unicode(a) ((U16)(a))
123 
124  //! @ingroup usbconf
125  //! @defgroup device_cst_actions USB device custom actions
126  //!
127  //! @{
128  // write here the action to associate to each USB event
129  // be carefull not to waste time in order not disturbing the functions
130 #define Usb_sof_action() /* sof_action(); */
131 #define Usb_wake_up_action()
132 #define Usb_resume_action()
133 #define Usb_suspend_action() suspend_action();
134 #define Usb_reset_action()
135 #define Usb_vbus_on_action()
136 #define Usb_vbus_off_action()
137 #define Usb_set_configuration_action()
138 
139 
140 // write here the action to associate to each SCSI event
141 // be carefull not to waste time in order not disturbing the functions
142 #define Scsi_start_read_action() Led1_on()
143 #define Scsi_stop_read_action() Led1_off()
144 #define Scsi_start_write_action() Led2_on()
145 #define Scsi_stop_write_action() Led2_off()
146 
147  //! @}
148 
149 extern void sof_action(void);
150 extern void suspend_action(void);
151  //! @}
152 
153 
154 /** @} */
155 
156 #endif // _CONF_USB_H_