summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Perfetto <josh@snowrise.com>2011-06-08 01:51:48 -0700
committerJosh Perfetto <josh@snowrise.com>2011-06-08 01:53:31 -0700
commitbeeb6b31c9c2114d72b385ecd44eafc7531ede3f (patch)
tree82000d27f0d98483fdc24c2545b18000360f84ce
parentcf48f6f31f8e5006ed1ad29ff94604a6742969c8 (diff)
downloadopenpcr-beeb6b31c9c2114d72b385ecd44eafc7531ede3f.tar.gz
openpcr-beeb6b31c9c2114d72b385ecd44eafc7531ede3f.zip
USB serial comms working
-rwxr-xr-xusb/DataManager.c294
-rwxr-xr-xusb/DataManager.h2
-rw-r--r--usb/MassStorage.aps2
-rwxr-xr-xusb/MassStorage.c2
-rwxr-xr-xusb/MassStorage.s1399
-rwxr-xr-xusb/SCSI.c224
-rwxr-xr-xusb/makefile1
7 files changed, 306 insertions, 1618 deletions
diff --git a/usb/DataManager.c b/usb/DataManager.c
new file mode 100755
index 0000000..1a68e52
--- /dev/null
+++ b/usb/DataManager.c
@@ -0,0 +1,294 @@
+#include <LUFA/Drivers/Peripheral/Serial.h>
+#include "SCSI.h"
+
+typedef PROGMEM struct _FAT_BOOT_RECORD
+{
+ uint8_t bootstrap[3]; //eb 3c 90
+ uint8_t OEM[8];
+ uint16_t iBytesPerSector; //512
+ uint8_t iSectorsPerCluster; //1
+ uint16_t iReservedSectors; //1
+ uint8_t iFATs; //2
+ uint16_t iRootEntries;
+ uint16_t iTotalSectors;
+ uint8_t iMediaDescr;
+ uint16_t iSectorsPerFAT;
+ uint16_t iSectorsPerTrack;
+ uint16_t iHeads;
+ uint32_t iHiddenSectors;
+ uint32_t iTotalSectorsEx;
+ uint16_t iLogicDriveNumber;
+ uint8_t extSignature; //29 (hex)
+ uint32_t serialNumber;
+ uint8_t volumeLabel[11];
+ uint8_t fatName[8]; //FAT16
+ //uint8_t exeCode[448];
+ //uint8_t exeEndMarker[2]; //55 aa
+} FAT_BOOT_RECORD; //total 512 bytes
+
+//Boot Record: 1 sector; FAT1: 1 sector; FAT2: 1 sector; Root Directory: 1 sector
+FAT_BOOT_RECORD PROGMEM fatBootData =
+{
+ .bootstrap = {0xeb, 0x3c, 0x90},
+ .OEM = "OpenPCR ",
+ .iBytesPerSector = 512,
+ .iSectorsPerCluster = 1,
+ .iReservedSectors = 1,
+ .iFATs = 2,
+ .iRootEntries = 512,
+ .iTotalSectors = 4352,
+ .iMediaDescr = 0xf0,
+ .iSectorsPerFAT = 17,
+ .iSectorsPerTrack = 0,
+ .iHeads = 0,
+ .iHiddenSectors = 0,
+ .iTotalSectorsEx = 0,
+ .iLogicDriveNumber = 0x00, //0x80,
+ .extSignature = 0x29,
+ .serialNumber = USE_INTERNAL_SERIAL,
+ .volumeLabel = "OpenPCR ",
+ .fatName = "FAT16 ",
+ // .exeCode = {},
+ // .exeEndMarker = {0x55, 0xaa}
+};
+
+ typedef PROGMEM struct
+{
+ uint8_t filename[8];
+ uint8_t ext[3];
+ uint8_t attribute;
+ uint8_t reserved;
+ uint8_t create_time_ms;
+ uint16_t create_time;
+ uint16_t create_date;
+ uint16_t access_date;
+ uint16_t first_cluster_highorder;
+ uint16_t modified_time;
+ uint16_t modified_date;
+ uint16_t first_cluster_loworder;
+ uint32_t size;
+} FAT_ROOT_DIRECTORY; //total 512 bytes
+
+/*date format: bits 0-4: day of month 1-31; bits 5-8: month of year 1-12; bits 9-15: years since 1980 0-127
+ time format: bits 0-4: 2 second count 0-29; bits 5-10: minutes 0-59; bits 11-15: hours 0-23 */
+FAT_ROOT_DIRECTORY PROGMEM rootDir =
+{
+ .filename = "STATUS ",
+ .ext = "TXT",
+ .attribute = 0,
+ .reserved = 0,
+ .create_time_ms = 0,
+ .create_time = 0x8800,
+ .create_date = 0x3ea1,
+ .access_date = 0x3ea1,
+ .first_cluster_highorder = 0,
+ .modified_time = 0x8800,
+ .modified_date = 0x3ea1,
+ .first_cluster_loworder = 2,
+ .size = 300
+};
+
+#define START_CODE 0xFF
+#define PACKET_HEADER_LENGTH 3
+
+typedef enum{
+ SEND_CMD = 0x10,
+ STATUS_REQ = 0x40,
+ STATUS_RESP = 0x80
+}PACKET_TYPE;
+
+#define FILE_SIGNATURE "T67k0gh"
+#define FILE_SIGNATURE_LEN 7
+#define FILE_MAX_LENGTH 300
+
+bool DoReadFlowControl() {
+ /* Check if the endpoint is currently full */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ /* Clear the endpoint bank to send its contents to the host */
+ Endpoint_ClearIN();
+
+ /* Wait until the endpoint is ready for more data */
+ if (Endpoint_WaitUntilReady())
+ return false;
+ }
+
+ return true;
+}
+
+bool DoWriteFlowControl() {
+ /* Check if the endpoint is currently full */
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ /* Clear the endpoint bank to send its contents to the host */
+ Endpoint_ClearOUT();
+
+ /* Wait until the endpoint is ready for more data */
+ if (Endpoint_WaitUntilReady())
+ return false;
+ }
+
+ return true;
+}
+
+bool SerialWaitUntilReady(){
+ //??? need timeout
+ while (!Serial_IsCharReceived());
+ return true;
+}
+
+/*
+void Endpoint_Write_Zeros(uint16_t size){
+ uint16_t block_index = 0;
+
+ while(block_index < size){
+ DoReadFlowControl();
+ for(uint16_t blockdiv16_index = 0; blockdiv16_index < 1; blockdiv16_index++) {
+ Endpoint_Write_Byte(0x00);
+ block_index++;
+ if (block_index >= size)
+ return;
+ }
+ }
+}
+*/
+
+void FlushBlock(uint16_t size)
+{
+ uint16_t block_index;
+ for (block_index=0; block_index<size; block_index++){
+ DoWriteFlowControl();
+ Endpoint_Read_Byte();
+ }
+}
+
+bool DataManager_ReadBlocks(uint32_t BlockAddress, uint16_t TotalBlocks)
+{
+ uint16_t block_index = 0;
+
+ while (TotalBlocks){
+ if (BlockAddress == 0){ //BOOT Record
+ for (block_index=0;block_index<62; block_index++){
+ DoReadFlowControl();
+ Endpoint_Write_Byte(pgm_read_byte(((char*)&fatBootData)+block_index));
+ }
+ for (block_index=0; block_index<448; block_index++){
+ DoReadFlowControl();
+ Endpoint_Write_Byte(0x00);
+ }
+ DoReadFlowControl();
+ Endpoint_Write_Byte(0x55);
+ Endpoint_Write_Byte(0xaa);
+ }
+ else if (BlockAddress == 1 || BlockAddress == 18){ //FAT TABLE 1 and 2 (15 blocks)
+ //first two sectors are not used
+ DoReadFlowControl();
+ Endpoint_Write_Byte(0xf0);
+ Endpoint_Write_Byte(0xff);
+ Endpoint_Write_Byte(0xff);
+ Endpoint_Write_Byte(0xff);
+ //sector 2 where data start
+ Endpoint_Write_Byte(0xff);
+ Endpoint_Write_Byte(0xff);
+
+ for (block_index=6; block_index<VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){
+ DoReadFlowControl();
+ Endpoint_Write_Byte(0x00);
+ }
+ }
+ else if (BlockAddress == 35){ //Root Directory
+ for (block_index=0;block_index<32; block_index++){
+ DoReadFlowControl();
+ Endpoint_Write_Byte(pgm_read_byte(((char*)&rootDir)+block_index));
+ }
+ for (block_index=32; block_index<VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){
+ DoReadFlowControl();
+ Endpoint_Write_Byte(0x00);
+ }
+ }
+ else if (BlockAddress == 67){ //STATUS.TXT
+ Serial_TxByte(START_CODE);
+ Serial_TxByte(PACKET_HEADER_LENGTH);
+ Serial_TxByte(STATUS_REQ);
+
+ uint8_t length, packet_type;
+ while(true){
+ while (SerialWaitUntilReady() && Serial_RxByte() != START_CODE);
+ SerialWaitUntilReady();
+ length = Serial_RxByte();
+ if (length > PACKET_HEADER_LENGTH){
+ length -= PACKET_HEADER_LENGTH;
+ SerialWaitUntilReady();
+ packet_type = Serial_RxByte();
+ if (packet_type == STATUS_RESP)
+ break;
+ }
+ }
+
+ for (block_index=0; block_index<length; block_index++){
+ SerialWaitUntilReady();
+ DoReadFlowControl();
+ Endpoint_Write_Byte(Serial_RxByte());
+ }
+
+ for (block_index=length; block_index<VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){
+ DoReadFlowControl();
+ Endpoint_Write_Byte(0x00);
+ }
+ }
+ else{
+ for (block_index=0; block_index<VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){
+ DoReadFlowControl();
+ Endpoint_Write_Byte(0x00);
+ }
+ }
+
+ BlockAddress++;
+ TotalBlocks--;
+ }
+
+ if (!(Endpoint_IsReadWriteAllowed()))
+ Endpoint_ClearIN();
+
+ return true;
+}
+
+bool DataManager_WriteBlocks(uint32_t BlockAddress, uint16_t TotalBlocks)
+{
+ uint16_t block_index;
+ bool bSignatureFound = false;
+ while(TotalBlocks){
+ if (BlockAddress > 67 && bSignatureFound == false){ //in data sector
+ bSignatureFound = true;
+ for (block_index=0; block_index<FILE_SIGNATURE_LEN; block_index++){
+ DoWriteFlowControl();
+ if (Endpoint_Read_Byte() != FILE_SIGNATURE[block_index]){
+ FlushBlock(VIRTUAL_MEMORY_BLOCK_SIZE-block_index-1);
+ bSignatureFound = false;
+ break;
+ }
+ }
+ if (bSignatureFound){
+ Serial_TxByte(START_CODE);
+ Serial_TxByte(PACKET_HEADER_LENGTH+FILE_MAX_LENGTH);
+ Serial_TxByte(SEND_CMD);
+ for (block_index=0; block_index<FILE_MAX_LENGTH; block_index++){
+ DoWriteFlowControl();
+ Serial_TxByte(Endpoint_Read_Byte());
+ }
+ FlushBlock(VIRTUAL_MEMORY_BLOCK_SIZE-FILE_MAX_LENGTH-FILE_SIGNATURE_LEN);
+ }
+ }
+ else{
+ FlushBlock(VIRTUAL_MEMORY_BLOCK_SIZE);
+ }
+ BlockAddress++;
+ TotalBlocks--;
+ }
+
+ if (!(Endpoint_IsReadWriteAllowed()))
+ Endpoint_ClearOUT();
+
+ return true;
+}
+
diff --git a/usb/DataManager.h b/usb/DataManager.h
new file mode 100755
index 0000000..7a5193f
--- /dev/null
+++ b/usb/DataManager.h
@@ -0,0 +1,2 @@
+bool DataManager_ReadBlocks(uint32_t BlockAddress, uint16_t TotalBlocks);
+bool DataManager_WriteBlocks(uint32_t BlockAddress, uint16_t TotalBlocks);
diff --git a/usb/MassStorage.aps b/usb/MassStorage.aps
index 553dde5..ffff54c 100644
--- a/usb/MassStorage.aps
+++ b/usb/MassStorage.aps
@@ -1 +1 @@
-<AVRStudio><MANAGEMENT><ProjectName>MassStorage</ProjectName><Created>29-Apr-2011 23:58:06</Created><LastEdit>30-May-2011 23:36:43</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>29-Apr-2011 23:58:06</Created><Version>4</Version><Build>4, 18, 0, 670</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>MassStorage.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>Z:\josh_on_mac\dev\OpenPCR\usb\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>JTAGICE mkII</CURRENT_TARGET><CURRENT_PART>ATmega8U2</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0><Variables>fatBootData</Variables><Variables>byte</Variables><Variables>Byte</Variables><Variables>block_index</Variables><Variables>MSInterfaceInfo</Variables><Variables>MSInterfaceInfo-&gt;State.CommandBlock.DataTransferLength</Variables></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><modules><module></module></modules><Triggers><trigger clsid="{113824F1-C410-4699-A25E-867CC860C28E}" enabled="0" boundTo="0" hitCount="1" updateAndContinue="0" line="182" file="Descriptors.c" token=" const uint8_t DescriptorType = (wValue &gt;&gt; 8);" offset="0"/><trigger clsid="{113824F1-C410-4699-A25E-867CC860C28E}" enabled="0" boundTo="0" hitCount="1" updateAndContinue="0" line="130" file="MassStorage.c" token="}" offset="0"/><trigger clsid="{113824F1-C410-4699-A25E-867CC860C28E}" enabled="1" boundTo="0" hitCount="1" updateAndContinue="0" line="436" file="SCSI.c" token=" for (block_index=1; block_index&lt;VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){" offset="0"/><trigger clsid="{113824F1-C410-4699-A25E-867CC860C28E}" enabled="1" boundTo="0" hitCount="1" updateAndContinue="0" line="441" file="SCSI.c" token=" for (block_index=0; block_index&lt;VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){" offset="0"/><trigger clsid="{113824F1-C410-4699-A25E-867CC860C28E}" enabled="1" boundTo="0" hitCount="1" updateAndContinue="0" line="427" file="SCSI.c" token=" for (block_index=0;block_index&lt;32; block_index++){" offset="0"/><trigger clsid="{113824F1-C410-4699-A25E-867CC860C28E}" enabled="1" boundTo="0" hitCount="1" updateAndContinue="0" line="421" file="SCSI.c" token=" for (block_index=6; block_index&lt;VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){" offset="0"/></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>MassStorage.c</SOURCEFILE><SOURCEFILE>Descriptors.c</SOURCEFILE><SOURCEFILE>SCSI.c</SOURCEFILE><HEADERFILE>MassStorage.h</HEADERFILE><HEADERFILE>Descriptors.h</HEADERFILE><HEADERFILE>SCSI.h</HEADERFILE><OTHERFILE>makefile</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>YES</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE>makefile</EXTERNALMAKEFILE><PART>atmega8u2</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>MassStorage.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\WinAVR-20100110\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20100110\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="1" column="0" ordername="1" orderaddress="1" ordergroup="1"/></IOView><Files><File00000><FileId>00000</FileId><FileName>MassStorage.c</FileName><Status>259</Status></File00000><File00001><FileId>00001</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\Board\UNO\LEDs.h</FileName><Status>2</Status></File00001><File00002><FileId>00002</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\Class\Device\MassStorage.c</FileName><Status>259</Status></File00002><File00003><FileId>00003</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\HighLevel\USBTask.c</FileName><Status>258</Status></File00003><File00004><FileId>00004</FileId><FileName>Descriptors.c</FileName><Status>258</Status></File00004><File00005><FileId>00005</FileId><FileName>SCSI.c</FileName><Status>259</Status></File00005><File00006><FileId>00006</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\LowLevel\USBInterrupt.c</FileName><Status>258</Status></File00006><File00007><FileId>00007</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\LowLevel\Endpoint.h</FileName><Status>259</Status></File00007><File00008><FileId>00008</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Common\Common.h</FileName><Status>258</Status></File00008><File00009><FileId>00009</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\LowLevel\USBController.h</FileName><Status>258</Status></File00009><File00010><FileId>00010</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\HighLevel\DeviceStandardReq.c</FileName><Status>258</Status></File00010><File00011><FileId>00011</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\HighLevel\Template\Template_Endpoint_Control_W.c</FileName><Status>258</Status></File00011><File00012><FileId>00012</FileId><FileName>SCSI.h</FileName><Status>1</Status></File00012></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
+<AVRStudio><MANAGEMENT><ProjectName>MassStorage</ProjectName><Created>29-Apr-2011 23:58:06</Created><LastEdit>08-Jun-2011 01:43:03</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>29-Apr-2011 23:58:06</Created><Version>4</Version><Build>4, 18, 0, 670</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>MassStorage.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>Z:\josh_on_mac\dev\OpenPCR\usb\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>JTAGICE mkII</CURRENT_TARGET><CURRENT_PART>ATmega8U2</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>2</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0><Variables>fatBootData</Variables><Variables>byte</Variables><Variables>Byte</Variables><Variables>block_index</Variables><Variables>MSInterfaceInfo</Variables><Variables>MSInterfaceInfo-&gt;State.CommandBlock.DataTransferLength</Variables><Variables>UEDATX</Variables><Variables>sectorZero</Variables><Variables>&amp;byte</Variables><Variables>i</Variables><Variables>BlockAddress</Variables><Variables>TotalBlocks</Variables><Variables>MSInterfaceInfo-&gt;State.CommandBlock.SCSICommandData[0]</Variables><Variables>BlockAddress</Variables></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><modules><module></module></modules><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>MassStorage.c</SOURCEFILE><SOURCEFILE>Descriptors.c</SOURCEFILE><SOURCEFILE>SCSI.c</SOURCEFILE><SOURCEFILE>DataManager.c</SOURCEFILE><HEADERFILE>MassStorage.h</HEADERFILE><HEADERFILE>Descriptors.h</HEADERFILE><HEADERFILE>SCSI.h</HEADERFILE><OTHERFILE>makefile</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>YES</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE>makefile</EXTERNALMAKEFILE><PART>atmega8u2</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>MassStorage.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\WinAVR-20100110\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20100110\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="1" column="0" ordername="1" orderaddress="0" ordergroup="0"/></IOView><Files><File00000><FileId>00000</FileId><FileName>MassStorage.c</FileName><Status>259</Status></File00000><File00001><FileId>00001</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\Board\UNO\LEDs.h</FileName><Status>2</Status></File00001><File00002><FileId>00002</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\Class\Device\MassStorage.c</FileName><Status>259</Status></File00002><File00003><FileId>00003</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\HighLevel\USBTask.c</FileName><Status>259</Status></File00003><File00004><FileId>00004</FileId><FileName>SCSI.c</FileName><Status>257</Status></File00004><File00005><FileId>00005</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\LowLevel\USBInterrupt.c</FileName><Status>259</Status></File00005><File00006><FileId>00006</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\LowLevel\Endpoint.h</FileName><Status>258</Status></File00006><File00007><FileId>00007</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Common\Common.h</FileName><Status>258</Status></File00007><File00008><FileId>00008</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\LowLevel\USBController.h</FileName><Status>258</Status></File00008><File00009><FileId>00009</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\HighLevel\DeviceStandardReq.c</FileName><Status>258</Status></File00009><File00010><FileId>00010</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\HighLevel\Template\Template_Endpoint_Control_W.c</FileName><Status>258</Status></File00010><File00011><FileId>00011</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\LowLevel\Endpoint.c</FileName><Status>259</Status></File00011><File00012><FileId>00012</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\USB\LowLevel\USBController.c</FileName><Status>258</Status></File00012><File00013><FileId>00013</FileId><FileName>DataManager.c</FileName><Status>259</Status></File00013><File00014><FileId>00014</FileId><FileName>Z:\josh_on_mac\dev\LUFA101122\LUFA\Drivers\Peripheral\Serial.h</FileName><Status>259</Status></File00014></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
diff --git a/usb/MassStorage.c b/usb/MassStorage.c
index 5fd8b03..de6c7e7 100755
--- a/usb/MassStorage.c
+++ b/usb/MassStorage.c
@@ -34,6 +34,7 @@
* the demo and is responsible for the initial application hardware configuration.
*/
+#include <LUFA/Drivers/Peripheral/Serial.h>
#include "MassStorage.h"
/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
@@ -87,6 +88,7 @@ void SetupHardware(void)
/* Hardware Initialization */
// LEDs_Init();
// SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
+ Serial_Init(9600, false);
USB_Init();
}
diff --git a/usb/MassStorage.s b/usb/MassStorage.s
deleted file mode 100755
index d9dc8f7..0000000
--- a/usb/MassStorage.s
+++ /dev/null
@@ -1,1399 +0,0 @@
- .file "MassStorage.c"
-__SREG__ = 0x3f
-__SP_H__ = 0x3e
-__SP_L__ = 0x3d
-__CCP__ = 0x34
-__tmp_reg__ = 0
-__zero_reg__ = 1
- .section .debug_abbrev,"",@progbits
-.Ldebug_abbrev0:
- .section .debug_info,"",@progbits
-.Ldebug_info0:
- .section .debug_line,"",@progbits
-.Ldebug_line0:
- .text
-.Ltext0:
- .section .text.EVENT_USB_Device_Connect,"ax",@progbits
-.global EVENT_USB_Device_Connect
- .type EVENT_USB_Device_Connect, @function
-EVENT_USB_Device_Connect:
-.LFB90:
-.LSM0:
-/* prologue: function */
-/* frame size = 0 */
-/* epilogue start */
-.LSM1:
- ret
-.LFE90:
- .size EVENT_USB_Device_Connect, .-EVENT_USB_Device_Connect
- .section .text.EVENT_USB_Device_Disconnect,"ax",@progbits
-.global EVENT_USB_Device_Disconnect
- .type EVENT_USB_Device_Disconnect, @function
-EVENT_USB_Device_Disconnect:
-.LFB91:
-.LSM2:
-/* prologue: function */
-/* frame size = 0 */
-/* epilogue start */
-.LSM3:
- ret
-.LFE91:
- .size EVENT_USB_Device_Disconnect, .-EVENT_USB_Device_Disconnect
- .section .text.CALLBACK_MS_Device_SCSICommandReceived,"ax",@progbits
-.global CALLBACK_MS_Device_SCSICommandReceived
- .type CALLBACK_MS_Device_SCSICommandReceived, @function
-CALLBACK_MS_Device_SCSICommandReceived:
-.LFB94:
-.LSM4:
-.LVL0:
-/* prologue: function */
-/* frame size = 0 */
-.LSM5:
- call SCSI_DecodeSCSICommand
-.LVL1:
-/* epilogue start */
-.LSM6:
- ret
-.LFE94:
- .size CALLBACK_MS_Device_SCSICommandReceived, .-CALLBACK_MS_Device_SCSICommandReceived
- .section .text.EVENT_USB_Device_ControlRequest,"ax",@progbits
-.global EVENT_USB_Device_ControlRequest
- .type EVENT_USB_Device_ControlRequest, @function
-EVENT_USB_Device_ControlRequest:
-.LFB93:
-.LSM7:
-/* prologue: function */
-/* frame size = 0 */
-.LSM8:
- ldi r24,lo8(Disk_MS_Interface)
- ldi r25,hi8(Disk_MS_Interface)
- call MS_Device_ProcessControlRequest
-/* epilogue start */
-.LSM9:
- ret
-.LFE93:
- .size EVENT_USB_Device_ControlRequest, .-EVENT_USB_Device_ControlRequest
- .section .text.EVENT_USB_Device_ConfigurationChanged,"ax",@progbits
-.global EVENT_USB_Device_ConfigurationChanged
- .type EVENT_USB_Device_ConfigurationChanged, @function
-EVENT_USB_Device_ConfigurationChanged:
-.LFB92:
-.LSM10:
-/* prologue: function */
-/* frame size = 0 */
-.LSM11:
- ldi r24,lo8(Disk_MS_Interface)
- ldi r25,hi8(Disk_MS_Interface)
- call MS_Device_ConfigureEndpoints
-/* epilogue start */
-.LSM12:
- ret
-.LFE92:
- .size EVENT_USB_Device_ConfigurationChanged, .-EVENT_USB_Device_ConfigurationChanged
- .section .text.SetupHardware,"ax",@progbits
-.global SetupHardware
- .type SetupHardware, @function
-SetupHardware:
-.LFB89:
-.LSM13:
-/* prologue: function */
-/* frame size = 0 */
-.LSM14:
- in r24,84-32
- andi r24,lo8(-9)
- out 84-32,r24
-.LSM15:
- ldi r24,lo8(24)
-/* #APP */
- ; 82 "MassStorage.c" 1
- in __tmp_reg__, __SREG__
- cli
- sts 96, r24
- sts 96, __zero_reg__
- out __SREG__,__tmp_reg__
-
- ; 0 "" 2
-.LSM16:
-/* #NOAPP */
- call USB_Init
-/* epilogue start */
-.LSM17:
- ret
-.LFE89:
- .size SetupHardware, .-SetupHardware
- .section .text.main,"ax",@progbits
-.global main
- .type main, @function
-main:
-.LFB88:
-.LSM18:
-/* prologue: function */
-/* frame size = 0 */
-.LSM19:
- call SetupHardware
-.LSM20:
-/* #APP */
- ; 68 "MassStorage.c" 1
- sei
- ; 0 "" 2
-/* #NOAPP */
-.L14:
-.LSM21:
- ldi r24,lo8(Disk_MS_Interface)
- ldi r25,hi8(Disk_MS_Interface)
- call MS_Device_USBTask
-.LSM22:
- call USB_USBTask
- rjmp .L14
-.LFE88:
- .size main, .-main
-.global Disk_MS_Interface
- .data
- .type Disk_MS_Interface, @object
- .size Disk_MS_Interface, 55
-Disk_MS_Interface:
- .byte 0
- .byte 3
- .word 64
- .byte 0
- .byte 4
- .word 64
- .byte 0
- .byte 1
- .skip 45,0
- .section .debug_frame,"",@progbits
-.Lframe0:
- .long .LECIE0-.LSCIE0
-.LSCIE0:
- .long 0xffffffff
- .byte 0x1
- .string ""
- .uleb128 0x1
- .sleb128 -1
- .byte 0x24
- .byte 0xc
- .uleb128 0x20
- .uleb128 0x0
- .p2align 2
-.LECIE0:
-.LSFDE0:
- .long .LEFDE0-.LASFDE0
-.LASFDE0:
- .long .Lframe0
- .long .LFB90
- .long .LFE90-.LFB90
- .p2align 2
-.LEFDE0:
-.LSFDE2:
- .long .LEFDE2-.LASFDE2
-.LASFDE2:
- .long .Lframe0
- .long .LFB91
- .long .LFE91-.LFB91
- .p2align 2
-.LEFDE2:
-.LSFDE4:
- .long .LEFDE4-.LASFDE4
-.LASFDE4:
- .long .Lframe0
- .long .LFB94
- .long .LFE94-.LFB94
- .p2align 2
-.LEFDE4:
-.LSFDE6:
- .long .LEFDE6-.LASFDE6
-.LASFDE6:
- .long .Lframe0
- .long .LFB93
- .long .LFE93-.LFB93
- .p2align 2
-.LEFDE6:
-.LSFDE8:
- .long .LEFDE8-.LASFDE8
-.LASFDE8:
- .long .Lframe0
- .long .LFB92
- .long .LFE92-.LFB92
- .p2align 2
-.LEFDE8:
-.LSFDE10:
- .long .LEFDE10-.LASFDE10
-.LASFDE10:
- .long .Lframe0
- .long .LFB89
- .long .LFE89-.LFB89
- .p2align 2
-.LEFDE10:
-.LSFDE12:
- .long .LEFDE12-.LASFDE12
-.LASFDE12:
- .long .Lframe0
- .long .LFB88
- .long .LFE88-.LFB88
- .p2align 2
-.LEFDE12:
- .text
-.Letext0:
- .section .debug_loc,"",@progbits
-.Ldebug_loc0:
-.LLST3:
- .long .LVL0
- .long .LVL1
- .word 0x6
- .byte 0x68
- .byte 0x93
- .uleb128 0x1
- .byte 0x69
- .byte 0x93
- .uleb128 0x1
- .long 0x0
- .long 0x0
- .section .debug_info
- .long 0x33a
- .word 0x2
- .long .Ldebug_abbrev0
- .byte 0x4
- .uleb128 0x1
- .long .LASF41
- .byte 0x1
- .long .LASF42
- .long .LASF43
- .long 0x0
- .long 0x0
- .long .Ldebug_ranges0+0x0
- .long .Ldebug_line0
- .uleb128 0x2
- .byte 0x1
- .byte 0x6
- .long .LASF0
- .uleb128 0x3
- .long .LASF2
- .byte 0x2
- .byte 0x7a
- .long 0x3b
- .uleb128 0x2
- .byte 0x1
- .byte 0x8
- .long .LASF1
- .uleb128 0x4
- .byte 0x2
- .byte 0x5
- .string "int"
- .uleb128 0x3
- .long .LASF3
- .byte 0x2
- .byte 0x7c
- .long 0x54
- .uleb128 0x2
- .byte 0x2
- .byte 0x7
- .long .LASF4
- .uleb128 0x2
- .byte 0x4
- .byte 0x5
- .long .LASF5
- .uleb128 0x3
- .long .LASF6
- .byte 0x2
- .byte 0x7e
- .long 0x6d
- .uleb128 0x2
- .byte 0x4
- .byte 0x7
- .long .LASF7
- .uleb128 0x2
- .byte 0x8
- .byte 0x5
- .long .LASF8
- .uleb128 0x2
- .byte 0x8
- .byte 0x7
- .long .LASF9
- .uleb128 0x5
- .byte 0x1
- .byte 0x8
- .uleb128 0x5
- .byte 0x2
- .byte 0x7
- .uleb128 0x2
- .byte 0x1
- .byte 0x2
- .long .LASF10
- .uleb128 0x2
- .byte 0x1
- .byte 0x8
- .long .LASF11
- .uleb128 0x6
- .byte 0x1f
- .byte 0x3
- .word 0x107
- .long 0x109
- .uleb128 0x7
- .long .LASF12
- .byte 0x3
- .word 0x108
- .long 0x62
- .byte 0x2
- .byte 0x23
- .uleb128 0x0
- .uleb128 0x8
- .string "Tag"
- .byte 0x3
- .word 0x109
- .long 0x62
- .byte 0x2
- .byte 0x23
- .uleb128 0x4
- .uleb128 0x7
- .long .LASF13
- .byte 0x3
- .word 0x10a
- .long 0x62
- .byte 0x2
- .byte 0x23
- .uleb128 0x8
- .uleb128 0x7
- .long .LASF14
- .byte 0x3
- .word 0x10b
- .long 0x30
- .byte 0x2
- .byte 0x23
- .uleb128 0xc
- .uleb128 0x8
- .string "LUN"
- .byte 0x3
- .word 0x10c
- .long 0x30
- .byte 0x2
- .byte 0x23
- .uleb128 0xd
- .uleb128 0x7
- .long .LASF15
- .byte 0x3
- .word 0x10d
- .long 0x30
- .byte 0x2
- .byte 0x23
- .uleb128 0xe
- .uleb128 0x7
- .long .LASF16
- .byte 0x3
- .word 0x10e
- .long 0x109
- .byte 0x2
- .byte 0x23
- .uleb128 0xf
- .byte 0x0
- .uleb128 0x9
- .long 0x30
- .long 0x119
- .uleb128 0xa
- .long 0x85
- .byte 0xf
- .byte 0x0
- .uleb128 0xb
- .long .LASF17
- .byte 0x3
- .word 0x10f
- .long 0x96
- .uleb128 0x6
- .byte 0xd
- .byte 0x3
- .word 0x116
- .long 0x16b
- .uleb128 0x7
- .long .LASF12
- .byte 0x3
- .word 0x117
- .long 0x62
- .byte 0x2
- .byte 0x23
- .uleb128 0x0
- .uleb128 0x8
- .string "Tag"
- .byte 0x3
- .word 0x118
- .long 0x62
- .byte 0x2
- .byte 0x23
- .uleb128 0x4
- .uleb128 0x7
- .long .LASF18
- .byte 0x3
- .word 0x119
- .long 0x62
- .byte 0x2
- .byte 0x23
- .uleb128 0x8
- .uleb128 0x7
- .long .LASF19
- .byte 0x3
- .word 0x11a
- .long 0x30
- .byte 0x2
- .byte 0x23
- .uleb128 0xc
- .byte 0x0
- .uleb128 0xb
- .long .LASF20
- .byte 0x3
- .word 0x11b
- .long 0x125
- .uleb128 0xc
- .byte 0xa
- .byte 0x4
- .byte 0x57
- .long 0x1f0
- .uleb128 0xd
- .long .LASF21
- .byte 0x4
- .byte 0x58
- .long 0x30
- .byte 0x2
- .byte 0x23
- .uleb128 0x0
- .uleb128 0xd
- .long .LASF22
- .byte 0x4
- .byte 0x5a
- .long 0x30
- .byte 0x2
- .byte 0x23
- .uleb128 0x1
- .uleb128 0xd
- .long .LASF23
- .byte 0x4
- .byte 0x5b
- .long 0x49
- .byte 0x2
- .byte 0x23
- .uleb128 0x2
- .uleb128 0xd
- .long .LASF24
- .byte 0x4
- .byte 0x5c
- .long 0x88
- .byte 0x2
- .byte 0x23
- .uleb128 0x4
- .uleb128 0xd
- .long .LASF25
- .byte 0x4
- .byte 0x5e
- .long 0x30
- .byte 0x2
- .byte 0x23
- .uleb128 0x5
- .uleb128 0xd
- .long .LASF26
- .byte 0x4
- .byte 0x5f
- .long 0x49
- .byte 0x2
- .byte 0x23
- .uleb128 0x6
- .uleb128 0xd
- .long .LASF27
- .byte 0x4
- .byte 0x60
- .long 0x88
- .byte 0x2
- .byte 0x23
- .uleb128 0x8
- .uleb128 0xd
- .long .LASF28
- .byte 0x4
- .byte 0x62
- .long 0x30
- .byte 0x2
- .byte 0x23
- .uleb128 0x9
- .byte 0x0
- .uleb128 0xc
- .byte 0x2d
- .byte 0x4
- .byte 0x67
- .long 0x223
- .uleb128 0xd
- .long .LASF29
- .byte 0x4
- .byte 0x68
- .long 0x119
- .byte 0x2
- .byte 0x23
- .uleb128 0x0
- .uleb128 0xd
- .long .LASF30
- .byte 0x4
- .byte 0x6b
- .long 0x16b
- .byte 0x2
- .byte 0x23
- .uleb128 0x1f
- .uleb128 0xd
- .long .LASF31
- .byte 0x4
- .byte 0x6e
- .long 0x223
- .byte 0x2
- .byte 0x23
- .uleb128 0x2c
- .byte 0x0
- .uleb128 0xe
- .long 0x88
- .uleb128 0xc
- .byte 0x37
- .byte 0x4
- .byte 0x55
- .long 0x24d
- .uleb128 0xd
- .long .LASF32
- .byte 0x4
- .byte 0x63
- .long 0x24d
- .byte 0x2
- .byte 0x23
- .uleb128 0x0
- .uleb128 0xd
- .long .LASF33
- .byte 0x4
- .byte 0x71
- .long 0x1f0
- .byte 0x2
- .byte 0x23
- .uleb128 0xa
- .byte 0x0
- .uleb128 0xf
- .long 0x177
- .uleb128 0x3
- .long .LASF34
- .byte 0x4
- .byte 0x74
- .long 0x228
- .uleb128 0x10
- .byte 0x1
- .long .LASF35
- .byte 0x1
- .byte 0x5f
- .byte 0x1
- .long .LFB90
- .long .LFE90
- .byte 0x2
- .byte 0x90
- .uleb128 0x20
- .uleb128 0x10
- .byte 0x1
- .long .LASF36
- .byte 0x1
- .byte 0x65
- .byte 0x1
- .long .LFB91
- .long .LFE91
- .byte 0x2
- .byte 0x90
- .uleb128 0x20
- .uleb128 0x11
- .byte 0x1
- .long .LASF44
- .byte 0x1
- .byte 0x7c
- .byte 0x1
- .long 0x88
- .long .LFB94
- .long .LFE94
- .byte 0x2
- .byte 0x90
- .uleb128 0x20
- .long 0x2bc
- .uleb128 0x12
- .long .LASF45
- .byte 0x1
- .byte 0x7b
- .long 0x2bc
- .long .LLST3
- .uleb128 0x13
- .long .LASF38
- .byte 0x1
- .byte 0x7d
- .long 0x88
- .byte 0x0
- .uleb128 0xf
- .long 0x2c1
- .uleb128 0x14
- .byte 0x2
- .long 0x252
- .uleb128 0x10
- .byte 0x1
- .long .LASF37
- .byte 0x1
- .byte 0x73
- .byte 0x1
- .long .LFB93
- .long .LFE93
- .byte 0x2
- .byte 0x90
- .uleb128 0x20
- .uleb128 0x15
- .byte 0x1
- .long .LASF46
- .byte 0x1
- .byte 0x6b
- .byte 0x1
- .long .LFB92
- .long .LFE92
- .byte 0x2
- .byte 0x90
- .uleb128 0x20
- .long 0x2ff
- .uleb128 0x13
- .long .LASF39
- .byte 0x1
- .byte 0x6c
- .long 0x88
- .byte 0x0
- .uleb128 0x10
- .byte 0x1
- .long .LASF40
- .byte 0x1
- .byte 0x4f
- .byte 0x1
- .long .LFB89
- .long .LFE89
- .byte 0x2
- .byte 0x90
- .uleb128 0x20
- .uleb128 0x16
- .byte 0x1
- .long .LASF47
- .byte 0x1
- .byte 0x41
- .byte 0x1
- .long 0x42
- .long .LFB88
- .long .LFE88
- .byte 0x2
- .byte 0x90
- .uleb128 0x20
- .uleb128 0x17
- .long .LASF48
- .byte 0x1
- .byte 0x2b
- .long 0x252
- .byte 0x1
- .byte 0x5
- .byte 0x3
- .long Disk_MS_Interface
- .byte 0x0
- .section .debug_abbrev
- .uleb128 0x1
- .uleb128 0x11
- .byte 0x1
- .uleb128 0x25
- .uleb128 0xe
- .uleb128 0x13
- .uleb128 0xb
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x1b
- .uleb128 0xe
- .uleb128 0x11
- .uleb128 0x1
- .uleb128 0x52
- .uleb128 0x1
- .uleb128 0x55
- .uleb128 0x6
- .uleb128 0x10
- .uleb128 0x6
- .byte 0x0
- .byte 0x0
- .uleb128 0x2
- .uleb128 0x24
- .byte 0x0
- .uleb128 0xb
- .uleb128 0xb
- .uleb128 0x3e
- .uleb128 0xb
- .uleb128 0x3
- .uleb128 0xe
- .byte 0x0
- .byte 0x0
- .uleb128 0x3
- .uleb128 0x16
- .byte 0x0
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x49
- .uleb128 0x13
- .byte 0x0
- .byte 0x0
- .uleb128 0x4
- .uleb128 0x24
- .byte 0x0
- .uleb128 0xb
- .uleb128 0xb
- .uleb128 0x3e
- .uleb128 0xb
- .uleb128 0x3
- .uleb128 0x8
- .byte 0x0
- .byte 0x0
- .uleb128 0x5
- .uleb128 0x24
- .byte 0x0
- .uleb128 0xb
- .uleb128 0xb
- .uleb128 0x3e
- .uleb128 0xb
- .byte 0x0
- .byte 0x0
- .uleb128 0x6
- .uleb128 0x13
- .byte 0x1
- .uleb128 0xb
- .uleb128 0xb
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0x5
- .uleb128 0x1
- .uleb128 0x13
- .byte 0x0
- .byte 0x0
- .uleb128 0x7
- .uleb128 0xd
- .byte 0x0
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0x5
- .uleb128 0x49
- .uleb128 0x13
- .uleb128 0x38
- .uleb128 0xa
- .byte 0x0
- .byte 0x0
- .uleb128 0x8
- .uleb128 0xd
- .byte 0x0
- .uleb128 0x3
- .uleb128 0x8
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0x5
- .uleb128 0x49
- .uleb128 0x13
- .uleb128 0x38
- .uleb128 0xa
- .byte 0x0
- .byte 0x0
- .uleb128 0x9
- .uleb128 0x1
- .byte 0x1
- .uleb128 0x49
- .uleb128 0x13
- .uleb128 0x1
- .uleb128 0x13
- .byte 0x0
- .byte 0x0
- .uleb128 0xa
- .uleb128 0x21
- .byte 0x0
- .uleb128 0x49
- .uleb128 0x13
- .uleb128 0x2f
- .uleb128 0xb
- .byte 0x0
- .byte 0x0
- .uleb128 0xb
- .uleb128 0x16
- .byte 0x0
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0x5
- .uleb128 0x49
- .uleb128 0x13
- .byte 0x0
- .byte 0x0
- .uleb128 0xc
- .uleb128 0x13
- .byte 0x1
- .uleb128 0xb
- .uleb128 0xb
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x1
- .uleb128 0x13
- .byte 0x0
- .byte 0x0
- .uleb128 0xd
- .uleb128 0xd
- .byte 0x0
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x49
- .uleb128 0x13
- .uleb128 0x38
- .uleb128 0xa
- .byte 0x0
- .byte 0x0
- .uleb128 0xe
- .uleb128 0x35
- .byte 0x0
- .uleb128 0x49
- .uleb128 0x13
- .byte 0x0
- .byte 0x0
- .uleb128 0xf
- .uleb128 0x26
- .byte 0x0
- .uleb128 0x49
- .uleb128 0x13
- .byte 0x0
- .byte 0x0
- .uleb128 0x10
- .uleb128 0x2e
- .byte 0x0
- .uleb128 0x3f
- .uleb128 0xc
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x27
- .uleb128 0xc
- .uleb128 0x11
- .uleb128 0x1
- .uleb128 0x12
- .uleb128 0x1
- .uleb128 0x40
- .uleb128 0xa
- .byte 0x0
- .byte 0x0
- .uleb128 0x11
- .uleb128 0x2e
- .byte 0x1
- .uleb128 0x3f
- .uleb128 0xc
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x27
- .uleb128 0xc
- .uleb128 0x49
- .uleb128 0x13
- .uleb128 0x11
- .uleb128 0x1
- .uleb128 0x12
- .uleb128 0x1
- .uleb128 0x40
- .uleb128 0xa
- .uleb128 0x1
- .uleb128 0x13
- .byte 0x0
- .byte 0x0
- .uleb128 0x12
- .uleb128 0x5
- .byte 0x0
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x49
- .uleb128 0x13
- .uleb128 0x2
- .uleb128 0x6
- .byte 0x0
- .byte 0x0
- .uleb128 0x13
- .uleb128 0x34
- .byte 0x0
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x49
- .uleb128 0x13
- .byte 0x0
- .byte 0x0
- .uleb128 0x14
- .uleb128 0xf
- .byte 0x0
- .uleb128 0xb
- .uleb128 0xb
- .uleb128 0x49
- .uleb128 0x13
- .byte 0x0
- .byte 0x0
- .uleb128 0x15
- .uleb128 0x2e
- .byte 0x1
- .uleb128 0x3f
- .uleb128 0xc
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x27
- .uleb128 0xc
- .uleb128 0x11
- .uleb128 0x1
- .uleb128 0x12
- .uleb128 0x1
- .uleb128 0x40
- .uleb128 0xa
- .uleb128 0x1
- .uleb128 0x13
- .byte 0x0
- .byte 0x0
- .uleb128 0x16
- .uleb128 0x2e
- .byte 0x0
- .uleb128 0x3f
- .uleb128 0xc
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x27
- .uleb128 0xc
- .uleb128 0x49
- .uleb128 0x13
- .uleb128 0x11
- .uleb128 0x1
- .uleb128 0x12
- .uleb128 0x1
- .uleb128 0x40
- .uleb128 0xa
- .byte 0x0
- .byte 0x0
- .uleb128 0x17
- .uleb128 0x34
- .byte 0x0
- .uleb128 0x3
- .uleb128 0xe
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x49
- .uleb128 0x13
- .uleb128 0x3f
- .uleb128 0xc
- .uleb128 0x2
- .uleb128 0xa
- .byte 0x0
- .byte 0x0
- .byte 0x0
- .section .debug_pubnames,"",@progbits
- .long 0xf5
- .word 0x2
- .long .Ldebug_info0
- .long 0x33e
- .long 0x25d
- .string "EVENT_USB_Device_Connect"
- .long 0x271
- .string "EVENT_USB_Device_Disconnect"
- .long 0x285
- .string "CALLBACK_MS_Device_SCSICommandReceived"
- .long 0x2c7
- .string "EVENT_USB_Device_ControlRequest"
- .long 0x2db
- .string "EVENT_USB_Device_ConfigurationChanged"
- .long 0x2ff
- .string "SetupHardware"
- .long 0x313
- .string "main"
- .long 0x32b
- .string "Disk_MS_Interface"
- .long 0x0
- .section .debug_aranges,"",@progbits
- .long 0x4c
- .word 0x2
- .long .Ldebug_info0
- .byte 0x4
- .byte 0x0
- .word 0x0
- .word 0x0
- .long .LFB90
- .long .LFE90-.LFB90
- .long .LFB91
- .long .LFE91-.LFB91
- .long .LFB94
- .long .LFE94-.LFB94
- .long .LFB93
- .long .LFE93-.LFB93
- .long .LFB92
- .long .LFE92-.LFB92
- .long .LFB89
- .long .LFE89-.LFB89
- .long .LFB88
- .long .LFE88-.LFB88
- .long 0x0
- .long 0x0
- .section .debug_ranges,"",@progbits
-.Ldebug_ranges0:
- .long .Ltext0
- .long .Letext0
- .long .LFB90
- .long .LFE90
- .long .LFB91
- .long .LFE91
- .long .LFB94
- .long .LFE94
- .long .LFB93
- .long .LFE93
- .long .LFB92
- .long .LFE92
- .long .LFB89
- .long .LFE89
- .long .LFB88
- .long .LFE88
- .long 0x0
- .long 0x0
- .section .debug_line
- .long .LELT0-.LSLT0
-.LSLT0:
- .word 0x2
- .long .LELTP0-.LASLTP0
-.LASLTP0:
- .byte 0x1
- .byte 0x1
- .byte 0xf6
- .byte 0xf5
- .byte 0xa
- .byte 0x0
- .byte 0x1
- .byte 0x1
- .byte 0x1
- .byte 0x1
- .byte 0x0
- .byte 0x0
- .byte 0x0
- .byte 0x1
- .ascii "../../LUFA101122/LUFA/Drivers/USB/Class/Device"
- .byte 0
- .ascii "../../LUFA101122/LUFA/Drivers/USB/Class/Device/../Common"
- .byte 0
- .ascii "c:/winavr-20100110/lib/gcc/../../avr/include"
- .byte 0
- .byte 0x0
- .string "MassStorage.c"
- .uleb128 0x0
- .uleb128 0x0
- .uleb128 0x0
- .string "stdint.h"
- .uleb128 0x3
- .uleb128 0x0
- .uleb128 0x0
- .string "../Common/MassStorage.h"
- .uleb128 0x1
- .uleb128 0x0
- .uleb128 0x0
- .string "MassStorage.h"
- .uleb128 0x1
- .uleb128 0x0
- .uleb128 0x0
- .byte 0x0
-.LELTP0:
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .Letext0
- .byte 0x0
- .uleb128 0x1
- .byte 0x1
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM0
- .byte 0x72
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM1
- .byte 0x16
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LFE90
- .byte 0x0
- .uleb128 0x1
- .byte 0x1
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM2
- .byte 0x78
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM3
- .byte 0x16
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LFE91
- .byte 0x0
- .uleb128 0x1
- .byte 0x1
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM4
- .byte 0x8f
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM5
- .byte 0x17
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM6
- .byte 0x17
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LFE94
- .byte 0x0
- .uleb128 0x1
- .byte 0x1
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM7
- .byte 0x86
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM8
- .byte 0x15
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM9
- .byte 0x15
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LFE93
- .byte 0x0
- .uleb128 0x1
- .byte 0x1
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM10
- .byte 0x7e
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM11
- .byte 0x17
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM12
- .byte 0x15
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LFE92
- .byte 0x0
- .uleb128 0x1
- .byte 0x1
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM13
- .byte 0x62
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM14
- .byte 0x16
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM15
- .byte 0x15
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM16
- .byte 0x1c
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM17
- .byte 0x15
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LFE89
- .byte 0x0
- .uleb128 0x1
- .byte 0x1
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM18
- .byte 0x54
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM19
- .byte 0x15
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM20
- .byte 0x16
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM21
- .byte 0x18
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LSM22
- .byte 0x15
- .byte 0x0
- .uleb128 0x5
- .byte 0x2
- .long .LFE88
- .byte 0x0
- .uleb128 0x1
- .byte 0x1
-.LELT0:
- .section .debug_str,"MS",@progbits,1
-.LASF18:
- .string "DataTransferResidue"
-.LASF41:
- .string "GNU C 4.3.3"
-.LASF30:
- .string "CommandStatus"
-.LASF31:
- .string "IsMassStoreReset"
-.LASF38:
- .string "CommandSuccess"
-.LASF19:
- .string "Status"
-.LASF40:
- .string "SetupHardware"
-.LASF48:
- .string "Disk_MS_Interface"
-.LASF46:
- .string "EVENT_USB_Device_ConfigurationChanged"
-.LASF21:
- .string "InterfaceNumber"
-.LASF28:
- .string "TotalLUNs"
-.LASF39:
- .string "ConfigSuccess"
-.LASF36:
- .string "EVENT_USB_Device_Disconnect"
-.LASF32:
- .string "Config"
-.LASF29:
- .string "CommandBlock"
-.LASF33:
- .string "State"
-.LASF24:
- .string "DataINEndpointDoubleBank"
-.LASF1:
- .string "unsigned char"
-.LASF7:
- .string "long unsigned int"
-.LASF45:
- .string "MSInterfaceInfo"
-.LASF23:
- .string "DataINEndpointSize"
-.LASF16:
- .string "SCSICommandData"
-.LASF26:
- .string "DataOUTEndpointSize"
-.LASF47:
- .string "main"
-.LASF4:
- .string "unsigned int"
-.LASF25:
- .string "DataOUTEndpointNumber"
-.LASF15:
- .string "SCSICommandLength"
-.LASF9:
- .string "long long unsigned int"
-.LASF2:
- .string "uint8_t"
-.LASF22:
- .string "DataINEndpointNumber"
-.LASF35:
- .string "EVENT_USB_Device_Connect"
-.LASF17:
- .string "MS_CommandBlockWrapper_t"
-.LASF8:
- .string "long long int"
-.LASF12:
- .string "Signature"
-.LASF11:
- .string "char"
-.LASF37:
- .string "EVENT_USB_Device_ControlRequest"
-.LASF14:
- .string "Flags"
-.LASF27:
- .string "DataOUTEndpointDoubleBank"
-.LASF43:
- .string "Z:\\josh_on_mac\\dev\\OpenPCR\\usb"
-.LASF44:
- .string "CALLBACK_MS_Device_SCSICommandReceived"
-.LASF3:
- .string "uint16_t"
-.LASF13:
- .string "DataTransferLength"
-.LASF6:
- .string "uint32_t"
-.LASF5:
- .string "long int"
-.LASF0:
- .string "signed char"
-.LASF34:
- .string "USB_ClassInfo_MS_Device_t"
-.LASF10:
- .string "_Bool"
-.LASF20:
- .string "MS_CommandStatusWrapper_t"
-.LASF42:
- .string "MassStorage.c"
-.global __do_copy_data
diff --git a/usb/SCSI.c b/usb/SCSI.c
index 247996a..8532a77 100755
--- a/usb/SCSI.c
+++ b/usb/SCSI.c
@@ -37,6 +37,8 @@
#define INCLUDE_FROM_SCSI_C
#include "SCSI.h"
+#include "DataManager.h"
+
/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
* features and capabilities.
@@ -278,125 +280,6 @@ static bool SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
*
* \return Boolean true if the command completed successfully, false otherwise.
*/
- typedef PROGMEM struct
- {
- uint8_t bootstrap[3]; //eb 3c 90
- uint8_t OEM[8];
- uint16_t iBytesPerSector; //512
- uint8_t iSectorsPerCluster; //1
- uint16_t iReservedSectors; //1
- uint8_t iFATs; //2
- uint16_t iRootEntries;
- uint16_t iTotalSectors;
- uint8_t iMediaDescr;
- uint16_t iSectorsPerFAT;
- uint16_t iSectorsPerTrack;
- uint16_t iHeads;
- uint32_t iHiddenSectors;
- uint32_t iTotalSectorsEx;
- uint16_t iLogicDriveNumber;
- uint8_t extSignature; //29 (hex)
- uint32_t serialNumber;
- uint8_t volumeLabel[11];
- uint8_t fatName[8]; //FAT16
- //uint8_t exeCode[448];
- //uint8_t exeEndMarker[2]; //55 aa
- } FAT_BOOT_RECORD; //total 512 bytes
-
- //Boot Record: 1 sector; FAT1: 1 sector; FAT2: 1 sector; Root Directory: 1 sector
- FAT_BOOT_RECORD PROGMEM fatBootData =
- {
- .bootstrap = {0xeb, 0x3c, 0x90},
- .OEM = "OpenPCR ",
- .iBytesPerSector = 512,
- .iSectorsPerCluster = 1,
- .iReservedSectors = 1,
- .iFATs = 2,
- .iRootEntries = 512,
- .iTotalSectors = 4352,
- .iMediaDescr = 0xf0,
- .iSectorsPerFAT = 17,
- .iSectorsPerTrack = 0,
- .iHeads = 0,
- .iHiddenSectors = 0,
- .iTotalSectorsEx = 0,
- .iLogicDriveNumber = 0x00, //0x80,
- .extSignature = 0x29,
- .serialNumber = USE_INTERNAL_SERIAL,
- .volumeLabel = "OpenPCR ",
- .fatName = "FAT16 ",
- // .exeCode = {},
- // .exeEndMarker = {0x55, 0xaa}
- };
-
- typedef PROGMEM struct
- {
- uint8_t filename[8];
- uint8_t ext[3];
- uint8_t attribute;
- uint8_t reserved;
- uint8_t create_time_ms;
- uint16_t create_time;
- uint16_t create_date;
- uint16_t access_date;
- uint16_t first_cluster_highorder;
- uint16_t modified_time;
- uint16_t modified_date;
- uint16_t first_cluster_loworder;
- uint32_t size;
- } FAT_ROOT_DIRECTORY; //total 512 bytes
-
-/*date format: bits 0-4: day of month 1-31; bits 5-8: month of year 1-12; bits 9-15: years since 1980 0-127
- time format: bits 0-4: 2 second count 0-29; bits 5-10: minutes 0-59; bits 11-15: hours 0-23 */
- FAT_ROOT_DIRECTORY PROGMEM rootDir =
- {
- .filename = "TEST ",
- .ext = "TXT",
- .attribute = 0,
- .reserved = 0,
- .create_time_ms = 0,
- .create_time = 0x8800,
- .create_date = 0x3ea1,
- .access_date = 0x3ea1,
- .first_cluster_highorder = 0,
- .modified_time = 0x8800,
- .modified_date = 0x3ea1,
- .first_cluster_loworder = 2,
- .size = 3
- };
-
-static char file_var = 0x41;
-
-bool DoReadFlowControl() {
- /* Check if the endpoint is currently full */
- if (!(Endpoint_IsReadWriteAllowed()))
- {
- /* Clear the endpoint bank to send its contents to the host */
- Endpoint_ClearIN();
-
- /* Wait until the endpoint is ready for more data */
- if (Endpoint_WaitUntilReady())
- return false;
- }
-
- return true;
-}
-
-bool DoWriteFlowControl() {
- /* Check if the endpoint is currently full */
- if (!(Endpoint_IsReadWriteAllowed()))
- {
- /* Clear the endpoint bank to send its contents to the host */
- Endpoint_ClearOUT();
-
- /* Wait until the endpoint is ready for more data */
- if (Endpoint_WaitUntilReady())
- return false;
- }
-
- return true;
-}
-
static int SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const bool IsDataRead)
{
@@ -426,107 +309,12 @@ static int SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfac
#endif
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
- if (IsDataRead == DATA_READ){
- uint16_t block_index = 0;
-
- while (TotalBlocks){
- if (BlockAddress == 0){ //BOOT Record
- for (block_index=0; block_index<62; block_index++){
- DoReadFlowControl();
- Endpoint_Write_Byte(pgm_read_byte(((char*)&fatBootData)+block_index));
- }
- for (block_index=0; block_index<448; block_index++){
- DoReadFlowControl();
- Endpoint_Write_Byte(0x00);
- }
-
- DoReadFlowControl();
- Endpoint_Write_Byte(0x55);
- Endpoint_Write_Byte(0xaa);
- }
- else if (BlockAddress == 1 || BlockAddress == 18){ //FAT TABLE 1 and 2 (15 blocks)
- //first two sectors are not used
- DoReadFlowControl();
- Endpoint_Write_Byte(0xf0);
- Endpoint_Write_Byte(0xff);
- Endpoint_Write_Byte(0xff);
- Endpoint_Write_Byte(0xff);
- //sector 2 where data start
- /*
- for (block_index=2; block_index<10; block_index++){
- DoReadFlowControl();
- Endpoint_Write_Byte(0x00);
- Endpoint_Write_Byte(0x00);
- }
- */
- Endpoint_Write_Byte(0xff);
- Endpoint_Write_Byte(0xff);
- for (block_index=6; block_index<VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){
- DoReadFlowControl();
- Endpoint_Write_Byte(0x00);
- }
-
- }
- else if (BlockAddress == 35){ //Root Directory
- for (block_index=0;block_index<32; block_index++){
- DoReadFlowControl();
- Endpoint_Write_Byte(pgm_read_byte(((char*)&rootDir)+block_index));
- }
- for (block_index=32; block_index<VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){
- DoReadFlowControl();
- Endpoint_Write_Byte(0x00);
- }
- }
- else if (BlockAddress == 67){ //test.txt
- DoReadFlowControl();
- Endpoint_Write_Byte(file_var++);
- Endpoint_Write_Byte(0x0a);
- Endpoint_Write_Byte(0x0d);
- for (block_index=3; block_index<VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){
- DoReadFlowControl();
- Endpoint_Write_Byte(0x00);
- }
- }
- else{
- DoReadFlowControl();
- for (block_index=0; block_index<VIRTUAL_MEMORY_BLOCK_SIZE; block_index++){
- DoReadFlowControl();
- Endpoint_Write_Byte(0x00);
- }
- }
-
- BlockAddress++;
- TotalBlocks--;
- }
-
- if (!(Endpoint_IsReadWriteAllowed()))
- Endpoint_ClearIN();
- } else {
- if (Endpoint_WaitUntilReady())
- return;
-
- while(TotalBlocks){
- uint16_t block_index, blockdiv16_index;
- for(blockdiv16_index=0; blockdiv16_index<(VIRTUAL_MEMORY_BLOCK_SIZE>>4); blockdiv16_index++){
- for (block_index=0; block_index<16; block_index++){
- Endpoint_Read_Byte();
- }
- DoWriteFlowControl();
- }
- TotalBlocks--;
- }
-
- if (!(Endpoint_IsReadWriteAllowed()))
- Endpoint_ClearOUT();
- }
- /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
-
-/* if (IsDataRead == DATA_READ)
- DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
+ if (IsDataRead == DATA_READ)
+ DataManager_ReadBlocks(BlockAddress, TotalBlocks);
else
- DataflashManager_WriteBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
-*/
+ DataManager_WriteBlocks(BlockAddress, TotalBlocks);
+
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * (uint32_t)VIRTUAL_MEMORY_BLOCK_SIZE);
diff --git a/usb/makefile b/usb/makefile
index 23bee0d..afaadd0 100755
--- a/usb/makefile
+++ b/usb/makefile
@@ -148,6 +148,7 @@ include $(LUFA_PATH)/LUFA/makefile
SRC = $(TARGET).c \
Descriptors.c \
SCSI.c \
+ DataManager.c \
$(LUFA_SRC_USB) \
$(LUFA_SRC_USBCLASS)