Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 Samsung Electrnoics |
| 3 | * Lukasz Majewski <l.majewski@samsung.com> |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef __USB_MASS_STORAGE_H__ |
| 9 | #define __USB_MASS_STORAGE_H__ |
| 10 | |
| 11 | #define SECTOR_SIZE 0x200 |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 12 | #include <mmc.h> |
Lukasz Majewski | 0c63523 | 2013-09-17 15:58:21 +0200 | [diff] [blame] | 13 | #include <linux/usb/composite.h> |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 14 | |
Przemyslaw Marczak | 674b1a6 | 2013-10-23 14:30:42 +0200 | [diff] [blame] | 15 | #ifndef UMS_START_SECTOR |
| 16 | #define UMS_START_SECTOR 0 |
| 17 | #endif |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 18 | |
Przemyslaw Marczak | 674b1a6 | 2013-10-23 14:30:42 +0200 | [diff] [blame] | 19 | #ifndef UMS_NUM_SECTORS |
| 20 | #define UMS_NUM_SECTORS 0 |
| 21 | #endif |
| 22 | |
| 23 | struct ums { |
| 24 | int (*read_sector)(struct ums *ums_dev, |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 25 | ulong start, lbaint_t blkcnt, void *buf); |
Przemyslaw Marczak | 674b1a6 | 2013-10-23 14:30:42 +0200 | [diff] [blame] | 26 | int (*write_sector)(struct ums *ums_dev, |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 27 | ulong start, lbaint_t blkcnt, const void *buf); |
Przemyslaw Marczak | 3dab730 | 2013-10-23 14:30:44 +0200 | [diff] [blame] | 28 | unsigned int start_sector; |
| 29 | unsigned int num_sectors; |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 30 | const char *name; |
Przemyslaw Marczak | 674b1a6 | 2013-10-23 14:30:42 +0200 | [diff] [blame] | 31 | struct mmc *mmc; |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 32 | }; |
| 33 | |
Przemyslaw Marczak | 674b1a6 | 2013-10-23 14:30:42 +0200 | [diff] [blame] | 34 | extern struct ums *ums; |
| 35 | |
| 36 | int fsg_init(struct ums *); |
Mateusz Zalega | d862f89 | 2013-10-04 19:22:26 +0200 | [diff] [blame] | 37 | void fsg_cleanup(void); |
Przemyslaw Marczak | 674b1a6 | 2013-10-23 14:30:42 +0200 | [diff] [blame] | 38 | struct ums *ums_init(unsigned int); |
Mateusz Zalega | d862f89 | 2013-10-04 19:22:26 +0200 | [diff] [blame] | 39 | int fsg_main_thread(void *); |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 40 | |
Lukasz Majewski | 0c63523 | 2013-09-17 15:58:21 +0200 | [diff] [blame] | 41 | #ifdef CONFIG_USB_GADGET_MASS_STORAGE |
| 42 | int fsg_add(struct usb_configuration *c); |
| 43 | #else |
| 44 | int fsg_add(struct usb_configuration *c) |
| 45 | { |
| 46 | return 0; |
| 47 | } |
| 48 | #endif |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 49 | #endif /* __USB_MASS_STORAGE_H__ */ |