00001
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef _CONF_USB_H_
00049 #define _CONF_USB_H_
00050
00051 #include "compiler.h"
00052 #include "board.h"
00053 #include "print_funcs.h"
00054 #include "usb_ids.h"
00055
00056
00060
00061
00062
00067
00071 #define USB_HOST_FEATURE ENABLED
00072
00076 #define USB_DEVICE_FEATURE ENABLED
00077
00078 #if (defined __GNUC__) && (defined __AVR32__) && \
00079 ((defined __AVR32_UC3A364__) || (defined __AVR32_UC3A364S__) || \
00080 (defined __AVR32_UC3A3128__) || (defined __AVR32_UC3A3128S__) || \
00081 (defined __AVR32_UC3A3256__) || (defined __AVR32_UC3A3256S__))
00082 # define USB_HIGH_SPEED_SUPPORT ENABLED
00083
00084 #elif (defined __ICCAVR32__) && \
00085 ((defined __AT32UC3A364__) || (defined __AT32UC3A364S__) || \
00086 (defined __AT32UC3A3128__) || (defined __AT32UC3A3128S__) || \
00087 (defined __AT32UC3A3256__) || (defined __AT32UC3A3256S__))
00088 # define USB_HIGH_SPEED_SUPPORT ENABLED
00089 #else
00090 # define USB_HIGH_SPEED_SUPPORT DISABLED
00091 #endif
00092
00094
00095
00096
00097
00101
00102 #if USB_HOST_FEATURE == ENABLED
00103
00112 #define VID_PID_TABLE {ATMEL_VID, 1, HID_EXAMPLE_PID}
00113
00124 #define CLASS_SUBCLASS_PROTOCOL {HID_CLASS, BOOT_SUBCLASS, KEYBOARD_PROTOCOL,\
00125 HID_CLASS, NO_SUBCLASS, KEYBOARD_PROTOCOL,\
00126 HID_CLASS, BOOT_SUBCLASS, MOUSE_PROTOCOL,\
00127 HID_CLASS, NO_SUBCLASS, MOUSE_PROTOCOL}
00128
00130 #define SIZEOF_DATA_STAGE 250
00131
00133 #define DEVICE_ADDRESS 0x05
00134
00136 #define MAX_INTERFACE_SUPPORTED 0x03
00137
00139 #define MAX_EP_PER_INTERFACE 3
00140
00144 #define HOST_STRICT_VID_PID_TABLE DISABLE
00145
00147 #define HOST_AUTO_CFG_ENDPOINT ENABLE
00148
00150 #define HOST_CONTINUOUS_SOF_INTERRUPT DISABLE
00151
00153 #define HOST_ERROR_RESTART ENABLE
00154
00156 #define USB_HOST_PIPE_INTERRUPT_TRANSFER DISABLE
00157
00159 #define ID_PIN_CHANGE_GENERATE_RESET ENABLE
00160
00162 #define TIMEOUT_DELAY_ENABLE ENABLE
00163
00165 #define TIMEOUT_DELAY 10
00166
00168 #define NAK_TIMEOUT_ENABLE DISABLE
00169
00171 #define NAK_SEND_TIMEOUT 0x0FFF
00172
00174 #define NAK_RECEIVE_TIMEOUT 0x0FFF
00175
00176 #if HOST_AUTO_CFG_ENDPOINT == DISABLE
00178 #define User_configure_endpoint()
00179 #endif
00180
00184
00185
00186 #define Usb_id_transition_action()
00187 #define Host_device_disconnection_action() (mouse_hid_new_device_connected = FALSE, mouse_hid_connected = FALSE)
00188 #define Host_device_connection_action()
00189 #define Host_sof_action() host_sof_action()
00190 #define Host_suspend_action()
00191 #define Host_hwup_action()
00192 #define Host_device_supported_action()
00193 #define Host_device_not_supported_action()
00194 #define Host_new_device_connection_action() (mouse_hid_new_device_connected = TRUE)
00195 #define Host_device_class_not_supported_action()
00196 #define Host_device_error_action()
00197
00202 #define Host_user_check_class_action(x)
00204
00205 extern Bool keyboard_hid_new_device_connected;
00206 extern Bool keyboard_hid_connected;
00207 extern volatile Bool mouse_hid_new_device_connected;
00208 extern volatile Bool mouse_hid_connected;
00209 extern void host_sof_action(void);
00210 extern void host_suspend_action(void);
00211
00212 #endif // USB_HOST_FEATURE == ENABLED
00213
00215
00216
00217
00218
00222
00223 #if USB_DEVICE_FEATURE == ENABLED
00224
00225 #define NB_ENDPOINTS 2 // Number of endpoints in the application including control endpoint
00226 #define EP_HID_MOUSE_IN 1
00227
00231
00232
00233 #define Usb_sof_action() usb_sof_action()
00234 #define Usb_wake_up_action()
00235 #define Usb_resume_action()
00236 #define Usb_suspend_action()
00237 #define Usb_reset_action()
00238 #define Usb_vbus_on_action()
00239 #define Usb_vbus_off_action()
00240 #define Usb_set_configuration_action()
00242
00243 extern void usb_sof_action(void);
00244 extern void usb_suspend_action(void);
00245
00246 #endif // USB_DEVICE_FEATURE == ENABLED
00247
00249
00250
00252 #define USB_INT_LEVEL AVR32_INTC_INT0
00253
00255 #define LOG_STR(str) //print_dbg(str)
00256
00257
00259
00260
00261 #endif // _CONF_USB_H_