aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/MassStorage
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-06-04 02:55:30 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-06-04 02:55:30 +0000
commita67bd74e3e8aad87dcee8cf0c0eaaccbe7d00552 (patch)
treefdf670b5b93e2e192d19ca71138a667d7f3ba4f9 /Demos/Device/MassStorage
parent7c5444b89a49df7cb671b0b041567990d2a3012e (diff)
downloadlufa-a67bd74e3e8aad87dcee8cf0c0eaaccbe7d00552.tar.gz
lufa-a67bd74e3e8aad87dcee8cf0c0eaaccbe7d00552.tar.bz2
lufa-a67bd74e3e8aad87dcee8cf0c0eaaccbe7d00552.zip
Minor documentation page updates.
Redocumented all device demos, now that they have changed over to the new USB class drivers. Added C linkage to class drivers for C++ support. Added prefixes to most of the class driver constants to prevent name clashes.
Diffstat (limited to 'Demos/Device/MassStorage')
-rw-r--r--Demos/Device/MassStorage/MassStorage.c22
-rw-r--r--Demos/Device/MassStorage/MassStorage.h12
2 files changed, 33 insertions, 1 deletions
diff --git a/Demos/Device/MassStorage/MassStorage.c b/Demos/Device/MassStorage/MassStorage.c
index 8e2b9f450..5dbc4a2cc 100644
--- a/Demos/Device/MassStorage/MassStorage.c
+++ b/Demos/Device/MassStorage/MassStorage.c
@@ -28,8 +28,18 @@
this software.
*/
+/** \file
+ *
+ * Main source file for the MassStorage demo. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
#include "MassStorage.h"
+/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
+ * passed to all Mass Storage Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
USB_ClassInfo_MS_t Disk_MS_Interface =
{
.InterfaceNumber = 0,
@@ -43,6 +53,9 @@ USB_ClassInfo_MS_t Disk_MS_Interface =
.TotalLUNs = TOTAL_LUNS,
};
+/** Main program entry point. This routine contains the overall program flow, including initial
+ * setup of all components and the main program loop.
+ */
int main(void)
{
SetupHardware();
@@ -56,6 +69,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -74,16 +88,19 @@ void SetupHardware(void)
DataflashManager_ResetDataflashProtections();
}
+/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
+/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -92,11 +109,16 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_MS_ProcessControlPacket(&Disk_MS_Interface);
}
+/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
+ *
+ * \param MSInterfaceInfo Pointer to the Mass Storage class interface configuration structure being referenced
+ */
bool CALLBACK_USB_MS_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo)
{
bool CommandSuccess;
diff --git a/Demos/Device/MassStorage/MassStorage.h b/Demos/Device/MassStorage/MassStorage.h
index a50edac99..50a77250d 100644
--- a/Demos/Device/MassStorage/MassStorage.h
+++ b/Demos/Device/MassStorage/MassStorage.h
@@ -54,12 +54,22 @@
#include <LUFA/Drivers/USB/Class/Device/MassStorage.h>
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
+
+ /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
- #define LEDMASK_USB_BUSY LEDS_LED2
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
+ #define LEDMASK_USB_BUSY (LEDS_LED2)
+ /** Total number of logical drives within the device - must be non-zero. */
#define TOTAL_LUNS 2
/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */