1 | /*
|
---|
2 | * SPDX-FileCopyrightText: 2011 Vojtech Horky
|
---|
3 | *
|
---|
4 | * SPDX-License-Identifier: BSD-3-Clause
|
---|
5 | */
|
---|
6 |
|
---|
7 | /** @addtogroup drvusbmast
|
---|
8 | * @{
|
---|
9 | */
|
---|
10 | /** @file
|
---|
11 | * SCSI functions for USB mass storage.
|
---|
12 | */
|
---|
13 |
|
---|
14 | #ifndef USB_USBMAST_SCSI_MS_H_
|
---|
15 | #define USB_USBMAST_SCSI_MS_H_
|
---|
16 |
|
---|
17 | #include <scsi/spc.h>
|
---|
18 | #include <stddef.h>
|
---|
19 | #include <stdint.h>
|
---|
20 | #include <usb/usb.h>
|
---|
21 | #include <usb/dev/driver.h>
|
---|
22 |
|
---|
23 | /** Result of SCSI Inquiry command.
|
---|
24 | * This is already parsed structure, not the original buffer returned by
|
---|
25 | * the device.
|
---|
26 | */
|
---|
27 | typedef struct {
|
---|
28 | /** SCSI peripheral device type */
|
---|
29 | unsigned device_type;
|
---|
30 | /** Whether the device is removable */
|
---|
31 | bool removable;
|
---|
32 | /** Vendor ID string */
|
---|
33 | char vendor[SCSI_INQ_VENDOR_STR_BUFSIZE];
|
---|
34 | /** Product ID string */
|
---|
35 | char product[SCSI_INQ_PRODUCT_STR_BUFSIZE];
|
---|
36 | /** Revision string */
|
---|
37 | char revision[SCSI_INQ_REVISION_STR_BUFSIZE];
|
---|
38 | } usbmast_inquiry_data_t;
|
---|
39 |
|
---|
40 | extern errno_t usbmast_inquiry(usbmast_fun_t *, usbmast_inquiry_data_t *);
|
---|
41 | extern errno_t usbmast_request_sense(usbmast_fun_t *, void *, size_t);
|
---|
42 | extern errno_t usbmast_read_capacity(usbmast_fun_t *, uint32_t *, uint32_t *);
|
---|
43 | extern errno_t usbmast_read(usbmast_fun_t *, uint64_t, size_t, void *);
|
---|
44 | extern errno_t usbmast_write(usbmast_fun_t *, uint64_t, size_t, const void *);
|
---|
45 | extern errno_t usbmast_sync_cache(usbmast_fun_t *, uint64_t, size_t);
|
---|
46 | extern const char *usbmast_scsi_dev_type_str(unsigned);
|
---|
47 |
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * @}
|
---|
52 | */
|
---|