conf_usb.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
#ifndef _CONF_USB_H_
00015
#define _CONF_USB_H_
00016
00017 #define USB_HS DISABLE
00018
#include "modules/usb/usb_enum.h"
00019
00020 #define USB_NORMAL_SPEED
00021 #define USB_FULL_SPEED Usb_force_full_speed()
00022 #define USB_HIGH_SPEED Usb_force_high_spedd()
00023 #define USB_FULL_SPEED_UTMI Usb_force_full_speed_utmi()
00024
00025 #define Usb_set_speed() USB_FULL_SPEED
00026
00027 #define EP_HID_IN 1
00028 #define EP_HID_OUT 2
00029 #define LENGTH_OF_REPORT 0x20
00030
00031
00032
00033
00034 #define Usb_suspend_action() Set_power_down_mode(); // go to powerdown
00035
00036
00037
00038
00039
00040
00041 #define USB_SPECIFICATION 0x0002
00042 #define DEVICE_CLASS 0 // each configuration has its own class
00043 #define DEVICE_SUB_CLASS 0 // each configuration has its own sub-class
00044 #define DEVICE_PROTOCOL 0 // each configuration has its own protocol
00045 #define EP_CONTROL_LENGTH 32
00046 #define VENDOR_ID 0xEB03 // Atmel vendor ID = 03EBh
00047 #define PRODUCT_ID 0x1320 // Product ID: 2013h = USB HID Generic
00048 #define RELEASE_NUMBER 0x0003
00049 #define MAN_INDEX 0x01
00050 #define PROD_INDEX 0x02
00051 #define SN_INDEX 0x03
00052 #define NB_CONFIGURATION 1
00053
00054
00055
00056 #define NB_INTERFACE_FS 1
00057 #define CONF_NB_FS 1
00058 #define CONF_INDEX_FS 0
00059 #define CONF_ATTRIBUTES_FS USB_CONFIG_BUSPOWERED
00060 #define MAX_POWER_FS 50 // 100 mA
00061
00062
00063 #define INTERFACE_NB_FS 0
00064 #define ALTERNATE_FS 0
00065 #define NB_ENDPOINT_FS 2
00066 #define INTERFACE_CLASS_FS 0x03 // HID
00067 #define INTERFACE_SUB_CLASS_FS 0
00068 #define INTERFACE_PROTOCOL_FS 0
00069 #define INTERFACE_INDEX_FS 0
00070
00071
00072 #define ENDPOINT_NB_1_FS (EP_HID_IN | 0x80)
00073 #define EP_ATTRIBUTES_1_FS 0x03 // INTERRUPT = 0x02
00074 #define EP_IN_LENGTH_FS LENGTH_OF_REPORT
00075 #define EP_SIZE_1_FS (wSWAP(EP_IN_LENGTH_FS))
00076 #define EP_INTERVAL_1_FS 0x01
00077
00078
00079 #define ENDPOINT_NB_2_FS (EP_HID_OUT)
00080 #define EP_ATTRIBUTES_2_FS 0x03 // INTERRUPT = 0x02
00081 #define EP_OUT_LENGTH_FS LENGTH_OF_REPORT
00082 #define EP_SIZE_2_FS (wSWAP(EP_OUT_LENGTH_FS))
00083 #define EP_INTERVAL_2_FS 0x01
00084
00085
00086 #define SIZE_OF_REPORT 0x35
00087
00088 typedef struct
00089
{
00090 S_usb_configuration_descriptor cfg;
00091 S_usb_interface_descriptor ifc;
00092 S_usb_hid_descriptor hid;
00093 S_usb_endpoint_descriptor ep1;
00094 S_usb_endpoint_descriptor ep2;
00095 }
S_usb_user_configuration_descriptor;
00096
00097 #define NB_ENDPOINTS 3 // number of endpoints in the application
00098
00099
00100
00101 #define ENDPOINT_0 0x00 // OUT EP
00102
00103 #define NB_CONFIGURATIONS 0x01
00104 #define DEVICE_STATUS 0x00 // TBD
00105 #define INTERFACE_STATUS 0x00 // TBD
00106
00107
#define LANGUAGE_ID 0x0904
00108
00109 #define USB_MANUFACTURER_NAME \
00110
{ 'A'<<8 \
00111
, 'T'<<8 \
00112
, 'M'<<8 \
00113
, 'E'<<8 \
00114
, 'L'<<8 \
00115
}
00116
00117 #define USB_PRODUCT_NAME \
00118
Usb_str_28('A', 'T', '8', '9', 'C', '5', \
00119
'1', '3', '1', ' ', \
00120
'-', ' ', 'U', 'S', 'B', ' ', 'H', \
00121
'I', 'D', ' ', 'G', 'e', 'n', \
00122
'e', 'r', 'i', 'c', ' ' \
00123
)
00124
00125
00126 #define USB_SERIAL_NUMBER \
00127
{ '1'<<8 \
00128
, '.'<<8 \
00129
, '3'<<8 \
00130
, '.'<<8 \
00131
, '5'<<8 \
00132
, '.'<<8 \
00133
, '7'<<8 \
00134
, '.'<<8 \
00135
, '9'<<8 \
00136
, '.'<<8 \
00137
, 'B'<<8 \
00138
, '.'<<8 \
00139
, 'D'<<8 \
00140
}
00141
00142 #define HID_DESCRIPTOR 0x21
00143 #define HID_BDC 0x1001
00144 #define HID_COUNTRY_CODE 0x00
00145 #define HID_CLASS_DESC_NB 0x01
00146 #define HID_DESCRIPTOR_TYPE 0x22
00147 #define HID_DESCRIPTOR_LENGTH (wSWAP((U16)0x34))
00148
00149 #define LANGUAGE_ID 0x0904
00150
00151
00152 #define USB_MN_LENGTH 5
00153
00154
00155
00156 typedef struct {
00157 U8 bLength;
00158 U8 bDescriptorType;
00159 U16 wstring[
USB_MN_LENGTH];
00160 }
S_usb_manufacturer_string_descriptor;
00161
00162
00163
00164
00165 #define USB_PN_LENGTH 28
00166
00167
00168 typedef struct {
00169 U8 bLength;
00170 U8 bDescriptorType;
00171 U16 wstring[
USB_PN_LENGTH];
00172 }
S_usb_product_string_descriptor;
00173
00174
00175
00176
00177 #define USB_SN_LENGTH 13
00178
00179
00180 typedef struct {
00181 U8 bLength;
00182 U8 bDescriptorType;
00183 U16 wstring[
USB_SN_LENGTH];
00184 }
S_usb_serial_number;
00185
00186
00187
00188
00189
00190
00191 #define Usb_sof_action()
00192 #define Usb_wake_up_action()
00193 #define Usb_resume_action()
00194
00195 #define Usb_reset_action()
00196 #define Usb_vbus_on_action()
00197 #define Usb_vbus_off_action()
00198 #define Usb_set_configuration_action()
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208 #define Scsi_start_read_action()
00209 #define Scsi_stop_read_action() //mail_push( MAILBOX_USE_EVT , EVT_MASS_STORAGE_READ | (TASK_MMI << 8) , NULL);
00210 #define Scsi_start_write_action()
00211 #define Scsi_stop_write_action() //mail_push( MAILBOX_USE_EVT , EVT_MASS_STORAGE_WRITE | (TASK_MMI << 8) , NULL);
00212
00213
00214
00215 #define STANDARD_PORT 0
00216 #define LED_PORT_2MA 1
00217 #define LED_PORT_4MA 2
00218 #define LED_PORT_10MA 3
00219
00220
00221 #define Wdt_immediate_reset() ((WDTRST = 0x1E), \
00222
(WDTRST = 0xE1), \
00223
(WDTRST = 0x3C), \
00224
(WDTRST = 0xC3))
00225
00226
00227 #define Wdt_refresh() ((WDTRST = 0x1E), \
00228
(WDTRST = 0xE1))
00229
00230 #define Configure_led(num,type) {LEDCON &= (0xFF & ~(0x03 << (num*2))); \
00231
LEDCON |= (type << (num*2));}
00232
00233 #define Led_0_on() (P3_3 = 0)
00234 #define Led_0_off() (P3_3 = 1)
00235 #define Led_0_toggle() (P3_3 = ~P3_3)
00236 #define Led_0_status() (P3_3)
00237 #define Led_0_write(x) (P3_3 = x)
00238 #define Led_1_on() (P3_5 = 0)
00239 #define Led_1_off() (P3_5 = 1)
00240 #define Led_1_toggle() (P3_5 = ~P3_5)
00241 #define Led_1_status() (P3_5)
00242 #define Led_1_write(x) (P3_5 = x)
00243 #define Led_2_on() (P3_6 = 0)
00244 #define Led_2_off() (P3_6 = 1)
00245 #define Led_2_toggle() (P3_6 = ~P3_6)
00246 #define Led_2_status() (P3_6)
00247 #define Led_2_write(x) (P3_6 = x)
00248 #define Led_3_on() (P3_7 = 0)
00249 #define Led_3_off() (P3_7 = 1)
00250 #define Led_3_toggle() (P3_7 = ~P3_7)
00251 #define Led_3_status() (P3_7)
00252 #define Led_3_write(x) (P3_7 = x)
00253
00254
00255 #define Led_all_on() (P3 &= 0x17)
00256 #define Led_all_off() (P3 |= ~0x17)
00257
00258
00259
00260
00261
#endif
00262
00263
Generated on Mon Apr 10 17:23:29 2006 for Atmel by
1.3.7