📄 fw_chap9.lst
字号:
##############################################################################
# #
# IAR ARM ANSI C/C++ Compiler V4.31A/W32 EVALUATION 29/Nov/2007 16:53:57 #
# Copyright 1999-2005 IAR Systems. All rights reserved. #
# #
# Cpu mode = interwork #
# Endian = little #
# Stack alignment = 4 #
# Source file = G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\MASSSTORAGE\fw_cha #
# p9.c #
# Command line = G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\MASSSTORAGE\fw_cha #
# p9.c -D AT91SAM7X256 -D PULL_UP_USB -D USE_LED -lC #
# "G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\Binary\List\" -o #
# "G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\Binary\Obj\" -z9 --debug --cpu_mode #
# thumb --endian little --cpu ARM7TDMI --stack_align #
# 4 --interwork -e --fpu None --dlib_config #
# "C:\Program Files\IAR Systems\Embedded Workbench #
# 4.0 Evaluation\ARM\LIB\dl4tptinl8f.h" -I #
# "G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\srcIAR\" -I #
# "G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\..\src\" -I #
# "G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\..\..\" -I #
# "G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\..\..\FILESYSTEM\inc\" -I #
# "G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\..\..\MASSSTORAGE\inc\" -I #
# "G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\..\..\AT91SAM7X256\" -I #
# "G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\..\inc\" -I #
# "G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\..\..\mmc_sd\" -I #
# "G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\..\..\COMMON_FS_MS\" -I "C:\Program #
# Files\IAR Systems\Embedded Workbench 4.0 #
# Evaluation\ARM\INC\" #
# List file = G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\Binary\List\fw_chap9.lst #
# Object file = G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\AT91SAM7X-Mass #
# Storage\compil\Binary\Obj\fw_chap9.r79 #
# #
# #
##############################################################################
G:\AT91_ENERGY\ATMEL_ARM\x256_mmc\MASSSTORAGE\fw_chap9.c
1 // ----------------------------------------------------------------------------
2 // ATMEL Microcontroller Software Support - ROUSSET -
3 // ----------------------------------------------------------------------------
4 // DISCLAIMER: CONDITIONS AS PER SIGNED LIMITED LICENSE AGREEMENT (AT91
5 // SOFTWARE AND USER DOCUMENTATION)
6 // ALL SOFTWARE IS PROVIDED AS IS, WITH ALL FAULTS, AND WITH NO WARRANTY
7 // WHATSOEVER. ATMEL EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESS, IMPLIED,
8 // OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OF MERCHANTABILITY,
9 // FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.
10 // ----------------------------------------------------------------------------
11 // File Name : fw_chap9.c
12 // Object : 11.24.1 Standard Requests
13 // (chapter9 of USB spec),class and vendor requests usb_20.pdf
14 //
15 // Creation : JCB 27/oct/2002
16 // Modif : JCB 18/fev/2005
17 // JCB 18/mar/2005 Device descriptor update
18 // JCB 27/avr/2005
19 //----------------------------------------------------------------------------
20 #include "po_types.h"
21 #include "trace.h"
22 #include "fw_usb.h"
23 #include "po_kernel.h"
24 #include "ms_device.h"
25 #include "ms_rbc.h"
26
27 //
28 // Table 11-14. Hub Responses to Standard Device Requests
29 // 9.4.1 Clear Feature ( CLEAR_FEATURE )
30 // 9.4.2 Get Configuration ( GET_CONFIGURATION )
31 // 9.4.3 Get Descriptor ( GET_DESCRIPTOR )
32 // 9.4.4 Get Interface ( GET_INTERFACE )
33 // 9.4.5 Get Status ( GET_STATUS )
34 // 9.4.6 Set Address ( SET_ADDRESS )
35 // 9.4.7 Set Configuration ( SET_CONFIGURATION )
36 // //SET_DESCRIPTOR Optional
37 // 9.4.9 Set Feature ( SET_FEATURE )
38 // 9.4.10 Set Interface ( SET_INTERFACE )
39 // //SYNCH_FRAME Undefined. Hubs are not allowed to have isochronous endpoints.
40 //
41
42 #ifndef AT91SAM9265
43 #define AT91C_EPT_DIR_OUT ((unsigned int) 0x0 << 8) // (UDP_EPT) Direction OUT
44 #define AT91C_EPT_DIR_IN ((unsigned int) 0x1 << 8) // (UDP_EPT) Direction IN
45 #endif
46
47
\ In segment DATA_I, align 4, align-sorted
48 USB_DEVICE_DESCRIPTOR fw_device =
\ fw_device:
\ 00000000 DS8 20
\ 00000014 REQUIRE `?<Initializer for fw_device>`
49 {
50 sizeof(USB_DEVICE_DESCRIPTOR), // Size of this descriptor in bytes
51 USB_DEVICE_DESCRIPTOR_TYPE, // DEVICE Descriptor Type
52 0x0200, // USB Specification Release Number in Binary-Coded Decimal
53 0, // Class code (assigned by the USB-IF).
54 0, // Subclass code (assigned by the USB-IF).
55 0, // Protocol code (assigned by the USB-IF).
56 FW_EP0_MAXPACKET_SIZE, // Maximum packet size for endpoint zero
57 FW_VENDOR_ID, // Vendor ID (assigned by the USB-IF)
58 FW_PRODUCT_ID, // Product ID (assigned by the manufacturer)
59 FW_BCDDEVICE, // Device release number in binary-coded decimal
60 FW_MANUFACTURER, // Index of string descriptor describing manufacturer
61 FW_PRODUCT, // Index of string descriptor describing product
62 FW_SERIALNUMBER, // Index of string descriptor describing the device抯 serial number
63 FW_NUMCONFIGURATION // Number of possible configurations
64 };
65
66 FW_FULL_CONFIG_DESCRIPTOR fw_config =
\ fw_config:
\ 00000014 DS8 32
\ 00000034 REQUIRE `?<Initializer for fw_config>`
67 {
68 { // Standard Configuration Descriptor
69 sizeof(USB_CONFIGURATION_DESCRIPTOR), // Size of this descriptor in bytes
70 USB_CONFIGURATION_DESCRIPTOR_TYPE, // CONFIGURATION Descriptor Type
71 sizeof(FW_FULL_CONFIG_DESCRIPTOR), // Total length of data returned for this configuration.
72 1, // Number of interfaces supported by this configuration
73 1, // Value to use as an argument to the SetConfiguration() request to select this configuration
74 0, // Index of string descriptor describing this configuration
75 USB_CONFIG_BUS_NOWAKEUP, // attribute : Bus-powered, no wakeup
76 0x64 // Maximum power consumption (in 2mA unit, so 0x64 =100= 200mA)
77 },
78
79 /* Data interface */
80 {
81 // Standard Interface Descriptor
82 sizeof(USB_INTERFACE_DESCRIPTOR), // Size of this descriptor in bytes
83 USB_INTERFACE_DESCRIPTOR_TYPE, // INTERFACE Descriptor Type
84 0x00, // Number of this interface
85 0, // Value used to select this alternate setting for the interface identified in the prior field
86 2, // Number of endpoints used by this interface (excluding endpoint zero).
87 USB_DEVICE_CLASS_MASS_STORAGE_MSC, // Class code (assigned by the USB-IF) : USB Mass Storage
88 SUBCLASSCODE_SCSI, // Subclass code (assigned by the USB-IF): SCSI transparent command set : usb_msc_overview_1.2.pdf
89 PROTOCOL_BULK_ONLY_TRANSPORT, // Protocol code (assigned by the USB) : Bulk-Only transport : usb_msc_overview_1.2.pdf
90 0 // Index of string descriptor describing this interface
91 },
92 {
93 // Standard Endpoint Descriptor
94 sizeof(USB_ENDPOINT_DESCRIPTOR), // Size of this descriptor in bytes
95 USB_ENDPOINT_DESCRIPTOR_TYPE, // ENDPOINT Descriptor Type
96 0x81, // The address of the endpoint on the USB device described by this descriptor : Endpoint 1, direction IN
97 USB_ENDPOINT_TYPE_BULK, // This field describes the endpoint抯 attributes when it is configured using the bConfigurationValue.
98 FW_MAIN_EP_MAXPACKET_SIZE, // Maximum packet size this endpoint is capable of sending or receiving when this configuration is selected.
99 0 // Interval for polling endpoint for data transfers.
100 },
101 {
102 // Standard Endpoint Descriptor
103 sizeof(USB_ENDPOINT_DESCRIPTOR), // Size of this descriptor in bytes
104 USB_ENDPOINT_DESCRIPTOR_TYPE, // ENDPOINT Descriptor Type
105 0x02, // The address of the endpoint on the USB device described by this descriptor : Endpoint 2, direction OUT
106 USB_ENDPOINT_TYPE_BULK, // This field describes the endpoint抯 attributes when it is configured using the bConfigurationValue.
107 FW_MAIN_EP_MAXPACKET_SIZE, // Maximum packet size this endpoint is capable of sending or receiving when this configuration is selected.
108 0 // Interval for polling endpoint for data transfers.
109 }
110 };
111
112 /* Global variable for have the stall status on endpoint */
\ In segment DATA_Z, align 1, align-sorted
113 UCHAR stallEndpointStatus = 0;
\ stallEndpointStatus:
\ 00000000 DS8 1
114
115
116 /*****************************************************************
117 *
118 * ROUTINE fw_clearFeature
119 *
120 *-----------------------------------------------------------------
121 *
122 * Purpose :
123 * 9.4.1 Clear Feature ( CLEAR_FEATURE )
124 * This request is used to clear or disable a specific feature.
125 *
126 * Input parameters : NONE
127 *
128 * Output parameters : NONE
129 *
130 * Global data : fw_controlData : request to be processed
131 *
132 *****************************************************************/
\ In segment CODE, align 4, keep-with-next
133 void fw_clearFeature(void)
134 {
\ fw_clearFeature:
\ 00000000 70B5 PUSH {R4-R6,LR}
135 EPx _endp;
136 UCHAR _bRecipient = fw_controlData.DeviceRequest.bmRequestType & FW_USB_RECIPIENT;
137
138 TRACE_DEBUG_H( "clFeat\n\r");
139 if (_bRecipient == FW_USB_RECIPIENT_ENDPOINT
140 && fw_controlData.DeviceRequest.wValue == USB_FEATURE_ENDPOINT_HALT)
\ 00000002 .... LDR R5,??DataTable12 ;; fw_controlData
\ 00000004 6888 LDRH R0,[R5, #+2]
\ 00000006 .... LDR R6,??DataTable11 ;; stallEndpointStatus
\ 00000008 2978 LDRB R1,[R5, #+0]
\ 0000000A C906 LSL R1,R1,#+27
\ 0000000C C90E LSR R1,R1,#+27
\ 0000000E 0229 CMP R1,#+2
\ 00000010 2CD1 BNE ??fw_clearFeature_0
\ 00000012 0028 CMP R0,#+0
\ 00000014 2AD1 BNE ??fw_clearFeature_0
141 {
142 _endp = (EPx)(fw_controlData.DeviceRequest.wIndex & (FW_EP_CTRL | FW_EP_BULK_IN | FW_EP_BULK_OUT));
\ 00000016 A888 LDRH R0,[R5, #+4]
\ 00000018 8407 LSL R4,R0,#+30
\ 0000001A A40F LSR R4,R4,#+30
143 fw_setEndpointStatus(_endp, 0);
\ 0000001C 0021 MOV R1,#+0
\ 0000001E 201C MOV R0,R4
\ 00000020 ........ _BLF fw_setEndpointStatus,??fw_setEndpointStatus??rT
144 stallEndpointStatus &= ~(1<<_endp);
\ 00000024 3078 LDRB R0,[R6, #+0]
\ 00000026 0121 MOV R1,#+1
\ 00000028 A140 LSL R1,R4
\ 0000002A 8843 BIC R0,R1
\ 0000002C 3070 STRB R0,[R6, #+0]
145
146 if (fw_controlData.DeviceRequest.wIndex & (UCHAR)USB_ENDPOINT_DIRECTION_MASK)
\ 0000002E 0020 MOV R0,#+0
\ 00000030 1749 LDR R1,??fw_clearFeature_1 ;; 0xfffb0028
\ 00000032 .... LDR R2,??DataTable14 ;; USB_EVENT
\ 00000034 AB88 LDRH R3,[R5, #+4]
\ 00000036 1B06 LSL R3,R3,#+24
\ 00000038 1378 LDRB R3,[R2, #+0]
\ 0000003A 04D5 BPL ??fw_clearFeature_2
147 {
148 /* clear TX stall for IN on EPn. */
149 USB_EVENT |= USB_EVENT_MASK_IN_STALL_CLEARED;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -