blob: ffc3a13c298eee730ac85c9e5d24bc3a5149c80f [file] [log] [blame]
Lukasz Majewskib528f712013-03-05 12:10:17 +01001/*
2 * Copyright (C) 2011 Samsung Electrnoics
3 * Lukasz Majewski <l.majewski@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * aloong with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 * MA 02111-1307 USA
19 */
20
21#ifndef __USB_MASS_STORAGE_H__
22#define __USB_MASS_STORAGE_H__
23
24#define SECTOR_SIZE 0x200
25
26#include <mmc.h>
27
28struct ums_device {
29 struct mmc *mmc;
30 int dev_num;
31 int offset;
32 int part_size;
33};
34
35struct ums_board_info {
36 int (*read_sector)(struct ums_device *ums_dev,
37 ulong start, lbaint_t blkcnt, void *buf);
38 int (*write_sector)(struct ums_device *ums_dev,
39 ulong start, lbaint_t blkcnt, const void *buf);
40 void (*get_capacity)(struct ums_device *ums_dev,
41 long long int *capacity);
42 const char *name;
43 struct ums_device ums_dev;
44};
45
46extern void board_usb_init(void);
47
48extern int fsg_init(struct ums_board_info *);
49extern void fsg_cleanup(void);
50extern struct ums_board_info *board_ums_init(unsigned int,
51 unsigned int, unsigned int);
52extern int usb_gadget_handle_interrupts(void);
53extern int fsg_main_thread(void *);
54
55#endif /* __USB_MASS_STORAGE_H__ */