Read performance improvements
authorMichael McMaster <michael@codesrc.com>
Fri, 20 Dec 2013 11:54:41 +0000 (21:54 +1000)
committerMichael McMaster <michael@codesrc.com>
Fri, 20 Dec 2013 11:54:41 +0000 (21:54 +1000)
- More than 2x improvement in read performance, to 930KB/sec
- Added compatibility for the Keil ARM compiler.  Provides an
  additional 1.5% performance improvement.

26 files changed:
STATUS
readme.txt
software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyfit
software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyprj
software/SCSI2SD/SCSI2SD.cydsn/bits.h
software/SCSI2SD/SCSI2SD.cydsn/blinky.c
software/SCSI2SD/SCSI2SD.cydsn/config.c
software/SCSI2SD/SCSI2SD.cydsn/config.h
software/SCSI2SD/SCSI2SD.cydsn/diagnostic.c
software/SCSI2SD/SCSI2SD.cydsn/diagnostic.h
software/SCSI2SD/SCSI2SD.cydsn/disk.c
software/SCSI2SD/SCSI2SD.cydsn/disk.h
software/SCSI2SD/SCSI2SD.cydsn/geometry.c
software/SCSI2SD/SCSI2SD.cydsn/inquiry.c
software/SCSI2SD/SCSI2SD.cydsn/inquiry.h
software/SCSI2SD/SCSI2SD.cydsn/led.h
software/SCSI2SD/SCSI2SD.cydsn/loopback.c
software/SCSI2SD/SCSI2SD.cydsn/main.c
software/SCSI2SD/SCSI2SD.cydsn/mode.c
software/SCSI2SD/SCSI2SD.cydsn/mode.h
software/SCSI2SD/SCSI2SD.cydsn/scsi.c
software/SCSI2SD/SCSI2SD.cydsn/scsi.h
software/SCSI2SD/SCSI2SD.cydsn/scsiPhy.c
software/SCSI2SD/SCSI2SD.cydsn/scsiPhy.h
software/SCSI2SD/SCSI2SD.cydsn/sd.c
software/SCSI2SD/SCSI2SD.cydsn/sd.h

diff --git a/STATUS b/STATUS
index 6e099b1..7074591 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,4 +1,2 @@
-- DMA is not used for SPI transfers
-       - Potential for large performance improvement.
 - Parity checking not implemented for the PSoC Datapath implementation
 
 - Parity checking not implemented for the PSoC Datapath implementation
 
index f2e9811..8236382 100644 (file)
@@ -43,7 +43,7 @@ Performance
 
 As currently implemented:
 
 
 As currently implemented:
 
-Sequential read: 424kb/sec Sequential write: 414kb/sec
+Sequential read: 930kb/sec Sequential write: 414kb/sec
 
 Tested with a 16GB class 10 SD card, via the commands:
 
 
 Tested with a 16GB class 10 SD card, via the commands:
 
@@ -53,9 +53,6 @@ Tested with a 16GB class 10 SD card, via the commands:
  # READ TEST
  sudo dd bs=8192 count=100 if=/dev/sdX of=/dev/null
 
  # READ TEST
  sudo dd bs=8192 count=100 if=/dev/sdX of=/dev/null
 
-I am working on updating the SD card communication to use DMA, to allow simultaneous use of the SD and SCSI interfaces. I expect the performance to reach 1Mb/sec. 
-
-
 Compatibility
 
 Tested with Linux (current), Apple Macintosh System 7.5.3 on LC-III, and LC-475
 Compatibility
 
 Tested with Linux (current), Apple Macintosh System 7.5.3 on LC-III, and LC-475
index 2ffb942..c6d5f47 100755 (executable)
Binary files a/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyfit and b/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyfit differ
index d2665e2..9bcf221 100755 (executable)
 <PropertyDeltas />\r
 </CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>\r
 <CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">\r
 <PropertyDeltas />\r
 </CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>\r
 <CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">\r
-<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="loopback.c" persistent=".\loopback.c">\r
-<Hidden v="False" />\r
-</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>\r
-<build_action v="C_FILE" />\r
-<PropertyDeltas />\r
-</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>\r
-<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">\r
 <CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="blinky.c" persistent=".\blinky.c">\r
 <Hidden v="False" />\r
 </CyGuid_31768f72-0253-412b-af77-e7dba74d1330>\r
 <CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="blinky.c" persistent=".\blinky.c">\r
 <Hidden v="False" />\r
 </CyGuid_31768f72-0253-412b-af77-e7dba74d1330>\r
 <PropertyDeltas />\r
 </CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>\r
 <CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">\r
 <PropertyDeltas />\r
 </CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>\r
 <CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">\r
-<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="loopback.h" persistent=".\loopback.h">\r
-<Hidden v="False" />\r
-</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>\r
-<build_action v="NONE" />\r
-<PropertyDeltas />\r
-</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>\r
-<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFile" version="3" xml_contents_version="1">\r
 <CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="bits.h" persistent=".\bits.h">\r
 <Hidden v="False" />\r
 </CyGuid_31768f72-0253-412b-af77-e7dba74d1330>\r
 <CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItem" version="2" name="bits.h" persistent=".\bits.h">\r
 <Hidden v="False" />\r
 </CyGuid_31768f72-0253-412b-af77-e7dba74d1330>\r
 <name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@Library Generation@Command Line@Command Line" v="" />\r
 </name>\r
 </platform>\r
 <name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@Library Generation@Command Line@Command Line" v="" />\r
 </name>\r
 </platform>\r
