xref: /nrf52832-nimble/rt-thread/components/drivers/usb/usbhost/class/mass.h (revision 104654410c56c573564690304ae786df310c91fc)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2011-12-12     Yi Qiu      first version
9  */
10 
11 #ifndef __MASS_H__
12 #define __MASS_H__
13 
14 #include <rtthread.h>
15 #include "dfs_fs.h"
16 
17 #define MAX_PARTITION_COUNT        4
18 #define SECTOR_SIZE                512
19 
20 struct ustor_data
21 {
22     struct dfs_partition part;
23     struct uhintf* intf;
24     int udisk_id;
25     const char path;
26 };
27 
28 struct ustor
29 {
30     upipe_t pipe_in;
31     upipe_t pipe_out;
32     rt_uint32_t capicity[2];
33 
34     struct rt_device dev[MAX_PARTITION_COUNT];
35     rt_uint8_t dev_cnt;
36 };
37 typedef struct ustor* ustor_t;
38 
39 rt_err_t rt_usbh_storage_get_max_lun(struct uhintf* intf, rt_uint8_t* max_lun);
40 rt_err_t rt_usbh_storage_reset(struct uhintf* intf);
41 rt_err_t rt_usbh_storage_read10(struct uhintf* intf, rt_uint8_t *buffer,
42     rt_uint32_t sector, rt_size_t count, int timeout);
43 rt_err_t rt_usbh_storage_write10(struct uhintf* intf, rt_uint8_t *buffer,
44     rt_uint32_t sector, rt_size_t count, int timeout);
45 rt_err_t rt_usbh_storage_request_sense(struct uhintf* intf, rt_uint8_t* buffer);
46 rt_err_t rt_usbh_storage_test_unit_ready(struct uhintf* intf);
47 rt_err_t rt_usbh_storage_inquiry(struct uhintf* intf, rt_uint8_t* buffer);
48 rt_err_t rt_usbh_storage_get_capacity(struct uhintf* intf, rt_uint8_t* buffer);
49 
50 #endif
51