blob: 69b80cd1a367a602d97e5efb16f67777c15caa20 [file] [log] [blame]
Lukasz Majewski44a6ac92013-03-05 12:10:17 +01001/*
2 * Copyright (C) 2011 Samsung Electrnoics
3 * Lukasz Majewski <l.majewski@samsung.com>
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Lukasz Majewski44a6ac92013-03-05 12:10:17 +01006 */
7
8#ifndef __USB_MASS_STORAGE_H__
9#define __USB_MASS_STORAGE_H__
10
11#define SECTOR_SIZE 0x200
Stephen Warren59ab2d22014-05-05 10:40:11 -060012#include <part.h>
Lukasz Majewski0c635232013-09-17 15:58:21 +020013#include <linux/usb/composite.h>
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010014
Przemyslaw Marczake92cc562014-01-07 15:08:37 +010015/* Wait at maximum 60 seconds for cable connection */
16#define UMS_CABLE_READY_TIMEOUT 60
17
Przemyslaw Marczak674b1a62013-10-23 14:30:42 +020018struct ums {
19 int (*read_sector)(struct ums *ums_dev,
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010020 ulong start, lbaint_t blkcnt, void *buf);
Przemyslaw Marczak674b1a62013-10-23 14:30:42 +020021 int (*write_sector)(struct ums *ums_dev,
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010022 ulong start, lbaint_t blkcnt, const void *buf);
Przemyslaw Marczak3dab7302013-10-23 14:30:44 +020023 unsigned int start_sector;
24 unsigned int num_sectors;
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010025 const char *name;
Stephen Warren59ab2d22014-05-05 10:40:11 -060026 block_dev_desc_t *block_dev;
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010027};
28
Przemyslaw Marczak674b1a62013-10-23 14:30:42 +020029extern struct ums *ums;
30
31int fsg_init(struct ums *);
Mateusz Zalegad862f892013-10-04 19:22:26 +020032void fsg_cleanup(void);
Mateusz Zalegad862f892013-10-04 19:22:26 +020033int fsg_main_thread(void *);
Lukasz Majewski0c635232013-09-17 15:58:21 +020034int fsg_add(struct usb_configuration *c);
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010035#endif /* __USB_MASS_STORAGE_H__ */