User | Revision | Line number | New contents of line |
lynxeyed_atsu |
0:63ed631d8c3a
|
1
|
/*
|
lynxeyed_atsu |
0:63ed631d8c3a
|
2
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
3
|
* NXP USB Host Stack
|
lynxeyed_atsu |
0:63ed631d8c3a
|
4
|
*
|
lynxeyed_atsu |
0:63ed631d8c3a
|
5
|
* (c) Copyright 2008, NXP SemiConductors
|
lynxeyed_atsu |
0:63ed631d8c3a
|
6
|
* (c) Copyright 2008, OnChip Technologies LLC
|
lynxeyed_atsu |
0:63ed631d8c3a
|
7
|
* All Rights Reserved
|
lynxeyed_atsu |
0:63ed631d8c3a
|
8
|
*
|
lynxeyed_atsu |
0:63ed631d8c3a
|
9
|
* www.nxp.com
|
lynxeyed_atsu |
0:63ed631d8c3a
|
10
|
* www.onchiptech.com
|
lynxeyed_atsu |
0:63ed631d8c3a
|
11
|
*
|
lynxeyed_atsu |
0:63ed631d8c3a
|
12
|
* File : usbhost_ms.h
|
lynxeyed_atsu |
0:63ed631d8c3a
|
13
|
* Programmer(s) : Ravikanth.P
|
lynxeyed_atsu |
0:63ed631d8c3a
|
14
|
* Version :
|
lynxeyed_atsu |
0:63ed631d8c3a
|
15
|
*
|
lynxeyed_atsu |
0:63ed631d8c3a
|
16
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
17
|
*/
|
lynxeyed_atsu |
0:63ed631d8c3a
|
18
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
19
|
#ifndef USBHOST_MS_H
|
lynxeyed_atsu |
0:63ed631d8c3a
|
20
|
#define USBHOST_MS_H
|
lynxeyed_atsu |
0:63ed631d8c3a
|
21
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
22
|
/*
|
lynxeyed_atsu |
0:63ed631d8c3a
|
23
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
24
|
* INCLUDE HEADER FILES
|
lynxeyed_atsu |
0:63ed631d8c3a
|
25
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
26
|
*/
|
lynxeyed_atsu |
0:63ed631d8c3a
|
27
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
28
|
#include "usbhost_inc.h"
|
lynxeyed_atsu |
0:63ed631d8c3a
|
29
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
30
|
/*
|
lynxeyed_atsu |
0:63ed631d8c3a
|
31
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
32
|
* MASS STORAGE SPECIFIC DEFINITIONS
|
lynxeyed_atsu |
0:63ed631d8c3a
|
33
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
34
|
*/
|
lynxeyed_atsu |
0:63ed631d8c3a
|
35
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
36
|
#define MS_GET_MAX_LUN_REQ 0xFE
|
lynxeyed_atsu |
0:63ed631d8c3a
|
37
|
#define MASS_STORAGE_CLASS 0x08
|
lynxeyed_atsu |
0:63ed631d8c3a
|
38
|
#define MASS_STORAGE_SUBCLASS_SCSI 0x06
|
lynxeyed_atsu |
0:63ed631d8c3a
|
39
|
#define MASS_STORAGE_PROTOCOL_BO 0x50
|
lynxeyed_atsu |
0:63ed631d8c3a
|
40
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
41
|
#define INQUIRY_LENGTH 36
|
lynxeyed_atsu |
0:63ed631d8c3a
|
42
|
/*
|
lynxeyed_atsu |
0:63ed631d8c3a
|
43
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
44
|
* SCSI SPECIFIC DEFINITIONS
|
lynxeyed_atsu |
0:63ed631d8c3a
|
45
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
46
|
*/
|
lynxeyed_atsu |
0:63ed631d8c3a
|
47
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
48
|
#define CBW_SIGNATURE 0x43425355
|
lynxeyed_atsu |
0:63ed631d8c3a
|
49
|
#define CSW_SIGNATURE 0x53425355
|
lynxeyed_atsu |
0:63ed631d8c3a
|
50
|
#define CBW_SIZE 31
|
lynxeyed_atsu |
0:63ed631d8c3a
|
51
|
#define CSW_SIZE 13
|
lynxeyed_atsu |
0:63ed631d8c3a
|
52
|
#define CSW_CMD_PASSED 0x00
|
lynxeyed_atsu |
0:63ed631d8c3a
|
53
|
#define SCSI_CMD_REQUEST_SENSE 0x03
|
lynxeyed_atsu |
0:63ed631d8c3a
|
54
|
#define SCSI_CMD_TEST_UNIT_READY 0x00
|
lynxeyed_atsu |
0:63ed631d8c3a
|
55
|
#define SCSI_CMD_INQUIRY 0x12
|
lynxeyed_atsu |
0:63ed631d8c3a
|
56
|
#define SCSI_CMD_READ_10 0x28
|
lynxeyed_atsu |
0:63ed631d8c3a
|
57
|
#define SCSI_CMD_READ_CAPACITY 0x25
|
lynxeyed_atsu |
0:63ed631d8c3a
|
58
|
#define SCSI_CMD_WRITE_10 0x2A
|
lynxeyed_atsu |
0:63ed631d8c3a
|
59
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
60
|
/*
|
lynxeyed_atsu |
0:63ed631d8c3a
|
61
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
62
|
* TYPE DEFINITIONS
|
lynxeyed_atsu |
0:63ed631d8c3a
|
63
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
64
|
*/
|
lynxeyed_atsu |
0:63ed631d8c3a
|
65
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
66
|
typedef enum ms_data_dir {
|
lynxeyed_atsu |
0:63ed631d8c3a
|
67
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
68
|
MS_DATA_DIR_IN = 0x80,
|
lynxeyed_atsu |
0:63ed631d8c3a
|
69
|
MS_DATA_DIR_OUT = 0x00,
|
lynxeyed_atsu |
0:63ed631d8c3a
|
70
|
MS_DATA_DIR_NONE = 0x01
|
lynxeyed_atsu |
0:63ed631d8c3a
|
71
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
72
|
} MS_DATA_DIR;
|
lynxeyed_atsu |
0:63ed631d8c3a
|
73
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
74
|
/*
|
lynxeyed_atsu |
0:63ed631d8c3a
|
75
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
76
|
* FUNCTION PROTOTYPES
|
lynxeyed_atsu |
0:63ed631d8c3a
|
77
|
**************************************************************************************************************
|
lynxeyed_atsu |
0:63ed631d8c3a
|
78
|
*/
|
lynxeyed_atsu |
0:63ed631d8c3a
|
79
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
80
|
USB_INT32S MS_BulkRecv ( USB_INT32U block_number,
|
lynxeyed_atsu |
0:63ed631d8c3a
|
81
|
USB_INT16U num_blocks,
|
lynxeyed_atsu |
0:63ed631d8c3a
|
82
|
volatile USB_INT08U *user_buffer);
|
lynxeyed_atsu |
0:63ed631d8c3a
|
83
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
84
|
USB_INT32S MS_BulkSend ( USB_INT32U block_number,
|
lynxeyed_atsu |
0:63ed631d8c3a
|
85
|
USB_INT16U num_blocks,
|
lynxeyed_atsu |
0:63ed631d8c3a
|
86
|
volatile USB_INT08U *user_buffer);
|
lynxeyed_atsu |
0:63ed631d8c3a
|
87
|
USB_INT32S MS_ParseConfiguration(void);
|
lynxeyed_atsu |
0:63ed631d8c3a
|
88
|
USB_INT32S MS_TestUnitReady (void);
|
lynxeyed_atsu |
0:63ed631d8c3a
|
89
|
USB_INT32S MS_ReadCapacity (USB_INT32U *numBlks, USB_INT32U *blkSize);
|
lynxeyed_atsu |
0:63ed631d8c3a
|
90
|
USB_INT32S MS_GetMaxLUN (void);
|
lynxeyed_atsu |
0:63ed631d8c3a
|
91
|
USB_INT32S MS_GetSenseInfo (void);
|
lynxeyed_atsu |
0:63ed631d8c3a
|
92
|
USB_INT32S MS_Init (USB_INT32U *blkSize, USB_INT32U *numBlks, USB_INT08U *inquiryResult);
|
lynxeyed_atsu |
0:63ed631d8c3a
|
93
|
USB_INT32S MS_Inquire (USB_INT08U *response);
|
lynxeyed_atsu |
0:63ed631d8c3a
|
94
|
|
lynxeyed_atsu |
0:63ed631d8c3a
|
95
|
void Fill_MSCommand ( USB_INT32U block_number,
|
lynxeyed_atsu |
0:63ed631d8c3a
|
96
|
USB_INT32U block_size,
|
lynxeyed_atsu |
0:63ed631d8c3a
|
97
|
USB_INT16U num_blocks,
|
lynxeyed_atsu |
0:63ed631d8c3a
|
98
|
MS_DATA_DIR direction,
|
lynxeyed_atsu |
0:63ed631d8c3a
|
99
|
USB_INT08U scsi_cmd,
|
lynxeyed_atsu |
0:63ed631d8c3a
|
100
|
USB_INT08U scsi_cmd_len);
|
lynxeyed_atsu |
0:63ed631d8c3a
|
101
|
#endif
|