usbhmsc.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //*****************************************************************************
  2. //
  3. // usbhmsc.h - Definitions for the USB MSC host driver.
  4. //
  5. // Copyright (c) 2008-2010 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Texas Instruments (TI) is supplying this software for use solely and
  9. // exclusively on TI's microcontroller products. The software is owned by
  10. // TI and/or its suppliers, and is protected under applicable copyright
  11. // laws. You may not combine this software with "viral" open-source
  12. // software in order to form a larger program.
  13. //
  14. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
  15. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  16. // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
  18. // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  19. // DAMAGES, FOR ANY REASON WHATSOEVER.
  20. //
  21. // This is part of AM1808 StarterWare USB Library, resused from revision 6288 of the
  22. // stellaris USB Library
  23. //
  24. //*****************************************************************************
  25. #ifndef __USBHMSC_H__
  26. #define __USBHMSC_H__
  27. //*****************************************************************************
  28. //
  29. // If building with a C++ compiler, make all of the definitions in this header
  30. // have a C binding.
  31. //
  32. //*****************************************************************************
  33. #ifdef __cplusplus
  34. extern "C"
  35. {
  36. #endif
  37. //*****************************************************************************
  38. //
  39. //! \addtogroup usblib_host_class
  40. //! @{
  41. //
  42. //*****************************************************************************
  43. //*****************************************************************************
  44. //
  45. // These defines are the the events that will be passed in the \e ulEvent
  46. // parameter of the callback from the driver.
  47. //
  48. //*****************************************************************************
  49. #define MSC_EVENT_OPEN 1
  50. #define MSC_EVENT_CLOSE 2
  51. //*****************************************************************************
  52. //
  53. // The prototype for the USB MSC host driver callback function.
  54. //
  55. //*****************************************************************************
  56. typedef void (*tUSBHMSCCallback)(unsigned int ulInstance,
  57. unsigned int ulEvent,
  58. void *pvEventData);
  59. //*****************************************************************************
  60. //
  61. // This is the structure for an instance of a USB MSC host driver.
  62. //
  63. //*****************************************************************************
  64. typedef struct
  65. {
  66. //
  67. // Save the device instance.
  68. //
  69. tUSBHostDevice *pDevice;
  70. //
  71. // Used to save the callback.
  72. //
  73. tUSBHMSCCallback pfnCallback;
  74. //
  75. // The Maximum LUNs
  76. //
  77. unsigned int ulMaxLUN;
  78. //
  79. // The total number of blocks associated with this device.
  80. //
  81. unsigned int ulNumBlocks;
  82. //
  83. // The size of the blocks associated with this device.
  84. //
  85. unsigned int ulBlockSize;
  86. //
  87. // Bulk IN pipe.
  88. //
  89. unsigned int ulBulkInPipe;
  90. //
  91. // Bulk OUT pipe.
  92. //
  93. unsigned int ulBulkOutPipe;
  94. //
  95. //HCD Index.
  96. //
  97. unsigned int ulIndex;
  98. }
  99. tUSBHMSCInstance;
  100. //*****************************************************************************
  101. //
  102. // Prototypes for the USB MSC host driver APIs.
  103. //
  104. //*****************************************************************************
  105. extern unsigned int USBHMSCDriveOpen(unsigned int ulIndex,
  106. unsigned int ulDrive,
  107. tUSBHMSCCallback pfnCallback);
  108. extern void USBHMSCDriveClose(unsigned int ulInstance);
  109. extern int USBHMSCDriveReady(unsigned int ulInstance);
  110. extern int USBHMSCBlockRead(unsigned int ulInstance, unsigned int ulLBA,
  111. unsigned char *pucData,
  112. unsigned int ulNumBlocks);
  113. extern int USBHMSCBlockWrite(unsigned int ulInstance, unsigned int ulLBA,
  114. unsigned char *pucData,
  115. unsigned int ulNumBlocks);
  116. //*****************************************************************************
  117. //
  118. //! @}
  119. //
  120. //*****************************************************************************
  121. //*****************************************************************************
  122. //
  123. // Mark the end of the C bindings section for C++ compilers.
  124. //
  125. //*****************************************************************************
  126. #ifdef __cplusplus
  127. }
  128. #endif
  129. #endif // __USBHMSC_H__