📄 bulk_only.lst
字号:
C51 COMPILER V7.50 BULK_ONLY 03/16/2006 09:11:14 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE BULK_ONLY
OBJECT MODULE PLACED IN bulk_only.OBJ
COMPILER INVOKED BY: C:\Program Files\keil\C51\BIN\C51.EXE bulk_only.c LARGE BROWSE DEBUG OBJECTEXTEND
line level source
1 /*
2 * Copyright (c) 2004,北京博创兴业科技有限公司
3 * All rights reserved.
4 *
5 * 文件名称:bulk_only.c
6 * 文件标识:bulk_only
7 * 摘 要:批量传输函数定义
8 *
9 * 当前版本:2.0
10 * 作 者:Kent
11 * 完成日期:2004年5月20日
12 *
13 * 取代版本:1.1
14 * 原作者 :Frank
15 * 完成日期:2003年8月10日
16 */
17
18 //this file to process the request about bulk_only
19 #include <string.h>
20
21 #include "bulk_only.h"
22 #include "fat16.h"
23 #include "usbdisk.h"
24 #include "uart.h"
25 #include "flash.h"
26
27 //extern unsigned char EpBuf[];
28
29 long unsigned int dDataResiduce = 0;
30 unsigned char bulk_state = 0; //当前传送状态
31 unsigned char *pCurrentBuf; //数据传送指针
32 long int nBufCount = 0; //传送数据当前位置
33
34
35 unsigned char MSC_dCBWSignature[] = {0x55, 0x53, 0x42, 0x43};
36 unsigned char MSC_dCSWSignature[] = {0x55, 0x53, 0x42, 0x53};
37
38 #define Format_Unit 0x04
39 #define Inquiry 0x12
40 #define Mode_Select 0x55
41 #define Mode_Sense 0x1A
42 #define Medium_Removal 0x1E
43 #define Read10 0x28
44 #define Read12 0xA8
45 #define Read_Capacity 0x25
46 #define Read_Format_Capacities 0x23
47 #define Request_Sense 0x03
48 #define Rezero 0x01
49 #define Seek10 0x2B
50 #define Send_Diag 0x1D
51 #define Start_Stop_Unit 0x1B
52 #define Test_Unit_Ready 0x00
53 #define Verify 0x2F
54 #define Write10 0x2A
55 #define Write12 0xAA
C51 COMPILER V7.50 BULK_ONLY 03/16/2006 09:11:14 PAGE 2
56 #define Write_And_Verify 0x2E
57
58
59
60
61 #define SCSI_MSPGCD_TPP 0x1c
62 #define SCSI_MSPGCD_RETALL 0x3f
63
64 unsigned char Bulk_Out_Buf[64];
65 unsigned char Page_Buf[512];
66
67
68 short int Transfer_Length;
69 long int Logical_Block_Address;
70 long int nCurrentPage,nBeginPage;
71 long int nCurrentBlock;
72 code unsigned char B_InquiryData[] = {
73 0x00, //Direct Access Device
74 0x80, //RMB
75 0x00, //ISO/ECMA/ANSI
76 0x01, //Response Data Format
77 0x1f, //Additional Length
78 0x00, //Reserved
79 0x00, //Reserved
80 0x00, //Reserved
81 'U', 'P', '-', 'T', 'E', 'C', 'H', ' ', //Vendor Information
82 'M', 'P', '3', ' ', 'P', 'l', 'a', 'y', 'e', 'r', ' ', 'V', '1', '.', '0', '0',//Product Identifica
-tion
83 0, 0, 0, 0}; //Product Revision Level n.nn
84
85 code unsigned char CapactiyLstHd[] = {0x00, 0x00, 0x00, 0x10};
86 code unsigned char bBlockLength[] = {0x00, 0x02, 0x00}; //512 Byte
87 code unsigned char nLastLBAddr[] = {0x00, 0x01, 0xf3, 0xff}; //Last Logical Block Address for 64MB
88 code unsigned char B_Read_Format_capacities[] = {0x00, 0x00, 0x00, 0x10, //capacity list header
89 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, //capacity descriptor
90 // Number of Blocks =1024,unformatted media,blocklength = 512Bytes
91 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00 //Formattable Capacity Descriptors
92 };
93
94 code unsigned char B_Read_Capacity[] = {
95 0x00, 0x00, 0xff, 0xe0, //Last Logical Block Address for 64MB
96 0x00, 0x00, 0x02, 0x00 //block length in bytes
97 };
98
99 /*
100 code unsigned char B_Mode_Sense_ALL[]={0x00,0x3e,//Mode Data Length
101 0x00, //Medium Type Code
102 0,//write enabled
103 0,0,0,0,//reserved
104 //Read-Write Eroor Recovery Page
105 0x01, //Page Code of Read-Write Error Recovery Page
106 0x0a, //Page Length
107 0, //Error Recovery Parameters
108 3, //Read Retry Count
109 0,0,0,0,
110 3, //Write Retry Count
111 0,0,0,
112 //Flexible Disk Page
113 0x05, //Page Code of Flexible Disk Page
114 0x1e, //Page Length
115 0x13,0x88, //Transfer Rate = 512kbps
116 0, //Number of Heads磁头数
C51 COMPILER V7.50 BULK_ONLY 03/16/2006 09:11:14 PAGE 3
117 0, //Sectors per Track每磁道扇区数
118 0x02,0x00, //Data bytes per Sector每扇区字节数
119 0x00,0x00, //Number of Cuylinders柱面数
120 0,0,0,0,0,0,0,0,0,//Reserved 保留
121 1, //motor On Delay
122 0xff, //motor Off Delay=Never
123 0,0,0,0,0,0,0,//Reserved 保留
124 0x00,0x00, //Medium Rotation Rate介质旋转速率=300rpm
125 0,0, //Reserved 保留
126 //Removable Block Access Capabilities Page
127 0x1b, //Page Code
128 0x0a, //Page Length
129 0,//0x80, //SFLP=1
130 0x01, //TLUN=1
131 0,0,0,0,0,0,0,0//Reserved 保留
132 };
133 */
134
135 code unsigned char B_Mode_Sense_ALL[] = {0x0b, 0x00,//Mode Data Length
136 0x00, 0x08, 0x00, 0x00,
137 0x7d, 0, 0, 0, 0x02, 0x00
138 };
139 /*
140 code unsigned char B_Mode_Sense_TPP[]={0x00,0x0d,//Mode Data Length
141 0x00, //Medium Type Code
142 0,//write enabled
143 0,0,0,0,//reserved
144 0x1c,0x06,0,0x05,0,0,0,0
145 };
146 */
147 code unsigned char B_Mode_Sense_TPP[] = {0xf0,0x00,//Mode Data Length
148 05, 00, 00, 00, 00, 0x0b, 00, 00, 00, 00, 0x24, 00, 00, 00, 00, 00
149 };
150 code unsigned char B_Mode_Sense_ZERO[] = {0x00, 0x06,//Mode Data Length
151 0x00, //Medium Type Code
152 0,//write enabled
153 0, 0, 0, 0//reserved
154 };
155 unsigned char bulk_CSW[] = {0x55, 0x53, 0x42, 0x53, // bytes 4 dCSWSignature
156 0x00, 0x00, 0x00, 0x00, //bytes 4 dCSWTag
157 0, 0, 0, 0, //bytes 4 dDataResiduce
158 0x00
159 }; //bCSWStatus 00=good state.
160
161
162 typedef struct _STRUCT_CBW
163 {
164 unsigned char dCBWSignature[4];
165 unsigned char dCBWTag[4]; //dCBWTag of CBW
166 long unsigned int dCBWDataTransferLength;//dCBWDataTransferLength of CBW
167 unsigned char bmCBWFlags;
168 unsigned char bCBWLUN;
169 unsigned char bCBWCBLength;
170 unsigned char CBWCB[12];//for UFI Command all have 12bit
171 } struct_CBW;
172
173 struct_CBW bulk_CBW;
174
175 void InterpretCBW()
176 {
177 1 int i;
178 1 // printu("InterpretCBW");
C51 COMPILER V7.50 BULK_ONLY 03/16/2006 09:11:14 PAGE 4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -