From df5500e81cc40633eb5edee59410030f0aa77c2d Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Thu, 13 Aug 2009 06:43:17 +0000 Subject: Added CDC_Device_Flush() command to the CDC Device mode class driver. Minor updates to the unfinished SideShow demo for clarity. Added unfinished MassStorageHost class driver demo. --- .../Incomplete/Sideshow/Lib/SideshowApplications.c | 13 ------------- .../Incomplete/Sideshow/Lib/SideshowApplications.h | 1 - .../Incomplete/Sideshow/Lib/SideshowCommands.c | 21 ++++++++++++--------- 3 files changed, 12 insertions(+), 23 deletions(-) (limited to 'Demos/Device') diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c index ad26d77b5..4f27c3336 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c @@ -33,19 +33,6 @@ SideShow_Application_t InstalledApplications[MAX_APPLICATIONS]; -uint8_t SideShow_GetTotalApplications(void) -{ - uint8_t TotalInstalledApps = 0; - - for (uint8_t App = 0; App < ARRAY_ELEMENTS(InstalledApplications); App++) - { - if (InstalledApplications[App].InUse) - TotalInstalledApps++; - } - - return TotalInstalledApps; -} - SideShow_Application_t* SideShow_GetFreeApplication(void) { for (uint8_t App = 0; App < ARRAY_ELEMENTS(InstalledApplications); App++) diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h index 133acf994..63e30111b 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h @@ -56,7 +56,6 @@ extern SideShow_Application_t InstalledApplications[MAX_APPLICATIONS]; /* Function Prototypes: */ - uint8_t SideShow_GetTotalApplications(void); SideShow_Application_t* SideShow_GetFreeApplication(void); SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* GUID); diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c index 8dc0b6246..221ffb3f3 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c @@ -295,21 +295,26 @@ static void SideShow_GetString(SideShow_PacketHeader_t* PacketHeader, void* Unic static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* PacketHeader) { - uint8_t TotalInstalledApplications = SideShow_GetTotalApplications(); - uint16_t GadgetGUIDBytes = (TotalInstalledApplications * sizeof(GUID_t)); - + uint8_t TotalApplications = 0; + Endpoint_ClearOUT(); + for (uint8_t App = 0; App < MAX_APPLICATIONS; App++) + { + if (InstalledApplications[App].InUse) + TotalApplications++; + } + PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + - sizeof(uint32_t) + GadgetGUIDBytes; + sizeof(uint32_t) + (TotalApplications * sizeof(GUID_t)); Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); - Endpoint_Write_DWord_LE(TotalInstalledApplications); + Endpoint_Write_DWord_LE(TotalApplications); for (uint8_t App = 0; App < MAX_APPLICATIONS; App++) { - if (InstalledApplications[App].InUse == true) + if (InstalledApplications[App].InUse) Endpoint_Write_Stream_LE(&InstalledApplications[App].ApplicationID, sizeof(GUID_t)); } @@ -386,9 +391,7 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* PacketHeader) SideShow_Application_t* AppToDelete = SideShow_GetApplicationFromGUID(&ApplicationGUID); if (AppToDelete != NULL) - { - AppToDelete->InUse = false; - } + AppToDelete->InUse = false; else PacketHeader->Type.NAK = true; -- cgit v1.2.3