aboutsummaryrefslogtreecommitdiffstats
path: root/Bootloaders
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-03-10 08:38:47 +0000
committerDean Camera <dean@fourwalledcubicle.com>2013-03-10 08:38:47 +0000
commit6c9632ae388b8ceadb00ca981ff7fbd5235ac448 (patch)
tree4feb3318ea9581d2719068eab4e7f3127faac8f2 /Bootloaders
parentd5cff25cd14053965fcf072a7109493155a531c3 (diff)
downloadlufa-6c9632ae388b8ceadb00ca981ff7fbd5235ac448.tar.gz
lufa-6c9632ae388b8ceadb00ca981ff7fbd5235ac448.tar.bz2
lufa-6c9632ae388b8ceadb00ca981ff7fbd5235ac448.zip
Minor optimizations and corrections to the incomplete Mass Storage class bootloader.
Diffstat (limited to 'Bootloaders')
-rw-r--r--Bootloaders/Incomplete/MassStorage/BootloaderAPI.h2
-rw-r--r--Bootloaders/Incomplete/MassStorage/Descriptors.c34
-rw-r--r--Bootloaders/Incomplete/MassStorage/Lib/SCSI.c7
-rw-r--r--Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c6
-rw-r--r--Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.h2
-rw-r--r--Bootloaders/Incomplete/MassStorage/makefile2
6 files changed, 9 insertions, 44 deletions
diff --git a/Bootloaders/Incomplete/MassStorage/BootloaderAPI.h b/Bootloaders/Incomplete/MassStorage/BootloaderAPI.h
index c57da8be8..d159f689b 100644
--- a/Bootloaders/Incomplete/MassStorage/BootloaderAPI.h
+++ b/Bootloaders/Incomplete/MassStorage/BootloaderAPI.h
@@ -43,8 +43,6 @@
#include <LUFA/Common/Common.h>
- #include "Config/AppConfig.h"
-
/* Function Prototypes: */
void BootloaderAPI_ErasePage(const uint32_t Address);
void BootloaderAPI_WritePage(const uint32_t Address);
diff --git a/Bootloaders/Incomplete/MassStorage/Descriptors.c b/Bootloaders/Incomplete/MassStorage/Descriptors.c
index 0dda34ae1..ed7f1e3f4 100644
--- a/Bootloaders/Incomplete/MassStorage/Descriptors.c
+++ b/Bootloaders/Incomplete/MassStorage/Descriptors.c
@@ -58,8 +58,8 @@ const USB_Descriptor_Device_t DeviceDescriptor =
.ProductID = 0x2045,
.ReleaseNumber = VERSION_BCD(00.01),
- .ManufacturerStrIndex = 0x01,
- .ProductStrIndex = 0x02,
+ .ManufacturerStrIndex = NO_DESCRIPTOR,
+ .ProductStrIndex = NO_DESCRIPTOR,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
@@ -135,28 +135,6 @@ const USB_Descriptor_String_t LanguageString =
.UnicodeString = {LANGUAGE_ID_ENG}
};
-/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
- * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
- * Descriptor.
- */
-const USB_Descriptor_String_t ManufacturerString =
-{
- .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
- .UnicodeString = L"Dean Camera"
-};
-
-/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
- * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
- * Descriptor.
- */
-const USB_Descriptor_String_t ProductString =
-{
- .Header = {.Size = USB_STRING_LEN(15), .Type = DTYPE_String},
-
- .UnicodeString = L"LUFA Bootloader"
-};
-
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
* documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
@@ -190,14 +168,6 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
- Address = &ManufacturerString;
- Size = pgm_read_byte(&ManufacturerString.Header.Size);
- break;
- case 0x02:
- Address = &ProductString;
- Size = pgm_read_byte(&ProductString.Header.Size);
- break;
}
break;
diff --git a/Bootloaders/Incomplete/MassStorage/Lib/SCSI.c b/Bootloaders/Incomplete/MassStorage/Lib/SCSI.c
index a79a4688a..154fe4885 100644
--- a/Bootloaders/Incomplete/MassStorage/Lib/SCSI.c
+++ b/Bootloaders/Incomplete/MassStorage/Lib/SCSI.c
@@ -307,11 +307,8 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
*/
static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
- /* Send an empty header response with the Write Protect flag status */
- Endpoint_Write_8(0x00);
- Endpoint_Write_8(0x00);
- Endpoint_Write_8(0x00);
- Endpoint_Write_8(0x00);
+ /* Send an empty header response indicating Write Protect flag is off */
+ Endpoint_Write_32_LE(0);
Endpoint_ClearIN();
/* Update the bytes transferred counter and succeed the command */
diff --git a/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c b/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c
index 85f274bfa..96dfc555c 100644
--- a/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c
+++ b/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c
@@ -51,8 +51,6 @@ static const FATBootBlock_t BootBlock =
.VolumeSerialNumber = 0x12345678,
.VolumeLabel = "LUFA BOOT ",
.FilesystemIdentifier = "FAT12 ",
- .BootstrapProgram = {0},
- .MagicSignature = 0xAA55,
};
static FATDirectoryEntry_t FirmwareFileEntry =
@@ -138,6 +136,10 @@ static void ReadBlock(const uint16_t BlockNumber)
{
case 0: /* Block 0: Boot block sector */
memcpy(BlockBuffer, &BootBlock, sizeof(FATBootBlock_t));
+
+ /* Add the magic signature to the end of the block */
+ BlockBuffer[SECTOR_SIZE_BYTES - 2] = 0x55;
+ BlockBuffer[SECTOR_SIZE_BYTES - 1] = 0xAA;
break;
case 1: /* Block 1: First FAT12 cluster chain copy */
diff --git a/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.h b/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.h
index 98ea5cdd9..fe8d770b8 100644
--- a/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.h
+++ b/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.h
@@ -72,8 +72,6 @@
uint32_t VolumeSerialNumber;
uint8_t VolumeLabel[11];
uint8_t FilesystemIdentifier[8];
- uint8_t BootstrapProgram[448];
- uint16_t MagicSignature;
} FATBootBlock_t;
typedef struct
diff --git a/Bootloaders/Incomplete/MassStorage/makefile b/Bootloaders/Incomplete/MassStorage/makefile
index c922b9d7b..638784386 100644
--- a/Bootloaders/Incomplete/MassStorage/makefile
+++ b/Bootloaders/Incomplete/MassStorage/makefile
@@ -18,7 +18,7 @@ F_CPU = 8000000
F_USB = $(F_CPU)
OPTIMIZATION = s
TARGET = BootloaderMassStorage
-SRC = $(TARGET).c Descriptors.c Lib/SCSI.c Lib/VirtualFAT.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
+SRC = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S Lib/SCSI.c Lib/VirtualFAT.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
LUFA_PATH = ../../../LUFA
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET)
LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS)