demo_d.h
3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef __echo_h__
#define __echo_h__
/*HEADER******************************************************************
**************************************************************************
***
*** Copyright (c) 2001-2002 ARC International.
*** All rights reserved
***
*** This software embodies materials and concepts which are
*** confidential to ARC International and is made
*** available solely pursuant to the terms of a written license
*** agreement with ARC International
***
*** $Workfile:echo.h$
*** $Revision: 1.1 $
*** $Date: 2003/02/17 20:49:00 $
***
*** Description:
*** This file contains the VUSB32 demo application header.
***
**************************************************************************
*END*********************************************************************/
#define TOTAL_LOGICAL_ADDRESS_BLOCKS (720)
#define LENGTH_OF_EACH_LAB (512)
#define USB_DCBWSIGNATURE (0x43425355)
#define USB_DCSWSIGNATURE (0x53425355)
#define USB_CBW_DIRECTION_BIT (0x80)
/* USB 1.1 Setup Packet */
typedef struct setup_struct {
uint_8 REQUESTTYPE;
uint_8 REQUEST;
uint_16 VALUE;
uint_16 INDEX;
uint_16 LENGTH;
} SETUP_STRUCT, _PTR_ SETUP_STRUCT_PTR;
/* USB Command Block Wrapper */
typedef struct cbw_struct {
uint_32 DCBWSIGNATURE;
uint_32 DCBWTAG;
uint_32 DCBWDATALENGTH;
uchar BMCBWFLAGS;
/* 4 MSBs bits reserved */
uchar BCBWCBLUN;
/* 3 MSB reserved */
uchar BCBWCBLENGTH;
uchar CBWCB[16];
} CBW_STRUCT, _PTR_ CBW_STRUCT_PTR;
/* USB Command Status Wrapper */
typedef struct csw_struct {
uint_32 DCSWSIGNATURE;
uint_32 DCSWTAG;
uint_32 DCSWDATARESIDUE;
uchar BCSWSTATUS;
} CSW_STRUCT, _PTR_ CSW_STRUCT_PTR;
/* USB Mass storage Inquiry Command */
typedef struct mass_storage_inquiry {
uchar OPCODE;
uchar LUN;
uchar PAGE_CODE;
uchar RESERVED1;
uchar ALLOCATION_LENGTH;
uchar RESERVED2[7];
} MASS_STORAGE_INQUIRY_STRUCT, _PTR_ MASS_STORAGE_INQUIRY_PTR;
/* USB Mass storage READ CAPACITY Data */
typedef struct mass_storage_read_capacity {
uchar LAST_LOGICAL_BLOCK_ADDRESS[4];
uchar BLOCK_LENGTH_IN_BYTES[4];
} MASS_STORAGE_READ_CAPACITY_STRUCT, _PTR_ MASS_STORAGE_READ_CAPACITY_STRUCT_PTR;
/* USB Mass storage Device information */
typedef struct mass_storage_device_info {
uchar PERIPHERAL_DEVICE_TYPE; /* Bits 0-4. All other bits reserved */
uchar RMB; /* Bit 7. All other bits reserved */
uchar ANSI_ECMA_ISO_VERSION; /* ANSI: bits 0-2, ECMA: bits 3-5,
** ISO: bits 6-7
*/
uchar RESPONSE_DATA_FORMAT; /* bits 0-3. All other bits reserved */
uchar ADDITIONAL_LENGTH; /* For UFI device: always set to 0x1F */
uchar RESERVED1[3];
uchar VENDOR_INFORMATION[8];
uchar PRODUCT_ID[16];
uchar PRODUCT_REVISION_LEVEL[4];
} MASS_STORAGE_DEVICE_INFO_STRUCT, _PTR_ MASS_STORAGE_DEVICE_INFO_PTR;
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define BUFFERSIZE 1023
typedef struct double_buffer_struct { /* Body */
uint_8 buffer[2][BUFFERSIZE];
boolean whichbuffer;
} DOUBLE_BUFFER_STRUCT, _PTR_ DOUBLE_BUFFER_STRUCT_PTR;
#define INIT_DBUF(x) ((x.whichbuffer) = 0)
#define TOGGLE_DBUF(x) ((x.whichbuffer) ^= 1)
#define DBUF(x) (x.buffer[x.whichbuffer])
#endif
/* EOF */