usb_mass_storage.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  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. #ifndef __USB_MASS_STORAGE_H__
  21. #define __USB_MASS_STORAGE_H__
  22. #define SECTOR_SIZE 0x200
  23. #include <mmc.h>
  24. struct ums_device {
  25. struct mmc *mmc;
  26. int dev_num;
  27. int offset;
  28. int part_size;
  29. };
  30. struct ums_board_info {
  31. int (*read_sector)(struct ums_device *ums_dev,
  32. ulong start, lbaint_t blkcnt, void *buf);
  33. int (*write_sector)(struct ums_device *ums_dev,
  34. ulong start, lbaint_t blkcnt, const void *buf);
  35. void (*get_capacity)(struct ums_device *ums_dev,
  36. long long int *capacity);
  37. const char *name;
  38. struct ums_device ums_dev;
  39. };
  40. extern void board_usb_init(void);
  41. extern int fsg_init(struct ums_board_info *);
  42. extern void fsg_cleanup(void);
  43. extern struct ums_board_info *board_ums_init(unsigned int,
  44. unsigned int, unsigned int);
  45. extern int usb_gadget_handle_interrupts(void);
  46. extern int fsg_main_thread(void *);
  47. #endif /* __USB_MASS_STORAGE_H__ */