Add host mode USB Class driver stubs, add beginnings of a CDC host class driver.
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Device / MassStorage.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 /** \ingroup Group_USBClassMS
32 * @defgroup Group_USBClassMSDevice Mass Storage Class Device Mode Driver
33 *
34 * \section Module Description
35 * Device Mode USB Class driver framework interface, for the Mass Storage USB Class driver.
36 *
37 * @{
38 */
39
40 #ifndef _MS_CLASS_DEVICE_H_
41 #define _MS_CLASS_DEVICE_H_
42
43 /* Includes: */
44 #include "../../USB.h"
45 #include "../Common/MassStorage.h"
46
47 #include <string.h>
48
49 /* Enable C linkage for C++ Compilers: */
50 #if defined(__cplusplus)
51 extern "C" {
52 #endif
53
54 /* Function Prototypes: */
55 #if defined(INCLUDE_FROM_MS_CLASS_DEVICE_C)
56 static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_t* MSInterfaceInfo);
57 static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_t* MSInterfaceInfo);
58 static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void);
59 #endif
60
61 /** Configures the endpoints of a given Mass Storage interface, ready for use. This should be linked to the library
62 * \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration
63 * containing the given Mass Storage interface is selected.
64 *
65 * \param MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state.
66 *
67 * \return Boolean true if the endpoints were sucessfully configured, false otherwise
68 */
69 bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_t* MSInterfaceInfo);
70
71 /** Processes incomming control requests from the host, that are directed to the given Mass Storage class interface. This should be
72 * linked to the library \ref EVENT_USB_UnhandledControlPacket() event.
73 *
74 * \param MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state.
75 */
76 void MS_Device_ProcessControlPacket(USB_ClassInfo_MS_t* MSInterfaceInfo);
77
78 /** General management task for a given Mass Storage class interface, required for the correct operation of the interface. This should
79 * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
80 *
81 * \param MSInterfaceInfo Pointer to a structure containing a Mass Storage configuration and state.
82 */
83 void MS_Device_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo);
84
85 /** Mass Storage class driver callback for the user processing of a received SCSI command. This callback will fire each time the
86 * host sends a SCSI command which requires processing by the user application. Inside this callback the user is responsible
87 * for the processing of the received SCSI command from the host. The SCSI command is available in the CommandBlock structure
88 * inside the Mass Storage class state structure passed as a parameter to the callback function.
89 *
90 * \param MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state.
91 *
92 * \return Boolean true if the SCSI command was successfully processed, false otherwise
93 */
94 bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo);
95
96 /* Disable C linkage for C++ Compilers: */
97 #if defined(__cplusplus)
98 }
99 #endif
100
101 #endif
102
103 /** @} */