+<platform>\r
+<name v="b98f980c-3bd1-4fc7-a887-c56a20a46fdd">\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@General@Warnings as Errors" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@General@Warning Level" v="High" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@General@Pedantic Compilation" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@General@Preprocessor Definitions" v="DEBUG" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@General@Create Listing File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@Optimization@Optimization Level" v="None" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@Optimization@Remove Unused Functions" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@Code Generation@Struct Return Method" v="System Default" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@Code Generation@Verbose Asm" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Assembly@General@Join Data and Text Sections" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Assembly@General@Create Listing File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Linker@General@Additional Link Files" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Linker@General@Use Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Linker@General@Use Nano Lib" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Linker@General@Remove Unused Functions" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM0@Library Generation@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@General@Warnings as Errors" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@General@Warning Level" v="High" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@General@Pedantic Compilation" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@General@Preprocessor Definitions" v="NDEBUG" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@General@Create Listing File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@Optimization@Optimization Level" v="Size" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@Optimization@Remove Unused Functions" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@Code Generation@Struct Return Method" v="System Default" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@Code Generation@Verbose Asm" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Assembly@General@Join Data and Text Sections" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Assembly@General@Create Listing File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Linker@General@Additional Link Files" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Linker@General@Use Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Linker@General@Use Nano Lib" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Linker@General@Remove Unused Functions" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM0@Library Generation@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Warnings as Errors" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Warning Level" v="High" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Pedantic Compilation" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Preprocessor Definitions" v="DEBUG" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@General@Create Listing File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@Optimization@Optimization Level" v="None" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@Optimization@Remove Unused Functions" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@Code Generation@Struct Return Method" v="System Default" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@Code Generation@Verbose Asm" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Assembly@General@Join Data and Text Sections" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Assembly@General@Create Listing File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Linker@General@Additional Link Files" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Linker@General@Use Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Linker@General@Use Nano Lib" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Linker@General@Remove Unused Functions" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Debug@CortexM3@Library Generation@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Warnings as Errors" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Warning Level" v="High" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Pedantic Compilation" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Preprocessor Definitions" v="NDEBUG" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@General@Create Listing File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@Optimization@Optimization Level" v="Size" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@Optimization@Remove Unused Functions" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@Code Generation@Struct Return Method" v="System Default" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@Code Generation@Verbose Asm" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Assembly@General@Join Data and Text Sections" v="False" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Assembly@General@Create Listing File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Linker@General@Additional Link Files" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Linker@General@Use Debugging Information" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Linker@General@Use Nano Lib" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Linker@General@Remove Unused Functions" v="True" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="b98f980c-3bd1-4fc7-a887-c56a20a46fdd@Release@CortexM3@Library Generation@Command Line@Command Line" v="" />\r
+</name>\r
+</platform>\r
+<platform>\r
+<name v="5bca58cd-5542-421c-b08d-9513dbb687fd">\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@C/C++@General@Strict Compilation" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@C/C++@General@Preprocessor Definitions" v="DEBUG" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@C/C++@General@Generate List Files" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@C/C++@Optimization@Optimization Level" v="None" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@C/C++@Optimization@Split Sections" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Assembly@General@Generate List Files" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Linker@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM0@Library Generation@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@C/C++@General@Strict Compilation" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@C/C++@General@Preprocessor Definitions" v="NDEBUG" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@C/C++@General@Generate List Files" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@C/C++@Optimization@Optimization Level" v="Size" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@C/C++@Optimization@Split Sections" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Assembly@General@Generate List Files" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Linker@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM0@Library Generation@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@C/C++@General@Strict Compilation" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@C/C++@General@Preprocessor Definitions" v="DEBUG" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@C/C++@General@Generate List Files" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@C/C++@Optimization@Optimization Level" v="None" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@C/C++@Optimization@Split Sections" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Assembly@General@Generate List Files" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Linker@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Debug@CortexM3@Library Generation@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@C/C++@General@Strict Compilation" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@C/C++@General@Preprocessor Definitions" v="NDEBUG" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@C/C++@General@Generate List Files" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@C/C++@Optimization@Optimization Level" v="Size" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@C/C++@Optimization@Split Sections" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Assembly@General@Generate List Files" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Linker@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="5bca58cd-5542-421c-b08d-9513dbb687fd@Release@CortexM3@Library Generation@Command Line@Command Line" v="" />\r
+</name>\r
+</platform>\r
+<platform>\r
+<name v="fdb8e1ae-f83a-46cf-9446-1d703716f38a">\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@C/C++@General@Strict Compilation" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@C/C++@General@Preprocessor Definitions" v="DEBUG" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@C/C++@General@Generate List Files" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@C/C++@Optimization@Optimization Level" v="None" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@C/C++@Optimization@Split Sections" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Assembly@General@Generate List Files" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Linker@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM0@Library Generation@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@C/C++@General@Strict Compilation" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@C/C++@General@Preprocessor Definitions" v="NDEBUG" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@C/C++@General@Generate List Files" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@C/C++@Optimization@Optimization Level" v="Size" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@C/C++@Optimization@Split Sections" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Assembly@General@Generate List Files" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Linker@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM0@Library Generation@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@C/C++@General@Strict Compilation" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@C/C++@General@Preprocessor Definitions" v="DEBUG" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@C/C++@General@Generate List Files" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@C/C++@Optimization@Optimization Level" v="None" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@C/C++@Optimization@Split Sections" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Assembly@General@Generate List Files" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Linker@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Debug@CortexM3@Library Generation@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@General@Output Directory" v="${ProjectDir}\${ProcessorType}\${Platform}\${Config}" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@C/C++@General@Additional Include Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@C/C++@General@Strict Compilation" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@C/C++@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@C/C++@General@Preprocessor Definitions" v="NDEBUG" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@C/C++@General@Default Char Unsigned" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@C/C++@General@Generate List Files" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@C/C++@Optimization@Optimization Level" v="Size" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@C/C++@Optimization@Inline Functions" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@C/C++@Optimization@Split Sections" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@C/C++@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Assembly@General@Additional Include Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Assembly@General@Suppress Warnings" v="False" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Assembly@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Assembly@General@Generate List Files" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Assembly@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Linker@General@Additional Libraries" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Linker@General@Additional Library Directories" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Linker@General@Generate Debugging Information" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Linker@General@Generate Map File" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Linker@General@Use Default Libs" v="True" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Linker@General@Custom Linker Script" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Linker@Command Line@Command Line" v="" />\r
+<name_val_pair name="fdb8e1ae-f83a-46cf-9446-1d703716f38a@Release@CortexM3@Library Generation@Command Line@Command Line" v="" />\r
+</name>\r
+</platform>\r
 </platforms>\r
 <project_current_platform v="c9323d49-d323-40b8-9b59-cc008d68a989" />\r
 <project_current_processor v="CortexM3" />\r
 </platforms>\r
 <project_current_platform v="c9323d49-d323-40b8-9b59-cc008d68a989" />\r
 <project_current_processor v="CortexM3" />\r
 <last_selected_tab v="Cypress" />\r
 <component_dependent_projects_generation v="(69eeda1b-ded5-4da3-a74d-3a98f2d5d4ab , 2.1PR) | (b1a3f413-e018-46a5-a51c-20818b2f118e , 3.0) | (cd381074-8dad-4f43-bb88-7719b3e16126 , 2.1) | (29420278-6fcc-46a7-a651-999ec5c253d2 , 2.1) | (e95576e7-780d-474a-b944-018db0492cc9 , 2.1)" />\r
 <WriteAppVersionLastSavedWith v="3.0.0.1539" />\r
 <last_selected_tab v="Cypress" />\r
 <component_dependent_projects_generation v="(69eeda1b-ded5-4da3-a74d-3a98f2d5d4ab , 2.1PR) | (b1a3f413-e018-46a5-a51c-20818b2f118e , 3.0) | (cd381074-8dad-4f43-bb88-7719b3e16126 , 2.1) | (29420278-6fcc-46a7-a651-999ec5c253d2 , 2.1) | (e95576e7-780d-474a-b944-018db0492cc9 , 2.1)" />\r
 <WriteAppVersionLastSavedWith v="3.0.0.1539" />\r
-<WriteAppMarketingVersionLastSavedWith v=" 3.0" />\r
+<WriteAppMarketingVersionLastSavedWith v=" 3.0 Component Pack 7" />\r
 <project_id v="6e1f5cbb-a0ca-4f55-a1fa-7b20c5be3a3e" />\r
 <custom_data>\r
 <CyGuid_7a7929f8-5e3b-4f86-a093-2d4ee6513111 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtProjectCustomData" version="1">\r
 <project_id v="6e1f5cbb-a0ca-4f55-a1fa-7b20c5be3a3e" />\r
 <custom_data>\r
 <CyGuid_7a7929f8-5e3b-4f86-a093-2d4ee6513111 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtProjectCustomData" version="1">\r
index 7369ce6..45adfcb 100755 (executable)
@@ -24,4 +24,4 @@ extern const uint8 Lookup_OddParity[256];
 \r
 uint8 countBits(uint8 value);\r
 \r
 \r
 uint8 countBits(uint8 value);\r
 \r
-#endif
\ No newline at end of file
+#endif\r
index 676ec5d..4d9d7ae 100755 (executable)
@@ -28,4 +28,4 @@ void scsi2sd_test_blink(void)
                LED1_Write(1);\r
                CyDelay(250); // ms\r
        }\r
                LED1_Write(1);\r
                CyDelay(250); // ms\r
        }\r
-}
\ No newline at end of file
+}\r
index fc1809d..674d752 100755 (executable)
@@ -92,6 +92,9 @@ static void saveConfig()
 \r
 void configInit()\r
 {\r
 \r
 void configInit()\r
 {\r
+       int shadowRows, shadowBytes;\r
+       uint8* eeprom = (uint8*)CYDEV_EE_BASE;\r
+       \r
        // We could map cfgPtr directly into the EEPROM memory,\r
        // but that would waste power. Copy it to RAM then turn off\r
        // the EEPROM.\r
        // We could map cfgPtr directly into the EEPROM memory,\r
        // but that would waste power. Copy it to RAM then turn off\r
        // the EEPROM.\r
@@ -99,9 +102,9 @@ void configInit()
        CyDelayUs(5); // 5us to start per datasheet.\r
 \r
        // Check magic\r
        CyDelayUs(5); // 5us to start per datasheet.\r
 \r
        // Check magic\r
-       int shadowRows = (sizeof(shadow) / CYDEV_EEPROM_ROW_SIZE) + 1;\r
-       int shadowBytes = CYDEV_EEPROM_ROW_SIZE * shadowRows;\r
-       uint8* eeprom = (uint8*)CYDEV_EE_BASE;\r
+       shadowRows = (sizeof(shadow) / CYDEV_EEPROM_ROW_SIZE) + 1;\r
+       shadowBytes = CYDEV_EEPROM_ROW_SIZE * shadowRows;\r
+\r
        if (memcmp(eeprom + shadowBytes, magic, sizeof(magic)))\r
        {\r
                saveConfig();\r
        if (memcmp(eeprom + shadowBytes, magic, sizeof(magic)))\r
        {\r
                saveConfig();\r
@@ -143,9 +146,12 @@ void configPoll()
 \r
        if(USBFS_GetEPState(USB_EP_OUT) == USBFS_OUT_BUFFER_FULL)\r
        {\r
 \r
        if(USBFS_GetEPState(USB_EP_OUT) == USBFS_OUT_BUFFER_FULL)\r
        {\r
-               ledOn();                \r
+               int byteCount;\r
+               \r
+               ledOn();\r
+               \r
                // The host sent us some data!\r
                // The host sent us some data!\r
-               int byteCount = USBFS_GetEPCount(USB_EP_OUT);\r
+                byteCount = USBFS_GetEPCount(USB_EP_OUT);\r
 \r
                // Assume that byteCount <= sizeof(shadow).\r
                // shadow should be padded out to 64bytes, which is the largest\r
 \r
                // Assume that byteCount <= sizeof(shadow).\r
                // shadow should be padded out to 64bytes, which is the largest\r
index 4cb26ef..6b048bd 100755 (executable)
@@ -36,7 +36,7 @@ typedef struct
 \r
 extern Config* config;\r
 \r
 \r
 extern Config* config;\r
 \r
-void configInit();\r
-void configPoll();\r
+void configInit(void);\r
+void configPoll(void);\r
 \r
 #endif\r
 \r
 #endif\r
index 3f27b83..f6899cd 100755 (executable)
@@ -122,11 +122,13 @@ void scsiReceiveDiagnostic()
                scsiDev.dataLen = allocLength;\r
        }\r
 \r
                scsiDev.dataLen = allocLength;\r
        }\r
 \r
-       uint8 lun = scsiDev.cdb[1] >> 5;\r
-       // Set the first byte to indicate LUN presence.\r
-       if (lun) // We only support lun 0\r
        {\r
        {\r
-               scsiDev.data[0] = 0x7F;\r
+               uint8 lun = scsiDev.cdb[1] >> 5;\r
+               // Set the first byte to indicate LUN presence.\r
+               if (lun) // We only support lun 0\r
+               {\r
+                       scsiDev.data[0] = 0x7F;\r
+               }\r
        }\r
 }\r
 \r
        }\r
 }\r
 \r
index cec3f42..e3f09be 100755 (executable)
@@ -17,7 +17,7 @@
 #ifndef DIAGNOSTIC_H
 #define DIAGNOSTIC_H
 
 #ifndef DIAGNOSTIC_H
 #define DIAGNOSTIC_H
 
-void scsiSendDiagnostic();
-void scsiReceiveDiagnostic();
+void scsiSendDiagnostic(void);
+void scsiReceiveDiagnostic(void);
 
 
-#endif
\ No newline at end of file
+#endif
index b5b3fd8..427112c 100755 (executable)
@@ -33,7 +33,7 @@ static int doSdInit()
        if (result)\r
        {\r
                blockDev.state = blockDev.state | DISK_INITIALISED;\r
        if (result)\r
        {\r
                blockDev.state = blockDev.state | DISK_INITIALISED;\r
-               \r
+\r
                // artificially limit this value according to EEPROM config.\r
                blockDev.capacity =\r
                        (config->maxBlocks && (sdDev.capacity > config->maxBlocks))\r
                // artificially limit this value according to EEPROM config.\r
                blockDev.capacity =\r
                        (config->maxBlocks && (sdDev.capacity > config->maxBlocks))\r
@@ -420,10 +420,10 @@ void scsiDiskInit()
 \r
        if (SD_CD_Read() == 1)\r
        {\r
 \r
        if (SD_CD_Read() == 1)\r
        {\r
+               int retry;\r
                blockDev.state = blockDev.state | DISK_PRESENT;\r
 \r
                // Wait up to 5 seconds for the SD card to wake up.\r
                blockDev.state = blockDev.state | DISK_PRESENT;\r
 \r
                // Wait up to 5 seconds for the SD card to wake up.\r
-               int retry;\r
                for (retry = 0; retry < 5; ++retry)\r
                {\r
                        if (doSdInit())\r
                for (retry = 0; retry < 5; ++retry)\r
                {\r
                        if (doSdInit())\r
index 5d2d04d..2133279 100755 (executable)
@@ -51,9 +51,9 @@ typedef struct
 extern BlockDevice blockDev;
 extern Transfer transfer;
 
 extern BlockDevice blockDev;
 extern Transfer transfer;
 
-void scsiDiskInit();
-void scsiDiskReset();
-void scsiDiskPoll();
-int scsiDiskCommand();
+void scsiDiskInit(void);
+void scsiDiskReset(void);
+void scsiDiskPoll(void);
+int scsiDiskCommand(void);
 
 #endif
 
 #endif
index 5665ae5..f42152b 100755 (executable)
@@ -91,7 +91,7 @@ uint64 scsiByteAddress(int format, const uint8* addr)
        } break;\r
 \r
        default:\r
        } break;\r
 \r
        default:\r
-               result = -1;\r
+               result = (uint64) -1;\r
        }\r
 \r
        return result;\r
        }\r
 \r
        return result;\r
@@ -123,10 +123,11 @@ void scsiSaveByteAddress(int format, uint64 byteAddr, uint8* buf)
                uint32 cyl;\r
                uint8 head;\r
                uint32 sector;\r
                uint32 cyl;\r
                uint8 head;\r
                uint32 sector;\r
+               uint32 bytes;\r
 \r
                LBA2CHS(lba, &cyl, &head, &sector);\r
 \r
 \r
                LBA2CHS(lba, &cyl, &head, &sector);\r
 \r
-               uint32 bytes = sector * SCSI_SECTOR_SIZE + byteOffset;\r
+               bytes = sector * SCSI_SECTOR_SIZE + byteOffset;\r
 \r
                buf[0] = cyl >> 16;\r
                buf[1] = cyl >> 8;\r
 \r
                buf[0] = cyl >> 16;\r
                buf[1] = cyl >> 8;\r
index bd7f7cd..9cc0f23 100755 (executable)
@@ -98,8 +98,9 @@ void scsiInquiry()
                }\r
                else\r
                {\r
                }\r
                else\r
                {\r
+                       uint8* out;\r
                        memcpy(scsiDev.data, StandardResponse, sizeof(StandardResponse));\r
                        memcpy(scsiDev.data, StandardResponse, sizeof(StandardResponse));\r
-                       uint8* out = scsiDev.data + sizeof(StandardResponse);\r
+                       out = scsiDev.data + sizeof(StandardResponse);\r
                        memcpy(out, config->vendor, sizeof(config->vendor));\r
                        out += sizeof(config->vendor);\r
                        memcpy(out, config->prodId, sizeof(config->prodId));\r
                        memcpy(out, config->vendor, sizeof(config->vendor));\r
                        out += sizeof(config->vendor);\r
                        memcpy(out, config->prodId, sizeof(config->prodId));\r
index d068796..c707b27 100755 (executable)
@@ -17,6 +17,6 @@
 #ifndef INQUIRY_H
 #define INQUIRY_H
 
 #ifndef INQUIRY_H
 #define INQUIRY_H
 
-void scsiInquiry();
+void scsiInquiry(void);
 
 #endif
 
 #endif
index 48e1b83..e021891 100755 (executable)
@@ -22,4 +22,4 @@
 #define ledOn() LED1_Write(0)
 #define ledOff() LED1_Write(1)
 
 #define ledOn() LED1_Write(0)
 #define ledOff() LED1_Write(1)
 
-#endif
\ No newline at end of file
+#endif
index ecddd64..b64405a 100755 (executable)
@@ -72,11 +72,12 @@ static int test_data_10MHz(void)
        int i;\r
        for (i = 0; i < 100; ++i)\r
        {\r
        int i;\r
        for (i = 0; i < 100; ++i)\r
        {\r
+               uint8 dbx;\r
                // We write using Active High\r
                SCSI_Out_DBx_Write(0xFF);\r
                CyDelayCycles(3);\r
                // And expect an Active Low response.\r
                // We write using Active High\r
                SCSI_Out_DBx_Write(0xFF);\r
                CyDelayCycles(3);\r
                // And expect an Active Low response.\r
-               uint8 dbx = SCSI_In_DBx_Read();\r
+               dbx = SCSI_In_DBx_Read();\r
                result = result && (dbx == 0);\r
                \r
                // We write using Active High\r
                result = result && (dbx == 0);\r
                \r
                // We write using Active High\r
@@ -145,4 +146,4 @@ void scsi2sd_test_loopback(void)
        {\r
                test_success();\r
        }\r
        {\r
                test_success();\r
        }\r
-}
\ No newline at end of file
+}\r
index bb0deb6..4ae3d96 100755 (executable)
@@ -17,7 +17,6 @@
 \r
 #include "device.h"\r
 #include "blinky.h"\r
 \r
 #include "device.h"\r
 #include "blinky.h"\r
-#include "loopback.h"\r
 #include "scsi.h"\r
 #include "scsiPhy.h"\r
 #include "config.h"\r
 #include "scsi.h"\r
 #include "scsiPhy.h"\r
 #include "config.h"\r
@@ -38,10 +37,6 @@ int main()
        // Set interrupt handlers.\r
        scsiPhyInit();\r
        \r
        // Set interrupt handlers.\r
        scsiPhyInit();\r
        \r
-       // Loopback test requires the interrupt handers.\r
-       // Will not return if uncommented.\r
-       // scsi2sd_test_loopback();\r
-       \r
        configInit();\r
        \r
        scsiInit();\r
        configInit();\r
        \r
        scsiInit();\r
index cb6d7f4..99e89b1 100755 (executable)
@@ -133,6 +133,8 @@ static void doModeSense(
        }\r
        else\r
        {\r
        }\r
        else\r
        {\r
+               int pageFound = 1;\r
+               \r
                ////////////// Mode Parameter Header\r
                ////////////////////////////////////\r
 \r
                ////////////// Mode Parameter Header\r
                ////////////////////////////////////\r
 \r
@@ -195,8 +197,6 @@ static void doModeSense(
                        scsiDev.data[idx++] = SCSI_BLOCK_SIZE & 0xFF;\r
                }\r
 \r
                        scsiDev.data[idx++] = SCSI_BLOCK_SIZE & 0xFF;\r
                }\r
 \r
-               int pageFound = 1;\r
-\r
                switch (pageCode)\r
                {\r
                case 0x3F:\r
                switch (pageCode)\r
                {\r
                case 0x3F:\r
index c097807..819b1f5 100755 (executable)
@@ -17,6 +17,6 @@
 #ifndef MODE_H
 #define MODE_H
 
 #ifndef MODE_H
 #define MODE_H
 
-int scsiModeCommand();
+int scsiModeCommand(void);
 
 #endif
 
 #endif
index 8b69da0..245bf1d 100755 (executable)
 // Global SCSI device state.\r
 ScsiDevice scsiDev;\r
 \r
 // Global SCSI device state.\r
 ScsiDevice scsiDev;\r
 \r
-static void enter_SelectionPhase();\r
-static void process_SelectionPhase();\r
-static void enter_BusFree();\r
+static void enter_SelectionPhase(void);\r
+static void process_SelectionPhase(void);\r
+static void enter_BusFree(void);\r
 static void enter_MessageIn(uint8 message);\r
 static void enter_MessageIn(uint8 message);\r
-static void process_MessageIn();\r
+static void process_MessageIn(void);\r
 static void enter_Status(uint8 status);\r
 static void enter_Status(uint8 status);\r
-static void process_Status();\r
+static void process_Status(void);\r
 static void enter_DataIn(int len);\r
 static void enter_DataIn(int len);\r
-static void process_DataIn();\r
-static void process_DataOut();\r
-static void process_Command();\r
+static void process_DataIn(void);\r
+static void process_DataOut(void);\r
+static void process_Command(void);\r
 \r
 \r
-static void doReserveRelease();\r
+static void doReserveRelease(void);\r
 \r
 static void enter_BusFree()\r
 {\r
 \r
 static void enter_BusFree()\r
 {\r
@@ -109,17 +109,20 @@ static void enter_DataIn(int len)
 \r
 static void process_DataIn()\r
 {\r
 \r
 static void process_DataIn()\r
 {\r
+       uint32 len;\r
+       \r
        if (scsiDev.dataLen > sizeof(scsiDev.data))\r
        {\r
                scsiDev.dataLen = sizeof(scsiDev.data);\r
        }\r
 \r
        if (scsiDev.dataLen > sizeof(scsiDev.data))\r
        {\r
                scsiDev.dataLen = sizeof(scsiDev.data);\r
        }\r
 \r
-       scsiEnterPhase(DATA_IN);\r
-\r
-       uint32 len = scsiDev.dataLen - scsiDev.dataPtr;\r
-       scsiWrite(scsiDev.data + scsiDev.dataPtr, len);\r
-       scsiDev.dataPtr += len;\r
-\r
+       len = scsiDev.dataLen - scsiDev.dataPtr;\r
+       if (len > 0)\r
+       {\r
+               scsiEnterPhase(DATA_IN);\r
+               scsiWrite(scsiDev.data + scsiDev.dataPtr, len);\r
+               scsiDev.dataPtr += len;\r
+       }\r
 \r
        if ((scsiDev.dataPtr >= scsiDev.dataLen) &&\r
                (transfer.currentBlock == transfer.blocks))\r
 \r
        if ((scsiDev.dataPtr >= scsiDev.dataLen) &&\r
                (transfer.currentBlock == transfer.blocks))\r
@@ -130,24 +133,29 @@ static void process_DataIn()
 \r
 static void process_DataOut()\r
 {\r
 \r
 static void process_DataOut()\r
 {\r
+       uint32 len;\r
+       \r
        if (scsiDev.dataLen > sizeof(scsiDev.data))\r
        {\r
                scsiDev.dataLen = sizeof(scsiDev.data);\r
        }\r
 \r
        if (scsiDev.dataLen > sizeof(scsiDev.data))\r
        {\r
                scsiDev.dataLen = sizeof(scsiDev.data);\r
        }\r
 \r
-       scsiEnterPhase(DATA_OUT);\r
-\r
        scsiDev.parityError = 0;\r
        scsiDev.parityError = 0;\r
-       uint32 len = scsiDev.dataLen - scsiDev.dataPtr;\r
-       scsiRead(scsiDev.data + scsiDev.dataPtr, len);\r
-       scsiDev.dataPtr += len;\r
-\r
-       // TODO re-implement parity checking\r
-       if (0 && scsiDev.parityError && config->enableParity)\r
+       len = scsiDev.dataLen - scsiDev.dataPtr;\r
+       if (len > 0)\r
        {\r
        {\r
-               scsiDev.sense.code = ABORTED_COMMAND;\r
-               scsiDev.sense.asc = SCSI_PARITY_ERROR;\r
-               enter_Status(CHECK_CONDITION);\r
+               scsiEnterPhase(DATA_OUT);\r
+\r
+               scsiRead(scsiDev.data + scsiDev.dataPtr, len);\r
+               scsiDev.dataPtr += len;\r
+\r
+               // TODO re-implement parity checking\r
+               if (0 && scsiDev.parityError && config->enableParity)\r
+               {\r
+                       scsiDev.sense.code = ABORTED_COMMAND;\r
+                       scsiDev.sense.asc = SCSI_PARITY_ERROR;\r
+                       enter_Status(CHECK_CONDITION);\r
+               }\r
        }\r
 \r
        if ((scsiDev.dataPtr >= scsiDev.dataLen) &&\r
        }\r
 \r
        if ((scsiDev.dataPtr >= scsiDev.dataLen) &&\r
@@ -160,18 +168,23 @@ static void process_DataOut()
 static const uint8 CmdGroupBytes[8] = {6, 10, 10, 6, 6, 12, 6, 6};\r
 static void process_Command()\r
 {\r
 static const uint8 CmdGroupBytes[8] = {6, 10, 10, 6, 6, 12, 6, 6};\r
 static void process_Command()\r
 {\r
+       int group;\r
+       int cmdSize;\r
+       uint8 command;\r
+       uint8 lun;\r
+       \r
        scsiEnterPhase(COMMAND);\r
        scsiDev.parityError = 0;\r
 \r
        memset(scsiDev.cdb, 0, sizeof(scsiDev.cdb));\r
        scsiDev.cdb[0] = scsiReadByte();\r
 \r
        scsiEnterPhase(COMMAND);\r
        scsiDev.parityError = 0;\r
 \r
        memset(scsiDev.cdb, 0, sizeof(scsiDev.cdb));\r
        scsiDev.cdb[0] = scsiReadByte();\r
 \r
-       int group = scsiDev.cdb[0] >> 5;\r
-       int cmdSize = CmdGroupBytes[group];\r
+       group = scsiDev.cdb[0] >> 5;\r
+       cmdSize = CmdGroupBytes[group];\r
        scsiRead(scsiDev.cdb + 1, cmdSize - 1);\r
 \r
        scsiRead(scsiDev.cdb + 1, cmdSize - 1);\r
 \r
-       uint8 command = scsiDev.cdb[0];\r
-       uint8 lun = scsiDev.cdb[1] >> 5;\r
+       command = scsiDev.cdb[0];\r
+       lun = scsiDev.cdb[1] >> 5;\r
 \r
        if (scsiDev.parityError)\r
        {\r
 \r
        if (scsiDev.parityError)\r
        {\r
@@ -395,15 +408,17 @@ static void process_SelectionPhase()
 \r
                // Save our initiator now that we're no longer in a time-critical\r
                // section.\r
 \r
                // Save our initiator now that we're no longer in a time-critical\r
                // section.\r
-               uint8 initiatorMask = mask ^ scsiDev.scsiIdMask;\r
-               scsiDev.initiatorId = 0;\r
-               int i;\r
-               for (i = 0; i < 8; ++i)\r
                {\r
                {\r
-                       if (initiatorMask & (1 << i))\r
+                       int i;\r
+                       uint8 initiatorMask = mask ^ scsiDev.scsiIdMask;\r
+                       scsiDev.initiatorId = 0;\r
+                       for (i = 0; i < 8; ++i)\r
                        {\r
                        {\r
-                               scsiDev.initiatorId = i;\r
-                               break;\r
+                               if (initiatorMask & (1 << i))\r
+                               {\r
+                                       scsiDev.initiatorId = i;\r
+                                       break;\r
+                               }\r
                        }\r
                }\r
 \r
                        }\r
                }\r
 \r
@@ -515,10 +530,11 @@ static void process_MessageOut()
        }\r
        else if (scsiDev.msgOut == 0x01)\r
        {\r
        }\r
        else if (scsiDev.msgOut == 0x01)\r
        {\r
+               int i;\r
+               \r
                // Extended message.\r
                int msgLen = scsiReadByte();\r
                if (msgLen == 0) msgLen = 256;\r
                // Extended message.\r
                int msgLen = scsiReadByte();\r
                if (msgLen == 0) msgLen = 256;\r
-               int i;\r
                for (i = 0; i < msgLen && !scsiDev.resetFlag; ++i)\r
                {\r
                        // Discard bytes.\r
                for (i = 0; i < msgLen && !scsiDev.resetFlag; ++i)\r
                {\r
                        // Discard bytes.\r
index 91c0fa6..68ec8bd 100755 (executable)
@@ -89,8 +89,8 @@ typedef struct
        // Only let the reserved initiator talk to us.
        // A 3rd party may be sending the RESERVE/RELEASE commands
        int initiatorId; // 0 -> 7. Set during the selection phase.
        // Only let the reserved initiator talk to us.
        // A 3rd party may be sending the RESERVE/RELEASE commands
        int initiatorId; // 0 -> 7. Set during the selection phase.
-       int reservedId;; // 0 -> 7 if reserved. -1 if not reserved.
-       int reserverId;; // 0 -> 7 if reserved. -1 if not reserved.
+       int reservedId; // 0 -> 7 if reserved. -1 if not reserved.
+       int reserverId; // 0 -> 7 if reserved. -1 if not reserved.
 
        // SCSI_STATUS value.
        // Change to SCSI_STATUS_CHECK_CONDITION when setting a SENSE value
 
        // SCSI_STATUS value.
        // Change to SCSI_STATUS_CHECK_CONDITION when setting a SENSE value
@@ -106,7 +106,7 @@ typedef struct
 
 extern ScsiDevice scsiDev;
 
 
 extern ScsiDevice scsiDev;
 
-void scsiInit();
+void scsiInit(void);
 void scsiPoll(void);
 
 
 void scsiPoll(void);
 
 
index 4819615..d6d1a91 100755 (executable)
@@ -52,8 +52,7 @@ uint8 scsiReadByte(void)
        while (!(CY_GET_REG8(scsiTarget_StatusReg__STATUS_REG) & 1)) {}\r
        CY_SET_REG8(scsiTarget_datapath__F0_REG, 0);\r
        while (!(CY_GET_REG8(scsiTarget_StatusReg__STATUS_REG) & 2)) {}\r
        while (!(CY_GET_REG8(scsiTarget_StatusReg__STATUS_REG) & 1)) {}\r
        CY_SET_REG8(scsiTarget_datapath__F0_REG, 0);\r
        while (!(CY_GET_REG8(scsiTarget_StatusReg__STATUS_REG) & 2)) {}\r
-       uint8 value = CY_GET_REG8(scsiTarget_datapath__F1_REG);\r
-       return value;\r
+       return CY_GET_REG8(scsiTarget_datapath__F1_REG);\r
 }\r
 \r
 void scsiRead(uint8* data, uint32 count)\r
 }\r
 \r
 void scsiRead(uint8* data, uint32 count)\r
index 8a37e67..658c1df 100755 (executable)
 // Contains the odd-parity flag for a given 8-bit value.
 extern const uint8 Lookup_OddParity[256];
 
 // Contains the odd-parity flag for a given 8-bit value.
 extern const uint8 Lookup_OddParity[256];
 
-void scsiPhyInit();
+void scsiPhyInit(void);
 uint8 scsiReadByte(void);
 void scsiRead(uint8* data, uint32 count);
 void scsiWriteByte(uint8 value);
 void scsiWrite(uint8* data, uint32 count);
 
 uint8 scsiReadByte(void);
 void scsiRead(uint8* data, uint32 count);
 void scsiWriteByte(uint8 value);
 void scsiWrite(uint8* data, uint32 count);
 
-uint8 scsiReadDBxPins();
+uint8 scsiReadDBxPins(void);
 
 void scsiEnterPhase(int phase);
 
 
 void scsiEnterPhase(int phase);
 
index 2d31294..21a8ecc 100755 (executable)
@@ -22,6 +22,8 @@
 #include "sd.h"\r
 #include "led.h"\r
 \r
 #include "sd.h"\r
 #include "led.h"\r
 \r
+#include "scsiPhy.h"\r
+\r
 #include <string.h>\r
 \r
 // Global\r
 #include <string.h>\r
 \r
 // Global\r
@@ -126,12 +128,13 @@ static void sdClearStatus()
 \r
 void sdPrepareRead()\r
 {\r
 \r
 void sdPrepareRead()\r
 {\r
+       uint8 v;\r
        uint32 len = (transfer.lba + transfer.currentBlock);\r
        if (!sdDev.ccs)\r
        {\r
                len = len * SCSI_BLOCK_SIZE;\r
        }\r
        uint32 len = (transfer.lba + transfer.currentBlock);\r
        if (!sdDev.ccs)\r
        {\r
                len = len * SCSI_BLOCK_SIZE;\r
        }\r
-       uint8 v = sdCommandAndResponse(SD_READ_MULTIPLE_BLOCK, len);\r
+       v = sdCommandAndResponse(SD_READ_MULTIPLE_BLOCK, len);\r
        if (v)\r
        {\r
                scsiDiskReset();\r
        if (v)\r
        {\r
                scsiDiskReset();\r
@@ -146,13 +149,16 @@ void sdPrepareRead()
 \r
 void sdReadSector()\r
 {\r
 \r
 void sdReadSector()\r
 {\r
+       int prep, i, guard;\r
+       \r
        // Wait for a start-block token.\r
        // Wait for a start-block token.\r
-       // Don't wait more than 200ms.\r
-       int maxWait = 200000;\r
+       // Don't wait more than 100ms, which is the timeout recommended\r
+       // in the standard.\r
+       //100ms @ 64Hz = 6400000\r
+       int maxWait = 6400000;\r
        uint8 token = sdSpiByte(0xFF);\r
        while (token != 0xFE && (maxWait-- > 0))\r
        {\r
        uint8 token = sdSpiByte(0xFF);\r
        while (token != 0xFE && (maxWait-- > 0))\r
        {\r
-               CyDelayUs(1);\r
                token = sdSpiByte(0xFF);\r
        }\r
        if (token != 0xFE)\r
                token = sdSpiByte(0xFF);\r
        }\r
        if (token != 0xFE)\r
@@ -168,28 +174,65 @@ void sdReadSector()
                return;\r
        }\r
 \r
                return;\r
        }\r
 \r
-       int prep = 0;\r
-       int i = 0;\r
+       // Don't do a bus settle delay if we're already in the correct phase.\r
+       if (transfer.currentBlock == 0)\r
+       {\r
+               scsiEnterPhase(DATA_IN);\r
+       }\r
+       \r
+       // Quickly seed the FIFO\r
+       prep = 4;\r
+       CY_SET_REG8(SDCard_TXDATA_PTR, 0xFF); // Put a byte in the FIFO\r
+       CY_SET_REG8(SDCard_TXDATA_PTR, 0xFF); // Put a byte in the FIFO\r
+       CY_SET_REG8(SDCard_TXDATA_PTR, 0xFF); // Put a byte in the FIFO\r
+       CY_SET_REG8(SDCard_TXDATA_PTR, 0xFF); // Put a byte in the FIFO\r
+\r
+       i = 0;\r
+       guard = 0;\r
+\r
+       // This loop is critically important for performance.\r
+       // We stream data straight from the SDCard fifos into the SCSI component\r
+       // FIFO's. If the loop isn't fast enough, the transmit FIFO's will empty,\r
+       // and performance will suffer. Every clock cycle counts.       \r
        while (i < SCSI_BLOCK_SIZE)\r
        {\r
        while (i < SCSI_BLOCK_SIZE)\r
        {\r
-               if (prep < SCSI_BLOCK_SIZE && (SDCard_ReadTxStatus() & SDCard_STS_TX_FIFO_NOT_FULL))\r
+               uint8_t sdRxStatus = CY_GET_REG8(SDCard_RX_STATUS_PTR);\r
+               uint8_t scsiStatus = CY_GET_REG8(scsiTarget_StatusReg__STATUS_REG);\r
+\r
+               // Read from the SPIM fifo if there is room to stream the byte to the\r
+               // SCSI fifos\r
+               if((sdRxStatus & SDCard_STS_RX_FIFO_NOT_EMPTY) &&\r
+                       (scsiStatus & 1) // SCSI TX FIFO NOT FULL\r
+                       )\r
                {\r
                {\r
-                       SDCard_WriteTxData(0xFF);\r
-                       prep++;\r
+                       uint8_t val = CY_GET_REG8(SDCard_RXDATA_PTR);\r
+                       CY_SET_REG8(scsiTarget_datapath__F0_REG, val);\r
+                       guard++;\r
                }\r
 \r
                }\r
 \r
-               if(SDCard_ReadRxStatus() & SDCard_STS_RX_FIFO_NOT_EMPTY)\r
+               // Byte has been sent out the SCSI interface.\r
+               if (scsiStatus & 2) // SCSI RX FIFO NOT EMPTY\r
                {\r
                {\r
-                       scsiDev.data[i] = SDCard_ReadRxData();\r
-                       i++;\r
+                       CY_GET_REG8(scsiTarget_datapath__F1_REG);\r
+                       ++i;\r
                }\r
                }\r
-       }\r
 \r
 \r
+               // How many bytes are in a 4-byte FIFO ? 5.  4 FIFO bytes PLUS one byte\r
+               // being processed bit-by-bit. Artifically limit the number of bytes in the \r
+               // "combined" SPIM TX and RX FIFOS to the individual FIFO size.\r
+               // Unlike the SCSI component, SPIM doesn't check if there's room in\r
+               // the output FIFO before starting to transmit.\r
+               if ((prep - guard < 4) && (prep < SCSI_BLOCK_SIZE))\r
+               {\r
+                       CY_SET_REG8(SDCard_TXDATA_PTR, 0xFF); // Put a byte in the FIFO\r
+                       prep++;\r
+               }               \r
+       }\r
 \r
        sdSpiByte(0xFF); // CRC\r
        sdSpiByte(0xFF); // CRC\r
        scsiDev.dataLen = SCSI_BLOCK_SIZE;\r
 \r
        sdSpiByte(0xFF); // CRC\r
        sdSpiByte(0xFF); // CRC\r
        scsiDev.dataLen = SCSI_BLOCK_SIZE;\r
-       scsiDev.dataPtr = 0;\r
+       scsiDev.dataPtr = SCSI_BLOCK_SIZE;\r
 }\r
 \r
 void sdCompleteRead()\r
 }\r
 \r
 void sdCompleteRead()\r
@@ -200,8 +243,9 @@ void sdCompleteRead()
        // an error condition as we're trying to read past-the-end of the storage\r
        // device.\r
        // ie. do not use sdCommandAndResponse here.\r
        // an error condition as we're trying to read past-the-end of the storage\r
        // device.\r
        // ie. do not use sdCommandAndResponse here.\r
+       uint8 r1b;\r
        sdSendCommand(SD_STOP_TRANSMISSION, 0);\r
        sdSendCommand(SD_STOP_TRANSMISSION, 0);\r
-       uint8 r1b = sdReadResp();\r
+       r1b = sdReadResp();\r
 \r
        if (r1b)\r
        {\r
 \r
        if (r1b)\r
        {\r
@@ -212,7 +256,7 @@ void sdCompleteRead()
                        r1b = sdCommandAndResponse(SD_STOP_TRANSMISSION, 0);\r
                        retries--;\r
                }\r
                        r1b = sdCommandAndResponse(SD_STOP_TRANSMISSION, 0);\r
                        retries--;\r
                }\r
-               \r
+\r
                scsiDev.status = CHECK_CONDITION;\r
                scsiDev.sense.code = HARDWARE_ERROR;\r
                scsiDev.sense.asc = UNRECOVERED_READ_ERROR;\r
                scsiDev.status = CHECK_CONDITION;\r
                scsiDev.sense.code = HARDWARE_ERROR;\r
                scsiDev.sense.asc = UNRECOVERED_READ_ERROR;\r
@@ -220,11 +264,13 @@ void sdCompleteRead()
        }\r
 \r
        // R1b has an optional trailing "busy" signal.\r
        }\r
 \r
        // R1b has an optional trailing "busy" signal.\r
-       uint8 busy;\r
-       do\r
        {\r
        {\r
-               busy = sdSpiByte(0xFF);\r
-       } while (busy == 0);\r
+               uint8 busy;\r
+               do\r
+               {\r
+                       busy = sdSpiByte(0xFF);\r
+               } while (busy == 0);\r
+       }\r
 }\r
 \r
 static void sdWaitWriteBusy()\r
 }\r
 \r
 static void sdWaitWriteBusy()\r
@@ -238,12 +284,13 @@ static void sdWaitWriteBusy()
 \r
 int sdWriteSector()\r
 {\r
 \r
 int sdWriteSector()\r
 {\r
-       int result;\r
+       int result, i, maxWait;\r
+       uint8 dataToken;\r
+       \r
        // Wait for a previously-written sector to complete.\r
        sdWaitWriteBusy();\r
 \r
        sdSpiByte(0xFC); // MULTIPLE byte start token\r
        // Wait for a previously-written sector to complete.\r
        sdWaitWriteBusy();\r
 \r
        sdSpiByte(0xFC); // MULTIPLE byte start token\r
-       int i;\r
        for (i = 0; i < SCSI_BLOCK_SIZE; i++)\r
        {\r
                while(!(SDCard_ReadTxStatus() & SDCard_STS_TX_FIFO_NOT_FULL))\r
        for (i = 0; i < SCSI_BLOCK_SIZE; i++)\r
        {\r
                while(!(SDCard_ReadTxStatus() & SDCard_STS_TX_FIFO_NOT_FULL))\r
@@ -252,30 +299,31 @@ int sdWriteSector()
        }\r
        while(!(SDCard_ReadTxStatus() & SDCard_STS_SPI_DONE)) {}\r
        SDCard_ClearFIFO();\r
        }\r
        while(!(SDCard_ReadTxStatus() & SDCard_STS_SPI_DONE)) {}\r
        SDCard_ClearFIFO();\r
-       \r
+\r
        sdSpiByte(0x00); // CRC\r
        sdSpiByte(0x00); // CRC\r
 \r
        sdSpiByte(0x00); // CRC\r
        sdSpiByte(0x00); // CRC\r
 \r
-       // Don't wait more than 1000ms.\r
+       // Don't wait more than 1s.\r
        // My 2g Kingston micro-sd card doesn't respond immediately.\r
        // My 16Gb card does.\r
        // My 2g Kingston micro-sd card doesn't respond immediately.\r
        // My 16Gb card does.\r
-       int maxWait = 1000;\r
-       uint8 dataToken = sdSpiByte(0xFF); // Response\r
+       maxWait = 1000000;\r
+       dataToken = sdSpiByte(0xFF); // Response\r
        while (dataToken == 0xFF && maxWait-- > 0)\r
        {\r
        while (dataToken == 0xFF && maxWait-- > 0)\r
        {\r
-               CyDelay(1); // 1ms.     \r
+               CyDelayUs(1);\r
                dataToken = sdSpiByte(0xFF);\r
        }\r
        if (((dataToken & 0x1F) >> 1) != 0x2) // Accepted.\r
        {\r
                dataToken = sdSpiByte(0xFF);\r
        }\r
        if (((dataToken & 0x1F) >> 1) != 0x2) // Accepted.\r
        {\r
+               uint8 r1b, busy;\r
+               \r
                sdWaitWriteBusy();\r
 \r
                sdWaitWriteBusy();\r
 \r
-               uint8 r1b = sdCommandAndResponse(SD_STOP_TRANSMISSION, 0);\r
+               r1b = sdCommandAndResponse(SD_STOP_TRANSMISSION, 0);\r
                (void) r1b;\r
                sdSpiByte(0xFF);\r
 \r
                // R1b has an optional trailing "busy" signal.\r
                (void) r1b;\r
                sdSpiByte(0xFF);\r
 \r
                // R1b has an optional trailing "busy" signal.\r
-               uint8 busy;\r
                do\r
                {\r
                        busy = sdSpiByte(0xFF);\r
                do\r
                {\r
                        busy = sdSpiByte(0xFF);\r
@@ -305,6 +353,8 @@ int sdWriteSector()
 \r
 void sdCompleteWrite()\r
 {\r
 \r
 void sdCompleteWrite()\r
 {\r
+       uint8 r1, r2;\r
+       \r
        // Wait for a previously-written sector to complete.\r
        sdWaitWriteBusy();\r
 \r
        // Wait for a previously-written sector to complete.\r
        sdWaitWriteBusy();\r
 \r
@@ -312,8 +362,8 @@ void sdCompleteWrite()
        // Wait for the card to come out of busy.\r
        sdWaitWriteBusy();\r
 \r
        // Wait for the card to come out of busy.\r
        sdWaitWriteBusy();\r
 \r
-       uint8 r1 = sdCommandAndResponse(13, 0); // send status\r
-       uint8 r2 = sdSpiByte(0xFF);\r
+       r1 = sdCommandAndResponse(13, 0); // send status\r
+       r2 = sdSpiByte(0xFF);\r
        if (r1 || r2)\r
        {\r
                sdClearStatus();\r
        if (r1 || r2)\r
        {\r
                sdClearStatus();\r
@@ -381,11 +431,12 @@ static int sdOpCond()
 \r
 static int sdReadOCR()\r
 {\r
 \r
 static int sdReadOCR()\r
 {\r
+       uint8 buf[4];\r
+       int i;\r
+       \r
        uint8 status = sdCRCCommandAndResponse(SD_READ_OCR, 0);\r
        if(status){goto bad;}\r
 \r
        uint8 status = sdCRCCommandAndResponse(SD_READ_OCR, 0);\r
        if(status){goto bad;}\r
 \r
-       uint8 buf[4];\r
-       int i;\r
        for (i = 0; i < 4; ++i)\r
        {\r
                buf[i] = sdSpiByte(0xFF);\r
        for (i = 0; i < 4; ++i)\r
        {\r
                buf[i] = sdSpiByte(0xFF);\r
@@ -400,19 +451,20 @@ bad:
 \r
 static int sdReadCSD()\r
 {\r
 \r
 static int sdReadCSD()\r
 {\r
+       uint8 startToken;\r
+       int maxWait, i;\r
+       uint8 buf[16];\r
+       \r
        uint8 status = sdCRCCommandAndResponse(SD_SEND_CSD, 0);\r
        if(status){goto bad;}\r
        uint8 status = sdCRCCommandAndResponse(SD_SEND_CSD, 0);\r
        if(status){goto bad;}\r
-       \r
-       uint8 startToken;\r
-       int maxWait = 1023;\r
+\r
+       maxWait = 1023;\r
        do\r
        {\r
                startToken = sdSpiByte(0xFF);\r
        } while(maxWait-- && (startToken != 0xFE));\r
        if (startToken != 0xFE) { goto bad; }\r
 \r
        do\r
        {\r
                startToken = sdSpiByte(0xFF);\r
        } while(maxWait-- && (startToken != 0xFE));\r
        if (startToken != 0xFE) { goto bad; }\r
 \r
-       uint8 buf[16];\r
-       int i;\r
        for (i = 0; i < 16; ++i)\r
        {\r
                buf[i] = sdSpiByte(0xFF);\r
        for (i = 0; i < 16; ++i)\r
        {\r
                buf[i] = sdSpiByte(0xFF);\r
@@ -452,18 +504,20 @@ bad:
 \r
 int sdInit()\r
 {\r
 \r
 int sdInit()\r
 {\r
+       int result = 0;\r
+       int i;\r
+       uint8 v;\r
+       \r
        sdDev.version = 0;\r
        sdDev.ccs = 0;\r
        sdDev.capacity = 0;\r
 \r
        sdDev.version = 0;\r
        sdDev.ccs = 0;\r
        sdDev.capacity = 0;\r
 \r
-       int result = 0;\r
        SD_CS_Write(1); // Set CS inactive (active low)\r
        SD_Init_Clk_Start(); // Turn on the slow 400KHz clock\r
        SD_Clk_Ctl_Write(0); // Select the 400KHz clock source.\r
        SDCard_Start(); // Enable SPI hardware\r
 \r
        // Power on sequence. 74 clock cycles of a "1" while CS unasserted.\r
        SD_CS_Write(1); // Set CS inactive (active low)\r
        SD_Init_Clk_Start(); // Turn on the slow 400KHz clock\r
        SD_Clk_Ctl_Write(0); // Select the 400KHz clock source.\r
        SDCard_Start(); // Enable SPI hardware\r
 \r
        // Power on sequence. 74 clock cycles of a "1" while CS unasserted.\r
-       int i;\r
        for (i = 0; i < 10; ++i)\r
        {\r
                sdSpiByte(0xFF);\r
        for (i = 0; i < 10; ++i)\r
        {\r
                sdSpiByte(0xFF);\r
@@ -472,7 +526,7 @@ int sdInit()
        SD_CS_Write(0); // Set CS active (active low)\r
        CyDelayUs(1);\r
 \r
        SD_CS_Write(0); // Set CS active (active low)\r
        CyDelayUs(1);\r
 \r
-       uint8 v = sdCRCCommandAndResponse(SD_GO_IDLE_STATE, 0);\r
+       v = sdCRCCommandAndResponse(SD_GO_IDLE_STATE, 0);\r
        if(v != 1){goto bad;}\r
 \r
        ledOn();\r
        if(v != 1){goto bad;}\r
 \r
        ledOn();\r
@@ -525,6 +579,9 @@ out:
 \r
 void sdPrepareWrite()\r
 {\r
 \r
 void sdPrepareWrite()\r
 {\r
+       uint32 len;\r
+       uint8 v;\r
+       \r
        // Set the number of blocks to pre-erase by the multiple block write command\r
        // We don't care about the response - if the command is not accepted, writes\r
        // will just be a bit slower.\r
        // Set the number of blocks to pre-erase by the multiple block write command\r
        // We don't care about the response - if the command is not accepted, writes\r
        // will just be a bit slower.\r
@@ -533,12 +590,12 @@ void sdPrepareWrite()
        sdCommandAndResponse(SD_APP_CMD, 0);\r
        sdCommandAndResponse(SD_APP_SET_WR_BLK_ERASE_COUNT, blocks);\r
 \r
        sdCommandAndResponse(SD_APP_CMD, 0);\r
        sdCommandAndResponse(SD_APP_SET_WR_BLK_ERASE_COUNT, blocks);\r
 \r
-       uint32 len = (transfer.lba + transfer.currentBlock);\r
+       len = (transfer.lba + transfer.currentBlock);\r
        if (!sdDev.ccs)\r
        {\r
                len = len * SCSI_BLOCK_SIZE;\r
        }\r
        if (!sdDev.ccs)\r
        {\r
                len = len * SCSI_BLOCK_SIZE;\r
        }\r
-       uint8 v = sdCommandAndResponse(25, len);\r
+       v = sdCommandAndResponse(25, len);\r
        if (v)\r
        {\r
                scsiDiskReset();\r
        if (v)\r
        {\r
                scsiDiskReset();\r
index b8e3c31..7cdca9a 100755 (executable)
@@ -54,13 +54,13 @@ typedef struct
 
 extern SdDevice sdDev;
 
 
 extern SdDevice sdDev;
 
-int sdInit();
-void sdPrepareWrite();
-int sdWriteSector();
-void sdCompleteWrite();
+int sdInit(void);
+void sdPrepareWrite(void);
+int sdWriteSector(void);
+void sdCompleteWrite(void);
 
 
-void sdPrepareRead();
-void sdReadSector();
-void sdCompleteRead();
+void sdPrepareRead(void);
+void sdReadSector(void);
+void sdCompleteRead(void);
 
 #endif
 
 #endif