Add FatFS library to the Webserver project, extend the HTTP server so that it now...
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 28 Jan 2010 12:47:35 +0000 (12:47 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 28 Jan 2010 12:47:35 +0000 (12:47 +0000)
32 files changed:
LUFA.pnproj
Projects/TemperatureDataLogger/makefile
Projects/Webserver/Descriptors.c [new file with mode: 0644]
Projects/Webserver/Descriptors.h [new file with mode: 0644]
Projects/Webserver/Lib/DataflashManager.c [new file with mode: 0644]
Projects/Webserver/Lib/DataflashManager.h [new file with mode: 0644]
Projects/Webserver/Lib/FATFs/00readme.txt [new file with mode: 0644]
Projects/Webserver/Lib/FATFs/diskio.c [new file with mode: 0644]
Projects/Webserver/Lib/FATFs/diskio.h [new file with mode: 0644]
Projects/Webserver/Lib/FATFs/diskio.lst [new file with mode: 0644]
Projects/Webserver/Lib/FATFs/ff.c [new file with mode: 0644]
Projects/Webserver/Lib/FATFs/ff.h [new file with mode: 0644]
Projects/Webserver/Lib/FATFs/ff.lst [new file with mode: 0644]
Projects/Webserver/Lib/FATFs/ffconf.h [new file with mode: 0644]
Projects/Webserver/Lib/FATFs/integer.h [new file with mode: 0644]
Projects/Webserver/Lib/HTTPServerApp.c [new file with mode: 0644]
Projects/Webserver/Lib/HTTPServerApp.h [new file with mode: 0644]
Projects/Webserver/Lib/SCSI.c [new file with mode: 0644]
Projects/Webserver/Lib/SCSI.h [new file with mode: 0644]
Projects/Webserver/Lib/WebserverApp.c [deleted file]
Projects/Webserver/Lib/WebserverApp.h [deleted file]
Projects/Webserver/Lib/uIPManagement.c [new file with mode: 0644]
Projects/Webserver/Lib/uIPManagement.h [new file with mode: 0644]
Projects/Webserver/Lib/uip/conf/apps-conf.h
Projects/Webserver/USBDeviceMode.c [new file with mode: 0644]
Projects/Webserver/USBDeviceMode.h [new file with mode: 0644]
Projects/Webserver/USBHostMode.c [new file with mode: 0644]
Projects/Webserver/USBHostMode.h [new file with mode: 0644]
Projects/Webserver/Webserver.c
Projects/Webserver/Webserver.h
Projects/Webserver/Webserver.txt
Projects/Webserver/makefile

index 1115f17..2e485bc 100644 (file)
@@ -1 +1 @@
-<Project name="LUFA"><Folder name="Demos"><Folder name="Device"><Folder name="ClassDriver"><Folder name="AudioInput"><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.c"></File><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.h"></File><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.txt"></File><File path="Demos\Device\ClassDriver\AudioInput\Descriptors.c"></File><File path="Demos\Device\ClassDriver\AudioInput\Descriptors.h"></File><File path="Demos\Device\ClassDriver\AudioInput\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\AudioInput\makefile"></File></Folder><Folder name="AudioOutput"><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.c"></File><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.h"></File><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.txt"></File><File path="Demos\Device\ClassDriver\AudioOutput\Descriptors.c"></File><File path="Demos\Device\ClassDriver\AudioOutput\Descriptors.h"></File><File path="Demos\Device\ClassDriver\AudioOutput\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\AudioOutput\makefile"></File></Folder><Folder name="DualVirtualSerial"><File path="Demos\Device\ClassDriver\DualVirtualSerial\Descriptors.c"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\Descriptors.h"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.c"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.h"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.txt"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\LUFA DualVirtualSerial.inf"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\makefile"></File></Folder><Folder name="GenericHID"><File path="Demos\Device\ClassDriver\GenericHID\Descriptors.c"></File><File path="Demos\Device\ClassDriver\GenericHID\Descriptors.h"></File><File path="Demos\Device\ClassDriver\GenericHID\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.c"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.h"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.txt"></File><File path="Demos\Device\ClassDriver\GenericHID\makefile"></File></Folder><Folder name="Joystick"><File path="Demos\Device\ClassDriver\Joystick\Descriptors.c"></File><File path="Demos\Device\ClassDriver\Joystick\Descriptors.h"></File><File path="Demos\Device\ClassDriver\Joystick\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.c"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.h"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.txt"></File><File path="Demos\Device\ClassDriver\Joystick\makefile"></File></Folder><Folder name="Keyboard"><File path="Demos\Device\ClassDriver\Keyboard\Descriptors.c"></File><File path="Demos\Device\ClassDriver\Keyboard\Descriptors.h"></File><File path="Demos\Device\ClassDriver\Keyboard\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.c"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.h"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.txt"></File><File path="Demos\Device\ClassDriver\Keyboard\makefile"></File></Folder><Folder name="KeyboardMouse"><File path="Demos\Device\ClassDriver\KeyboardMouse\Descriptors.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\Descriptors.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.txt"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\makefile"></File></Folder><Folder name="MassStorage"><Folder name="Lib"><File path="Demos\Device\ClassDriver\MassStorage\Lib\DataflashManager.c"></File><File path="Demos\Device\ClassDriver\MassStorage\Lib\DataflashManager.h"></File><File path="Demos\Device\ClassDriver\MassStorage\Lib\SCSI.c"></File><File path="Demos\Device\ClassDriver\MassStorage\Lib\SCSI.h"></File></Folder><File path="Demos\Device\ClassDriver\MassStorage\Descriptors.c"></File><File path="Demos\Device\ClassDriver\MassStorage\Descriptors.h"></File><File path="Demos\Device\ClassDriver\MassStorage\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\MassStorage\makefile"></File><File path="Demos\Device\ClassDriver\MassStorage\MassStorage.c"></File><File path="Demos\Device\ClassDriver\MassStorage\MassStorage.h"></File><File path="Demos\Device\ClassDriver\MassStorage\MassStorage.txt"></File></Folder><Folder name="MassStorageKeyboard"><Folder name="Lib"><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Lib\DataflashManager.c"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Lib\DataflashManager.h"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Lib\SCSI.c"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Lib\SCSI.h"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Lib\SCSI_Codes.h"></File></Folder><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Descriptors.c"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Descriptors.h"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\makefile"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\MassStorageKeyboard.c"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\MassStorageKeyboard.h"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\MassStorageKeyboard.txt"></File></Folder><Folder name="MIDI"><File path="Demos\Device\ClassDriver\MIDI\Descriptors.c"></File><File path="Demos\Device\ClassDriver\MIDI\Descriptors.h"></File><File path="Demos\Device\ClassDriver\MIDI\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\MIDI\makefile"></File><File path="Demos\Device\ClassDriver\MIDI\MIDI.c"></File><File path="Demos\Device\ClassDriver\MIDI\MIDI.h"></File><File path="Demos\Device\ClassDriver\MIDI\MIDI.txt"></File></Folder><Folder name="Mouse"><File path="Demos\Device\ClassDriver\Mouse\Descriptors.c"></File><File path="Demos\Device\ClassDriver\Mouse\Descriptors.h"></File><File path="Demos\Device\ClassDriver\Mouse\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\Mouse\makefile"></File><File path="Demos\Device\ClassDriver\Mouse\Mouse.c"></File><File path="Demos\Device\ClassDriver\Mouse\Mouse.h"></File><File path="Demos\Device\ClassDriver\Mouse\Mouse.txt"></File></Folder><Folder name="RNDISEthernet"><Folder name="Lib"><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\Webserver.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ARP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ARP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\DHCP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\DHCP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\Ethernet.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\Ethernet.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\EthernetProtocols.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ICMP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ICMP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\IP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\IP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ProtocolDecoders.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ProtocolDecoders.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\TCP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\TCP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\UDP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\UDP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\Webserver.c"></File></Folder><File path="Demos\Device\ClassDriver\RNDISEthernet\Descriptors.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Descriptors.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\LUFA RNDIS.inf"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\makefile"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\RNDISEthernet.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\RNDISEthernet.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\RNDISEthernet.txt"></File></Folder><Folder name="VirtualSerial"><File path="Demos\Device\ClassDriver\VirtualSerial\Descriptors.c"></File><File path="Demos\Device\ClassDriver\VirtualSerial\Descriptors.h"></File><File path="Demos\Device\ClassDriver\VirtualSerial\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\VirtualSerial\LUFA VirtualSerial.inf"></File><File path="Demos\Device\ClassDriver\VirtualSerial\makefile"></File><File path="Demos\Device\ClassDriver\VirtualSerial\VirtualSerial.c"></File><File path="Demos\Device\ClassDriver\VirtualSerial\VirtualSerial.h"></File><File path="Demos\Device\ClassDriver\VirtualSerial\VirtualSerial.txt"></File></Folder><Folder name="VirtualSerialMouse"><File path="Demos\Device\ClassDriver\VirtualSerialMouse\Descriptors.c"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\Descriptors.h"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\LUFA VirtualSerialMouse.inf"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\makefile"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\VirtualSerialMouse.c"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\VirtualSerialMouse.h"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\VirtualSerialMouse.txt"></File></Folder><File path="Demos\Device\ClassDriver\makefile"></File></Folder><Folder name="LowLevel"><Folder name="AudioInput"><File path="Demos\Device\LowLevel\AudioInput\AudioInput.c"></File><File path="Demos\Device\LowLevel\AudioInput\AudioInput.h"></File><File path="Demos\Device\LowLevel\AudioInput\AudioInput.txt"></File><File path="Demos\Device\LowLevel\AudioInput\Descriptors.c"></File><File path="Demos\Device\LowLevel\AudioInput\Descriptors.h"></File><File path="Demos\Device\LowLevel\AudioInput\Doxygen.conf"></File><File path="Demos\Device\LowLevel\AudioInput\makefile"></File></Folder><Folder name="AudioOutput"><File path="Demos\Device\LowLevel\AudioOutput\AudioOutput.c"></File><File path="Demos\Device\LowLevel\AudioOutput\AudioOutput.h"></File><File path="Demos\Device\LowLevel\AudioOutput\AudioOutput.txt"></File><File path="Demos\Device\LowLevel\AudioOutput\Descriptors.c"></File><File path="Demos\Device\LowLevel\AudioOutput\Descriptors.h"></File><File path="Demos\Device\LowLevel\AudioOutput\Doxygen.conf"></File><File path="Demos\Device\LowLevel\AudioOutput\makefile"></File></Folder><Folder name="DualVirtualSerial"><File path="Demos\Device\LowLevel\DualVirtualSerial\Descriptors.c"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\Descriptors.h"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\Doxygen.conf"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\DualVirtualSerial.c"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\DualVirtualSerial.h"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\DualVirtualSerial.txt"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\LUFA DualVirtualSerial.inf"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\makefile"></File></Folder><Folder name="GenericHID"><File path="Demos\Device\LowLevel\GenericHID\Descriptors.c"></File><File path="Demos\Device\LowLevel\GenericHID\Descriptors.h"></File><File path="Demos\Device\LowLevel\GenericHID\Doxygen.conf"></File><File path="Demos\Device\LowLevel\GenericHID\GenericHID.c"></File><File path="Demos\Device\LowLevel\GenericHID\GenericHID.h"></File><File path="Demos\Device\LowLevel\GenericHID\GenericHID.txt"></File><File path="Demos\Device\LowLevel\GenericHID\makefile"></File></Folder><Folder name="Joystick"><File path="Demos\Device\LowLevel\Joystick\Descriptors.c"></File><File path="Demos\Device\LowLevel\Joystick\Descriptors.h"></File><File path="Demos\Device\LowLevel\Joystick\Doxygen.conf"></File><File path="Demos\Device\LowLevel\Joystick\Joystick.c"></File><File path="Demos\Device\LowLevel\Joystick\Joystick.h"></File><File path="Demos\Device\LowLevel\Joystick\Joystick.txt"></File><File path="Demos\Device\LowLevel\Joystick\makefile"></File></Folder><Folder name="Keyboard"><File path="Demos\Device\LowLevel\Keyboard\Descriptors.c"></File><File path="Demos\Device\LowLevel\Keyboard\Descriptors.h"></File><File path="Demos\Device\LowLevel\Keyboard\Doxygen.conf"></File><File path="Demos\Device\LowLevel\Keyboard\Keyboard.c"></File><File path="Demos\Device\LowLevel\Keyboard\Keyboard.h"></File><File path="Demos\Device\LowLevel\Keyboard\Keyboard.txt"></File><File path="Demos\Device\LowLevel\Keyboard\makefile"></File></Folder><Folder name="KeyboardMouse"><File path="Demos\Device\LowLevel\KeyboardMouse\Descriptors.c"></File><File path="Demos\Device\LowLevel\KeyboardMouse\Descriptors.h"></File><File path="Demos\Device\LowLevel\KeyboardMouse\Doxygen.conf"></File><File path="Demos\Device\LowLevel\KeyboardMouse\KeyboardMouse.c"></File><File path="Demos\Device\LowLevel\KeyboardMouse\KeyboardMouse.h"></File><File path="Demos\Device\LowLevel\KeyboardMouse\KeyboardMouse.txt"></File><File path="Demos\Device\LowLevel\KeyboardMouse\makefile"></File></Folder><Folder name="MassStorage"><Folder name="Lib"><File path="Demos\Device\LowLevel\MassStorage\Lib\DataflashManager.c"></File><File path="Demos\Device\LowLevel\MassStorage\Lib\DataflashManager.h"></File><File path="Demos\Device\LowLevel\MassStorage\Lib\SCSI.c"></File><File path="Demos\Device\LowLevel\MassStorage\Lib\SCSI.h"></File><File path="Demos\Device\LowLevel\MassStorage\Lib\SCSI_Codes.h"></File></Folder><File path="Demos\Device\LowLevel\MassStorage\Descriptors.c"></File><File path="Demos\Device\LowLevel\MassStorage\Descriptors.h"></File><File path="Demos\Device\LowLevel\MassStorage\Doxygen.conf"></File><File path="Demos\Device\LowLevel\MassStorage\makefile"></File><File path="Demos\Device\LowLevel\MassStorage\MassStorage.c"></File><File path="Demos\Device\LowLevel\MassStorage\MassStorage.h"></File><File path="Demos\Device\LowLevel\MassStorage\MassStorage.txt"></File></Folder><Folder name="MIDI"><File path="Demos\Device\LowLevel\MIDI\Descriptors.c"></File><File path="Demos\Device\LowLevel\MIDI\Descriptors.h"></File><File path="Demos\Device\LowLevel\MIDI\Doxygen.conf"></File><File path="Demos\Device\LowLevel\MIDI\makefile"></File><File path="Demos\Device\LowLevel\MIDI\MIDI.c"></File><File path="Demos\Device\LowLevel\MIDI\MIDI.h"></File><File path="Demos\Device\LowLevel\MIDI\MIDI.txt"></File></Folder><Folder name="Mouse"><File path="Demos\Device\LowLevel\Mouse\Descriptors.c"></File><File path="Demos\Device\LowLevel\Mouse\Descriptors.h"></File><File path="Demos\Device\LowLevel\Mouse\Doxygen.conf"></File><File path="Demos\Device\LowLevel\Mouse\makefile"></File><File path="Demos\Device\LowLevel\Mouse\Mouse.c"></File><File path="Demos\Device\LowLevel\Mouse\Mouse.h"></File><File path="Demos\Device\LowLevel\Mouse\Mouse.txt"></File></Folder><Folder name="RNDISEthernet"><Folder name="Lib"><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\Webserver.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ARP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ARP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\DHCP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\DHCP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\Ethernet.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\Ethernet.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\EthernetProtocols.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ICMP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ICMP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\IP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\IP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ProtocolDecoders.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ProtocolDecoders.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\RNDIS.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\RNDIS.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\RNDISConstants.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\TCP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\TCP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\UDP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\UDP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\Webserver.c"></File></Folder><File path="Demos\Device\LowLevel\RNDISEthernet\Descriptors.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Descriptors.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Doxygen.conf"></File><File path="Demos\Device\LowLevel\RNDISEthernet\LUFA RNDIS.inf"></File><File path="Demos\Device\LowLevel\RNDISEthernet\makefile"></File><File path="Demos\Device\LowLevel\RNDISEthernet\RNDISEthernet.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\RNDISEthernet.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\RNDISEthernet.txt"></File></Folder><Folder name="VirtualSerial"><File path="Demos\Device\LowLevel\VirtualSerial\Descriptors.c"></File><File path="Demos\Device\LowLevel\VirtualSerial\Descriptors.h"></File><File path="Demos\Device\LowLevel\VirtualSerial\Doxygen.conf"></File><File path="Demos\Device\LowLevel\VirtualSerial\LUFA VirtualSerial.inf"></File><File path="Demos\Device\LowLevel\VirtualSerial\makefile"></File><File path="Demos\Device\LowLevel\VirtualSerial\VirtualSerial.c"></File><File path="Demos\Device\LowLevel\VirtualSerial\VirtualSerial.h"></File><File path="Demos\Device\LowLevel\VirtualSerial\VirtualSerial.txt"></File></Folder><File path="Demos\Device\LowLevel\makefile"></File></Folder><Folder name="Incomplete"><Folder name="SideShow"><Folder name="Lib"><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowApplications.c"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowApplications.h"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowCommands.c"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowCommands.h"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowCommon.c"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowCommon.h"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowContent.c"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowContent.h"></File></Folder><File path="Demos\Device\Incomplete\Sideshow\Descriptors.c"></File><File path="Demos\Device\Incomplete\Sideshow\Descriptors.h"></File><File path="Demos\Device\Incomplete\Sideshow\makefile"></File><File path="Demos\Device\Incomplete\Sideshow\Sideshow.c"></File><File path="Demos\Device\Incomplete\Sideshow\Sideshow.h"></File></Folder></Folder><File path="Demos\Device\makefile"></File></Folder><Folder name="Host"><Folder name="ClassDriver"><Folder name="JoystickHostWithParser"><File path="Demos\Host\ClassDriver\JoystickHostWithParser\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\JoystickHostWithParser\JoystickHostWithParser.c"></File><File path="Demos\Host\ClassDriver\JoystickHostWithParser\JoystickHostWithParser.h"></File><File path="Demos\Host\ClassDriver\JoystickHostWithParser\JoystickHostWithParser.txt"></File><File path="Demos\Host\ClassDriver\JoystickHostWithParser\makefile"></File></Folder><Folder name="KeyboardHost"><File path="Demos\Host\ClassDriver\KeyboardHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\KeyboardHost\KeyboardHost.c"></File><File path="Demos\Host\ClassDriver\KeyboardHost\KeyboardHost.h"></File><File path="Demos\Host\ClassDriver\KeyboardHost\makefile"></File><File path="Demos\Host\ClassDriver\KeyboardHost\KeyboardHost.txt"></File></Folder><Folder name="KeyboardHostWithParser"><File path="Demos\Host\ClassDriver\KeyboardHostWithParser\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\KeyboardHostWithParser\KeyboardHostWithParser.c"></File><File path="Demos\Host\ClassDriver\KeyboardHostWithParser\KeyboardHostWithParser.h"></File><File path="Demos\Host\ClassDriver\KeyboardHostWithParser\makefile"></File><File path="Demos\Host\ClassDriver\KeyboardHostWithParser\KeyboardHostWithParser.txt"></File></Folder><Folder name="MIDIHost"><File path="Demos\Host\ClassDriver\MIDIHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\MIDIHost\makefile"></File><File path="Demos\Host\ClassDriver\MIDIHost\MIDIHost.c"></File><File path="Demos\Host\ClassDriver\MIDIHost\MIDIHost.h"></File><File path="Demos\Host\ClassDriver\MIDIHost\MIDIHost.txt"></File></Folder><Folder name="MouseHost"><File path="Demos\Host\ClassDriver\MouseHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\MouseHost\makefile"></File><File path="Demos\Host\ClassDriver\MouseHost\MouseHost.c"></File><File path="Demos\Host\ClassDriver\MouseHost\MouseHost.h"></File><File path="Demos\Host\ClassDriver\MouseHost\MouseHost.txt"></File></Folder><Folder name="MouseHostWithParser"><File path="Demos\Host\ClassDriver\MouseHostWithParser\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\MouseHostWithParser\makefile"></File><File path="Demos\Host\ClassDriver\MouseHostWithParser\MouseHostWithParser.txt"></File><File path="Demos\Host\ClassDriver\MouseHostWithParser\MouseHostWithParser.c"></File><File path="Demos\Host\ClassDriver\MouseHostWithParser\MouseHostWithParser.h"></File></Folder><Folder name="MassStorageHost"><File path="Demos\Host\ClassDriver\MassStorageHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\MassStorageHost\makefile"></File><File path="Demos\Host\ClassDriver\MassStorageHost\MassStorageHost.c"></File><File path="Demos\Host\ClassDriver\MassStorageHost\MassStorageHost.h"></File><File path="Demos\Host\ClassDriver\MassStorageHost\MassStorageHost.txt"></File></Folder><Folder name="PrinterHost"><File path="Demos\Host\ClassDriver\PrinterHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\PrinterHost\makefile"></File><File path="Demos\Host\ClassDriver\PrinterHost\PrinterHost.c"></File><File path="Demos\Host\ClassDriver\PrinterHost\PrinterHost.h"></File><File path="Demos\Host\ClassDriver\PrinterHost\PrinterHost.txt"></File></Folder><Folder name="RNDISEthernetHost"><File path="Demos\Host\ClassDriver\RNDISEthernetHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\RNDISEthernetHost\makefile"></File><File path="Demos\Host\ClassDriver\RNDISEthernetHost\RNDISEthernetHost.c"></File><File path="Demos\Host\ClassDriver\RNDISEthernetHost\RNDISEthernetHost.h"></File><File path="Demos\Host\ClassDriver\RNDISEthernetHost\RNDISEthernetHost.txt"></File></Folder><Folder name="StillImageHost"><File path="Demos\Host\ClassDriver\StillImageHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\StillImageHost\makefile"></File><File path="Demos\Host\ClassDriver\StillImageHost\StillImageHost.c"></File><File path="Demos\Host\ClassDriver\StillImageHost\StillImageHost.h"></File><File path="Demos\Host\ClassDriver\StillImageHost\StillImageHost.txt"></File></Folder><Folder name="VirtualSerialHost"><File path="Demos\Host\ClassDriver\VirtualSerialHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\VirtualSerialHost\makefile"></File><File path="Demos\Host\ClassDriver\VirtualSerialHost\VirtualSerialHost.c"></File><File path="Demos\Host\ClassDriver\VirtualSerialHost\VirtualSerialHost.h"></File><File path="Demos\Host\ClassDriver\VirtualSerialHost\VirtualSerialHost.txt"></File></Folder><File path="Demos\Host\ClassDriver\makefile"></File></Folder><Folder name="LowLevel"><Folder name="GenericHIDHost"><File path="Demos\Host\LowLevel\GenericHIDHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\GenericHIDHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\GenericHIDHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\GenericHIDHost\GenericHIDHost.c"></File><File path="Demos\Host\LowLevel\GenericHIDHost\GenericHIDHost.h"></File><File path="Demos\Host\LowLevel\GenericHIDHost\GenericHIDHost.txt"></File><File path="Demos\Host\LowLevel\GenericHIDHost\makefile"></File></Folder><Folder name="JoystickHostWithParser"><File path="Demos\Host\LowLevel\JoystickHostWithParser\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\Doxygen.conf"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\HIDReport.c"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\HIDReport.h"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\JoystickHostWithParser.c"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\JoystickHostWithParser.h"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\JoystickHostWithParser.txt"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\makefile"></File></Folder><Folder name="KeyboardHost"><File path="Demos\Host\LowLevel\KeyboardHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\KeyboardHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\KeyboardHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\KeyboardHost\KeyboardHost.c"></File><File path="Demos\Host\LowLevel\KeyboardHost\KeyboardHost.h"></File><File path="Demos\Host\LowLevel\KeyboardHost\KeyboardHost.txt"></File><File path="Demos\Host\LowLevel\KeyboardHost\makefile"></File></Folder><Folder name="KeyboardHostWithParser"><File path="Demos\Host\LowLevel\KeyboardHostWithParser\makefile"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\Doxygen.conf"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\HIDReport.c"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\HIDReport.h"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\KeyboardHostWithParser.c"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\KeyboardHostWithParser.h"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\KeyboardHostWithParser.txt"></File></Folder><Folder name="MassStorageHost"><Folder name="Lib"><File path="Demos\Host\LowLevel\MassStorageHost\Lib\MassStoreCommands.c"></File><File path="Demos\Host\LowLevel\MassStorageHost\Lib\MassStoreCommands.h"></File><File path="Demos\Host\LowLevel\MassStorageHost\Lib\SCSI_Codes.h"></File></Folder><File path="Demos\Host\LowLevel\MassStorageHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\MassStorageHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\MassStorageHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\MassStorageHost\makefile"></File><File path="Demos\Host\LowLevel\MassStorageHost\MassStorageHost.c"></File><File path="Demos\Host\LowLevel\MassStorageHost\MassStorageHost.h"></File><File path="Demos\Host\LowLevel\MassStorageHost\MassStorageHost.txt"></File></Folder><Folder name="MIDIHost"><File path="Demos\Host\LowLevel\MIDIHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\MIDIHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\MIDIHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\MIDIHost\makefile"></File><File path="Demos\Host\LowLevel\MIDIHost\MIDIHost.c"></File><File path="Demos\Host\LowLevel\MIDIHost\MIDIHost.h"></File><File path="Demos\Host\LowLevel\MIDIHost\MIDIHost.txt"></File></Folder><Folder name="MouseHost"><File path="Demos\Host\LowLevel\MouseHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\MouseHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\MouseHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\MouseHost\makefile"></File><File path="Demos\Host\LowLevel\MouseHost\MouseHost.c"></File><File path="Demos\Host\LowLevel\MouseHost\MouseHost.h"></File><File path="Demos\Host\LowLevel\MouseHost\MouseHost.txt"></File></Folder><Folder name="MouseHostWithParser"><File path="Demos\Host\LowLevel\MouseHostWithParser\MouseHostWithParser.txt"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\Doxygen.conf"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\HIDReport.c"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\HIDReport.h"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\makefile"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\MouseHostWithParser.c"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\MouseHostWithParser.h"></File></Folder><Folder name="PrinterHost"><Folder name="Lib"><File path="Demos\Host\LowLevel\PrinterHost\Lib\PrinterCommands.c"></File><File path="Demos\Host\LowLevel\PrinterHost\Lib\PrinterCommands.h"></File></Folder><File path="Demos\Host\LowLevel\PrinterHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\PrinterHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\PrinterHost\makefile"></File><File path="Demos\Host\LowLevel\PrinterHost\PrinterHost.c"></File><File path="Demos\Host\LowLevel\PrinterHost\PrinterHost.h"></File><File path="Demos\Host\LowLevel\PrinterHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\PrinterHost\PrinterHost.txt"></File></Folder><Folder name="RNDISEthernetHost"><Folder name="Lib"><File path="Demos\Host\LowLevel\RNDISEthernetHost\Lib\RNDISCommands.c"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\Lib\RNDISCommands.h"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\Lib\RNDISConstants.h"></File></Folder><File path="Demos\Host\LowLevel\RNDISEthernetHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\makefile"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\RNDISEthernetHost.c"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\RNDISEthernetHost.h"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\RNDISHost.txt"></File></Folder><Folder name="StillImageHost"><Folder name="Lib"><File path="Demos\Host\LowLevel\StillImageHost\Lib\PIMACodes.h"></File><File path="Demos\Host\LowLevel\StillImageHost\Lib\StillImageCommands.c"></File><File path="Demos\Host\LowLevel\StillImageHost\Lib\StillImageCommands.h"></File></Folder><File path="Demos\Host\LowLevel\StillImageHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\StillImageHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\StillImageHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\StillImageHost\makefile"></File><File path="Demos\Host\LowLevel\StillImageHost\StillImageHost.c"></File><File path="Demos\Host\LowLevel\StillImageHost\StillImageHost.h"></File><File path="Demos\Host\LowLevel\StillImageHost\StillImageHost.txt"></File></Folder><Folder name="VirtualSerialHost"><File path="Demos\Host\LowLevel\VirtualSerialHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\makefile"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\VirtualSerialHost.c"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\VirtualSerialHost.h"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\VirtualSerialHost.txt"></File></Folder><File path="Demos\Host\LowLevel\makefile"></File></Folder><Folder name="Incomplete"><Folder name="BluetoothHost"><Folder name="Lib"><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothACLPackets.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothACLPackets.h"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothClassCodes.h"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothHCICommands.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothHCICommands.h"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothStack.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothStack.h"></File></Folder><File path="Demos\Host\Incomplete\BluetoothHost\makefile"></File><File path="Demos\Host\Incomplete\BluetoothHost\BluetoothHost.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\BluetoothHost.h"></File><File path="Demos\Host\Incomplete\BluetoothHost\ConfigDescriptor.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\ConfigDescriptor.h"></File><File path="Demos\Host\Incomplete\BluetoothHost\DeviceDescriptor.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\DeviceDescriptor.h"></File></Folder></Folder><File path="Demos\Host\makefile"></File></Folder><Folder name="DualRole"><Folder name="ClassDriver"><Folder name="MouseHostDevice"><File path="Demos\DualRole\ClassDriver\MouseHostDevice\Doxygen.conf"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\makefile"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\MouseHostDevice.c"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\MouseHostDevice.h"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\Descriptors.c"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\Descriptors.h"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\DeviceFunctions.c"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\HostFunctions.c"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\HostFunctions.h"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\DeviceFunctions.h"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\MouseHostDevice.txt"></File></Folder><File path="Demos\DualRole\ClassDriver\makefile"></File></Folder><File path="Demos\DualRole\makefile"></File></Folder><File path="Demos\makefile"></File></Folder><Folder name="LUFA"><Folder name="Common"><File path="LUFA\Common\Common.h"></File><File path="LUFA\Common\FunctionAttributes.h"></File><File path="LUFA\Common\BoardTypes.h"></File></Folder><Folder name="Drivers"><Folder name="USB"><Folder name="LowLevel"><Folder name="Template"><File path="LUFA\Drivers\USB\LowLevel\Template\Template_Endpoint_RW.c"></File><File path="LUFA\Drivers\USB\LowLevel\Template\Template_Endpoint_Control_R.c"></File><File path="LUFA\Drivers\USB\LowLevel\Template\Template_Endpoint_Control_W.c"></File><File path="LUFA\Drivers\USB\LowLevel\Template\Template_Pipe_RW.c"></File></Folder><File path="LUFA\Drivers\USB\LowLevel\HostChapter9.h"></File><File path="LUFA\Drivers\USB\LowLevel\LowLevel.c"></File><File path="LUFA\Drivers\USB\LowLevel\LowLevel.h"></File><File path="LUFA\Drivers\USB\LowLevel\Pipe.c"></File><File path="LUFA\Drivers\USB\LowLevel\Pipe.h"></File><File path="LUFA\Drivers\USB\LowLevel\DevChapter9.c"></File><File path="LUFA\Drivers\USB\LowLevel\DevChapter9.h"></File><File path="LUFA\Drivers\USB\LowLevel\Device.h"></File><File path="LUFA\Drivers\USB\LowLevel\Endpoint.c"></File><File path="LUFA\Drivers\USB\LowLevel\Endpoint.h"></File><File path="LUFA\Drivers\USB\LowLevel\Host.c"></File><File path="LUFA\Drivers\USB\LowLevel\Host.h"></File><File path="LUFA\Drivers\USB\LowLevel\HostChapter9.c"></File><File path="LUFA\Drivers\USB\LowLevel\OTG.h"></File></Folder><Folder name="HighLevel"><File path="LUFA\Drivers\USB\HighLevel\USBTask.h"></File><File path="LUFA\Drivers\USB\HighLevel\Events.c"></File><File path="LUFA\Drivers\USB\HighLevel\Events.h"></File><File path="LUFA\Drivers\USB\HighLevel\USBInterrupt.c"></File><File path="LUFA\Drivers\USB\HighLevel\USBInterrupt.h"></File><File path="LUFA\Drivers\USB\HighLevel\USBTask.c"></File><File path="LUFA\Drivers\USB\HighLevel\StdDescriptors.h"></File><File path="LUFA\Drivers\USB\HighLevel\StdRequestType.h"></File><File path="LUFA\Drivers\USB\HighLevel\StreamCallbacks.h"></File><File path="LUFA\Drivers\USB\HighLevel\USBMode.h"></File><File path="LUFA\Drivers\USB\HighLevel\ConfigDescriptor.c"></File><File path="LUFA\Drivers\USB\HighLevel\ConfigDescriptor.h"></File></Folder><Folder name="Class"><Folder name="Device"><File path="LUFA\Drivers\USB\Class\Device\HID.c"></File><File path="LUFA\Drivers\USB\Class\Device\HID.h"></File><File path="LUFA\Drivers\USB\Class\Device\CDC.c"></File><File path="LUFA\Drivers\USB\Class\Device\CDC.h"></File><File path="LUFA\Drivers\USB\Class\Device\RNDIS.c"></File><File path="LUFA\Drivers\USB\Class\Device\RNDIS.h"></File><File path="LUFA\Drivers\USB\Class\Device\MassStorage.c"></File><File path="LUFA\Drivers\USB\Class\Device\MassStorage.h"></File><File path="LUFA\Drivers\USB\Class\Device\Audio.c"></File><File path="LUFA\Drivers\USB\Class\Device\Audio.h"></File><File path="LUFA\Drivers\USB\Class\Device\MIDI.c"></File><File path="LUFA\Drivers\USB\Class\Device\MIDI.h"></File></Folder><Folder name="Host"><File path="LUFA\Drivers\USB\Class\Host\HIDParser.c"></File><File path="LUFA\Drivers\USB\Class\Host\HIDParser.h"></File><File path="LUFA\Drivers\USB\Class\Host\HIDReportData.h"></File><File path="LUFA\Drivers\USB\Class\Host\CDC.c"></File><File path="LUFA\Drivers\USB\Class\Host\CDC.h"></File><File path="LUFA\Drivers\USB\Class\Host\HID.c"></File><File path="LUFA\Drivers\USB\Class\Host\HID.h"></File><File path="LUFA\Drivers\USB\Class\Host\MassStorage.c"></File><File path="LUFA\Drivers\USB\Class\Host\MassStorage.h"></File><File path="LUFA\Drivers\USB\Class\Host\StillImage.c"></File><File path="LUFA\Drivers\USB\Class\Host\StillImage.h"></File><File path="LUFA\Drivers\USB\Class\Host\MIDI.c"></File><File path="LUFA\Drivers\USB\Class\Host\MIDI.h"></File><File path="LUFA\Drivers\USB\Class\Host\Printer.c"></File><File path="LUFA\Drivers\USB\Class\Host\Printer.h"></File><File path="LUFA\Drivers\USB\Class\Host\RNDIS.h"></File><File path="LUFA\Drivers\USB\Class\Host\RNDIS.c"></File></Folder><Folder name="Common"><File path="LUFA\Drivers\USB\Class\Common\Audio.h"></File><File path="LUFA\Drivers\USB\Class\Common\CDC.h"></File><File path="LUFA\Drivers\USB\Class\Common\HID.h"></File><File path="LUFA\Drivers\USB\Class\Common\MassStorage.h"></File><File path="LUFA\Drivers\USB\Class\Common\MIDI.h"></File><File path="LUFA\Drivers\USB\Class\Common\RNDIS.h"></File><File path="LUFA\Drivers\USB\Class\Common\StillImage.h"></File><File path="LUFA\Drivers\USB\Class\Common\Printer.h"></File><File path="LUFA\Drivers\USB\Class\Common\RNDISConstants.h"></File></Folder><File path="LUFA\Drivers\USB\Class\Audio.h"></File><File path="LUFA\Drivers\USB\Class\CDC.h"></File><File path="LUFA\Drivers\USB\Class\HID.h"></File><File path="LUFA\Drivers\USB\Class\MassStorage.h"></File><File path="LUFA\Drivers\USB\Class\MIDI.h"></File><File path="LUFA\Drivers\USB\Class\RNDIS.h"></File><File path="LUFA\Drivers\USB\Class\StillImage.h"></File><File path="LUFA\Drivers\USB\Class\Printer.h"></File></Folder><File path="LUFA\Drivers\USB\USB.h"></File></Folder><Folder name="Misc"><File path="LUFA\Drivers\Misc\TerminalCodes.h"></File></Folder><Folder name="Board"><Folder name="USBKEY"><File path="LUFA\Drivers\Board\USBKEY\Dataflash.h"></File><File path="LUFA\Drivers\Board\USBKEY\Joystick.h"></File><File path="LUFA\Drivers\Board\USBKEY\AT45DB642D.h"></File><File path="LUFA\Drivers\Board\USBKEY\LEDs.h"></File><File path="LUFA\Drivers\Board\USBKEY\Buttons.h"></File></Folder><Folder name="STK526"><File path="LUFA\Drivers\Board\STK526\Dataflash.h"></File><File path="LUFA\Drivers\Board\STK526\Joystick.h"></File><File path="LUFA\Drivers\Board\STK526\AT45DB642D.h"></File><File path="LUFA\Drivers\Board\STK526\LEDs.h"></File><File path="LUFA\Drivers\Board\STK526\Buttons.h"></File></Folder><Folder name="STK525"><File path="LUFA\Drivers\Board\STK525\Dataflash.h"></File><File path="LUFA\Drivers\Board\STK525\Joystick.h"></File><File path="LUFA\Drivers\Board\STK525\AT45DB321C.h"></File><File path="LUFA\Drivers\Board\STK525\LEDs.h"></File><File path="LUFA\Drivers\Board\STK525\Buttons.h"></File></Folder><Folder name="RZUSBSTICK"><File path="LUFA\Drivers\Board\RZUSBSTICK\LEDs.h"></File></Folder><Folder name="ATAVRUSBRF01"><File path="LUFA\Drivers\Board\ATAVRUSBRF01\LEDs.h"></File><File path="LUFA\Drivers\Board\ATAVRUSBRF01\Buttons.h"></File></Folder><Folder name="BUMBLEB"><File path="LUFA\Drivers\Board\BUMBLEB\Buttons.h"></File><File path="LUFA\Drivers\Board\BUMBLEB\Joystick.h"></File><File path="LUFA\Drivers\Board\BUMBLEB\LEDs.h"></File></Folder><Folder name="XPLAIN"><File path="LUFA\Drivers\Board\XPLAIN\LEDs.h"></File><File path="LUFA\Drivers\Board\XPLAIN\AT45DB642D.h"></File><File path="LUFA\Drivers\Board\XPLAIN\Dataflash.h"></File></Folder><Folder name="EVK527"><File path="LUFA\Drivers\Board\EVK527\Buttons.h"></File><File path="LUFA\Drivers\Board\EVK527\LEDs.h"></File><File path="LUFA\Drivers\Board\EVK527\Joystick.h"></File><File path="LUFA\Drivers\Board\EVK527\AT45DB321C.h"></File><File path="LUFA\Drivers\Board\EVK527\Dataflash.h"></File></Folder><File path="LUFA\Drivers\Board\Temperature.h"></File><File path="LUFA\Drivers\Board\Dataflash.h"></File><File path="LUFA\Drivers\Board\Joystick.h"></File><File path="LUFA\Drivers\Board\Temperature.c"></File><File path="LUFA\Drivers\Board\LEDs.h"></File><File path="LUFA\Drivers\Board\Buttons.h"></File></Folder><Folder name="Peripheral"><Folder name="AVRU4U6U7"><File path="LUFA\Drivers\Peripheral\AVRU4U6U7\ADC.h"></File><File path="LUFA\Drivers\Peripheral\AVRU4U6U7\TWI.h"></File></Folder><File path="LUFA\Drivers\Peripheral\ADC.h"></File><File path="LUFA\Drivers\Peripheral\Serial.c"></File><File path="LUFA\Drivers\Peripheral\Serial.h"></File><File path="LUFA\Drivers\Peripheral\SPI.h"></File><File path="LUFA\Drivers\Peripheral\SerialStream.c"></File><File path="LUFA\Drivers\Peripheral\SerialStream.h"></File><File path="LUFA\Drivers\Peripheral\TWI.h"></File><File path="LUFA\Drivers\Peripheral\TWI.c"></File></Folder></Folder><Folder name="DriverStubs"><File path="LUFA\DriverStubs\Dataflash.h"></File><File path="LUFA\DriverStubs\Joystick.h"></File><File path="LUFA\DriverStubs\LEDs.h"></File><File path="LUFA\DriverStubs\Buttons.h"></File></Folder><Folder name="ManPages"><File path="LUFA\ManPages\AboutLUFA.txt"></File><File path="LUFA\ManPages\BuildingLinkableLibraries.txt"></File><File path="LUFA\ManPages\ChangeLog.txt"></File><File path="LUFA\ManPages\CompileTimeTokens.txt"></File><File path="LUFA\ManPages\DevelopingWithLUFA.txt"></File><File path="LUFA\ManPages\DeviceSupport.txt"></File><File path="LUFA\ManPages\DirectorySummaries.txt"></File><File path="LUFA\ManPages\Donating.txt"></File><File path="LUFA\ManPages\FutureChanges.txt"></File><File path="LUFA\ManPages\GettingStarted.txt"></File><File path="LUFA\ManPages\Groups.txt"></File><File path="LUFA\ManPages\LibraryResources.txt"></File><File path="LUFA\ManPages\LUFAPoweredProjects.txt"></File><File path="LUFA\ManPages\MainPage.txt"></File><File path="LUFA\ManPages\MigrationInformation.txt"></File><File path="LUFA\ManPages\VIDAndPIDValues.txt"></File><File path="LUFA\ManPages\WritingBoardDrivers.txt"></File><File path="LUFA\ManPages\ConfiguringApps.txt"></File><File path="LUFA\ManPages\CompilingApps.txt"></File><File path="LUFA\ManPages\ProgrammingApps.txt"></File><File path="LUFA\ManPages\LibraryApps.txt"></File><File path="LUFA\ManPages\Licence.txt"></File><File path="LUFA\ManPages\WhyUseLUFA.txt"></File><File path="LUFA\ManPages\LUFAvsAtmelStack.txt"></File><File path="LUFA\ManPages\AlternativeStacks.txt"></File></Folder><Folder name="Scheduler"><File path="LUFA\Scheduler\Scheduler.c"></File><File path="LUFA\Scheduler\Scheduler.h"></File></Folder><File path="LUFA\makefile"></File><File path="LUFA\Version.h"></File><File path="LUFA\Doxygen.conf"></File></Folder><Folder name="Bootloaders"><Folder name="DFU"><File path="Bootloaders\DFU\BootloaderDFU.c"></File><File path="Bootloaders\DFU\BootloaderDFU.h"></File><File path="Bootloaders\DFU\Descriptors.c"></File><File path="Bootloaders\DFU\Descriptors.h"></File><File path="Bootloaders\DFU\makefile"></File><File path="Bootloaders\DFU\BootloaderDFU.txt"></File><File path="Bootloaders\DFU\Doxygen.conf"></File></Folder><Folder name="CDC"><File path="Bootloaders\CDC\BootloaderCDC.c"></File><File path="Bootloaders\CDC\BootloaderCDC.h"></File><File path="Bootloaders\CDC\Descriptors.c"></File><File path="Bootloaders\CDC\Descriptors.h"></File><File path="Bootloaders\CDC\makefile"></File><File path="Bootloaders\CDC\LUFA CDC Bootloader.inf"></File><File path="Bootloaders\CDC\Doxygen.conf"></File><File path="Bootloaders\CDC\BootloaderCDC.txt"></File></Folder><Folder name="TeensyHID"><File path="Bootloaders\TeensyHID\Descriptors.c"></File><File path="Bootloaders\TeensyHID\Descriptors.h"></File><File path="Bootloaders\TeensyHID\makefile"></File><File path="Bootloaders\TeensyHID\TeensyHID.c"></File><File path="Bootloaders\TeensyHID\TeensyHID.h"></File><File path="Bootloaders\TeensyHID\TeensyHID.txt"></File></Folder><Folder name="Incomplete"><Folder name="MIDI"><Folder name="JavaHost"><File path="Bootloaders\Incomplete\MIDI\JavaHost\BIN2BOOT.java"></File><File path="Bootloaders\Incomplete\MIDI\JavaHost\MIDIMessageReceiver.java"></File></Folder><File path="Bootloaders\Incomplete\MIDI\BootloaderMIDI.c"></File><File path="Bootloaders\Incomplete\MIDI\BootloaderMIDI.h"></File><File path="Bootloaders\Incomplete\MIDI\Descriptors.c"></File><File path="Bootloaders\Incomplete\MIDI\Descriptors.h"></File><File path="Bootloaders\Incomplete\MIDI\Doxygen.conf"></File><File path="Bootloaders\Incomplete\MIDI\makefile"></File><File path="Bootloaders\Incomplete\MIDI\MIDI.c"></File></Folder></Folder><File path="Bootloaders\makefile"></File></Folder><Folder name="Projects"><Folder name="AVRISP-MKII"><Folder name="Lib"><Folder name="ISP"><File path="Projects\AVRISP-MKII\Lib\ISP\ISPProtocol.c"></File><File path="Projects\AVRISP-MKII\Lib\ISP\ISPProtocol.h"></File><File path="Projects\AVRISP-MKII\Lib\ISP\ISPTarget.c"></File><File path="Projects\AVRISP-MKII\Lib\ISP\ISPTarget.h"></File></Folder><Folder name="XPROG"><File path="Projects\AVRISP-MKII\Lib\XPROG\TINYNVM.c"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\TINYNVM.h"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XMEGANVM.c"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XMEGANVM.h"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XPROGProtocol.c"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XPROGProtocol.h"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XPROGTarget.c"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XPROGTarget.h"></File></Folder><File path="Projects\AVRISP-MKII\Lib\V2Protocol.c"></File><File path="Projects\AVRISP-MKII\Lib\V2Protocol.h"></File><File path="Projects\AVRISP-MKII\Lib\V2ProtocolConstants.h"></File><File path="Projects\AVRISP-MKII\Lib\V2ProtocolParams.c"></File><File path="Projects\AVRISP-MKII\Lib\V2ProtocolParams.h"></File></Folder><File path="Projects\AVRISP-MKII\AVRISP.c"></File><File path="Projects\AVRISP-MKII\AVRISP.h"></File><File path="Projects\AVRISP-MKII\AVRISP.txt"></File><File path="Projects\AVRISP-MKII\Descriptors.c"></File><File path="Projects\AVRISP-MKII\Descriptors.h"></File><File path="Projects\AVRISP-MKII\Doxygen.conf"></File><File path="Projects\AVRISP-MKII\makefile"></File></Folder><Folder name="Benito"><Folder name="Board"><File path="Projects\Benito\Board\LEDs.h"></File></Folder><Folder name="Lib"><File path="Projects\Benito\Lib\RingBuff.c"></File><File path="Projects\Benito\Lib\RingBuff.h"></File></Folder><File path="Projects\Benito\Benito.c"></File><File path="Projects\Benito\Benito.h"></File><File path="Projects\Benito\Descriptors.c"></File><File path="Projects\Benito\Descriptors.h"></File><File path="Projects\Benito\Doxygen.conf"></File><File path="Projects\Benito\makefile"></File><File path="Projects\Benito\Benito.txt"></File><File path="Projects\Benito\Benito Programmer.inf"></File></Folder><Folder name="LEDNotifier"><Folder name="Board"><File path="Projects\LEDNotifier\Board\LEDs.h"></File></Folder><Folder name="CPUUsageApp"><File path="Projects\LEDNotifier\CPUUsageApp\CPUMonitor.cs"></File><File path="Projects\LEDNotifier\CPUUsageApp\CPUMonitor.csproj"></File><File path="Projects\LEDNotifier\CPUUsageApp\CPUMonitor.Designer.cs"></File><File path="Projects\LEDNotifier\CPUUsageApp\CPUMonitor.resx"></File><File path="Projects\LEDNotifier\CPUUsageApp\Program.cs"></File></Folder><Folder name="HotmailNotifierApp"><File path="Projects\LEDNotifier\HotmailNotifierApp\MailNotifier.cs"></File><File path="Projects\LEDNotifier\HotmailNotifierApp\MailNotifier.csproj"></File><File path="Projects\LEDNotifier\HotmailNotifierApp\MailNotifier.Designer.cs"></File><File path="Projects\LEDNotifier\HotmailNotifierApp\MailNotifier.resx"></File><File path="Projects\LEDNotifier\HotmailNotifierApp\Program.cs"></File></Folder><Folder name="LEDMixerApp"><File path="Projects\LEDNotifier\LEDMixerApp\LEDMixer.cs"></File><File path="Projects\LEDNotifier\LEDMixerApp\LEDMixer.csproj"></File><File path="Projects\LEDNotifier\LEDMixerApp\LEDMixer.Designer.cs"></File><File path="Projects\LEDNotifier\LEDMixerApp\LEDMixer.resx"></File><File path="Projects\LEDNotifier\LEDMixerApp\Program.cs"></File></Folder><File path="Projects\LEDNotifier\Descriptors.c"></File><File path="Projects\LEDNotifier\Descriptors.h"></File><File path="Projects\LEDNotifier\Doxygen.conf"></File><File path="Projects\LEDNotifier\LEDNotifier.c"></File><File path="Projects\LEDNotifier\LEDNotifier.h"></File><File path="Projects\LEDNotifier\LEDNotifier.txt"></File><File path="Projects\LEDNotifier\LUFA LED Notifier.inf"></File><File path="Projects\LEDNotifier\makefile"></File></Folder><Folder name="MagStripe"><Folder name="Lib"><File path="Projects\Magstripe\Lib\CircularBitBuffer.c"></File><File path="Projects\Magstripe\Lib\CircularBitBuffer.h"></File><File path="Projects\Magstripe\Lib\MagstripeHW.h"></File></Folder><File path="Projects\Magstripe\Descriptors.c"></File><File path="Projects\Magstripe\Descriptors.h"></File><File path="Projects\Magstripe\Magstripe.c"></File><File path="Projects\Magstripe\Magstripe.h"></File><File path="Projects\Magstripe\makefile"></File><File path="Projects\Magstripe\Magstripe.txt"></File><File path="Projects\Magstripe\Doxygen.conf"></File></Folder><Folder name="MissileLauncher"><File path="Projects\MissileLauncher\ConfigDescriptor.c"></File><File path="Projects\MissileLauncher\ConfigDescriptor.h"></File><File path="Projects\MissileLauncher\Doxygen.conf"></File><File path="Projects\MissileLauncher\makefile"></File><File path="Projects\MissileLauncher\MissileLauncher.c"></File><File path="Projects\MissileLauncher\MissileLauncher.h"></File><File path="Projects\MissileLauncher\MissileLauncher.txt"></File></Folder><Folder name="TemperatureDataLogger"><Folder name="Lib"><Folder name="FATFs"><File path="Projects\TemperatureDataLogger\Lib\FATFs\diskio.c"></File><File path="Projects\TemperatureDataLogger\Lib\FATFs\diskio.h"></File><File path="Projects\TemperatureDataLogger\Lib\FATFs\ff.c"></File><File path="Projects\TemperatureDataLogger\Lib\FATFs\ff.h"></File><File path="Projects\TemperatureDataLogger\Lib\FATFs\ffconf.h"></File><File path="Projects\TemperatureDataLogger\Lib\FATFs\integer.h"></File></Folder><File path="Projects\TemperatureDataLogger\Lib\DataflashManager.c"></File><File path="Projects\TemperatureDataLogger\Lib\DataflashManager.h"></File><File path="Projects\TemperatureDataLogger\Lib\SCSI.c"></File><File path="Projects\TemperatureDataLogger\Lib\SCSI.h"></File><File path="Projects\TemperatureDataLogger\Lib\DS1307.c"></File><File path="Projects\TemperatureDataLogger\Lib\DS1307.h"></File></Folder><Folder name="TempLogHostApp"><File path="Projects\TemperatureDataLogger\TempLogHostApp\DataLoggerSettings.cs"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\DataLoggerSettings.Designer.cs"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\DataLoggerSettings.resx"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\Hid.Linux.dll"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\Hid.Net.dll"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\Hid.Win32.dll"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\Program.cs"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\TempLoggerHostApp.csproj"></File></Folder><File path="Projects\TemperatureDataLogger\Descriptors.c"></File><File path="Projects\TemperatureDataLogger\Descriptors.h"></File><File path="Projects\TemperatureDataLogger\makefile"></File><File path="Projects\TemperatureDataLogger\TempDataLogger.c"></File><File path="Projects\TemperatureDataLogger\TempDataLogger.h"></File><File path="Projects\TemperatureDataLogger\TemperatureDataLogger.txt"></File><File path="Projects\TemperatureDataLogger\Doxygen.conf"></File></Folder><Folder name="USBtoSerial"><Folder name="Lib"><File path="Projects\USBtoSerial\Lib\RingBuff.c"></File><File path="Projects\USBtoSerial\Lib\RingBuff.h"></File></Folder><File path="Projects\USBtoSerial\Descriptors.c"></File><File path="Projects\USBtoSerial\Descriptors.h"></File><File path="Projects\USBtoSerial\Doxygen.conf"></File><File path="Projects\USBtoSerial\LUFA USBtoSerial.inf"></File><File path="Projects\USBtoSerial\makefile"></File><File path="Projects\USBtoSerial\USBtoSerial.c"></File><File path="Projects\USBtoSerial\USBtoSerial.h"></File><File path="Projects\USBtoSerial\USBtoSerial.txt"></File></Folder><Folder name="Webserver"><Folder name="Lib"><Folder name="uip"><Folder name="conf"><File path="Projects\Webserver\Lib\uip\conf\apps-conf.h"></File><File path="Projects\Webserver\Lib\uip\conf\clock-arch.c"></File><File path="Projects\Webserver\Lib\uip\conf\clock-arch.h"></File><File path="Projects\Webserver\Lib\uip\conf\global-conf.h"></File><File path="Projects\Webserver\Lib\uip\conf\uip-conf.h"></File></Folder><File path="Projects\Webserver\Lib\uip\clock.h"></File><File path="Projects\Webserver\Lib\uip\lc.h"></File><File path="Projects\Webserver\Lib\uip\lc-addrlabels.h"></File><File path="Projects\Webserver\Lib\uip\lc-switch.h"></File><File path="Projects\Webserver\Lib\uip\psock.c"></File><File path="Projects\Webserver\Lib\uip\psock.h"></File><File path="Projects\Webserver\Lib\uip\pt.h"></File><File path="Projects\Webserver\Lib\uip\timer.c"></File><File path="Projects\Webserver\Lib\uip\timer.h"></File><File path="Projects\Webserver\Lib\uip\uip.c"></File><File path="Projects\Webserver\Lib\uip\uip.h"></File><File path="Projects\Webserver\Lib\uip\uip_arch.h"></File><File path="Projects\Webserver\Lib\uip\uip_arp.c"></File><File path="Projects\Webserver\Lib\uip\uip_arp.h"></File><File path="Projects\Webserver\Lib\uip\uip-fw.c"></File><File path="Projects\Webserver\Lib\uip\uip-fw.h"></File><File path="Projects\Webserver\Lib\uip\uiplib.c"></File><File path="Projects\Webserver\Lib\uip\uiplib.h"></File><File path="Projects\Webserver\Lib\uip\uip-neighbor.c"></File><File path="Projects\Webserver\Lib\uip\uip-neighbor.h"></File><File path="Projects\Webserver\Lib\uip\uipopt.h"></File><File path="Projects\Webserver\Lib\uip\uip-split.c"></File><File path="Projects\Webserver\Lib\uip\uip-split.h"></File></Folder><File path="Projects\Webserver\Lib\WebserverApp.c"></File><File path="Projects\Webserver\Lib\WebserverApp.h"></File><File path="Projects\Webserver\Lib\DHCPApp.c"></File><File path="Projects\Webserver\Lib\DHCPApp.h"></File></Folder><File path="Projects\Webserver\makefile"></File><File path="Projects\Webserver\Webserver.c"></File><File path="Projects\Webserver\Webserver.h"></File><File path="Projects\Webserver\Doxygen.conf"></File><File path="Projects\Webserver\Webserver.txt"></File></Folder><Folder name="XPLAINBridge"><Folder name="Lib"><File path="Projects\XPLAINBridge\Lib\RingBuff.c"></File><File path="Projects\XPLAINBridge\Lib\RingBuff.h"></File><File path="Projects\XPLAINBridge\Lib\SoftUART.c"></File><File path="Projects\XPLAINBridge\Lib\SoftUART.h"></File></Folder><File path="Projects\XPLAINBridge\LUFA XPLAIN Bridge.inf"></File><File path="Projects\XPLAINBridge\makefile"></File><File path="Projects\XPLAINBridge\XPLAINBridge.c"></File><File path="Projects\XPLAINBridge\XPLAINBridge.h"></File><File path="Projects\XPLAINBridge\XPLAINBridge.txt"></File><File path="Projects\XPLAINBridge\USARTDescriptors.c"></File><File path="Projects\XPLAINBridge\USARTDescriptors.h"></File><File path="Projects\XPLAINBridge\AVRISPDescriptors.c"></File><File path="Projects\XPLAINBridge\AVRISPDescriptors.h"></File><File path="Projects\XPLAINBridge\Doxygen.conf"></File></Folder><Folder name="Incomplete"><Folder name="StandaloneProgrammer"><Folder name="Lib"><Folder name="PetiteFATFs"><File path="Projects\Incomplete\StandaloneProgrammer\Lib\PetiteFATFs\diskio.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\PetiteFATFs\diskio.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\PetiteFATFs\integer.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\PetiteFATFs\pff.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\PetiteFATFs\pff.h"></File></Folder><File path="Projects\Incomplete\StandaloneProgrammer\Lib\DataflashManager.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\DataflashManager.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\SCSI.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\SCSI.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\ProgrammerConfig.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\ProgrammerConfig.h"></File></Folder><File path="Projects\Incomplete\StandaloneProgrammer\Descriptors.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Descriptors.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\makefile"></File><File path="Projects\Incomplete\StandaloneProgrammer\StandaloneProgrammer.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\StandaloneProgrammer.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\DiskDevice.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\DiskDevice.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\DiskHost.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\DiskHost.h"></File></Folder></Folder><File path="Projects\makefile"></File></Folder><File path="makefile"></File><File path="README.txt"></File></Project>
\ No newline at end of file
+<Project name="LUFA"><Folder name="Demos"><Folder name="Device"><Folder name="ClassDriver"><Folder name="AudioInput"><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.c"></File><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.h"></File><File path="Demos\Device\ClassDriver\AudioInput\AudioInput.txt"></File><File path="Demos\Device\ClassDriver\AudioInput\Descriptors.c"></File><File path="Demos\Device\ClassDriver\AudioInput\Descriptors.h"></File><File path="Demos\Device\ClassDriver\AudioInput\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\AudioInput\makefile"></File></Folder><Folder name="AudioOutput"><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.c"></File><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.h"></File><File path="Demos\Device\ClassDriver\AudioOutput\AudioOutput.txt"></File><File path="Demos\Device\ClassDriver\AudioOutput\Descriptors.c"></File><File path="Demos\Device\ClassDriver\AudioOutput\Descriptors.h"></File><File path="Demos\Device\ClassDriver\AudioOutput\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\AudioOutput\makefile"></File></Folder><Folder name="DualVirtualSerial"><File path="Demos\Device\ClassDriver\DualVirtualSerial\Descriptors.c"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\Descriptors.h"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.c"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.h"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\DualVirtualSerial.txt"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\LUFA DualVirtualSerial.inf"></File><File path="Demos\Device\ClassDriver\DualVirtualSerial\makefile"></File></Folder><Folder name="GenericHID"><File path="Demos\Device\ClassDriver\GenericHID\Descriptors.c"></File><File path="Demos\Device\ClassDriver\GenericHID\Descriptors.h"></File><File path="Demos\Device\ClassDriver\GenericHID\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.c"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.h"></File><File path="Demos\Device\ClassDriver\GenericHID\GenericHID.txt"></File><File path="Demos\Device\ClassDriver\GenericHID\makefile"></File></Folder><Folder name="Joystick"><File path="Demos\Device\ClassDriver\Joystick\Descriptors.c"></File><File path="Demos\Device\ClassDriver\Joystick\Descriptors.h"></File><File path="Demos\Device\ClassDriver\Joystick\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.c"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.h"></File><File path="Demos\Device\ClassDriver\Joystick\Joystick.txt"></File><File path="Demos\Device\ClassDriver\Joystick\makefile"></File></Folder><Folder name="Keyboard"><File path="Demos\Device\ClassDriver\Keyboard\Descriptors.c"></File><File path="Demos\Device\ClassDriver\Keyboard\Descriptors.h"></File><File path="Demos\Device\ClassDriver\Keyboard\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.c"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.h"></File><File path="Demos\Device\ClassDriver\Keyboard\Keyboard.txt"></File><File path="Demos\Device\ClassDriver\Keyboard\makefile"></File></Folder><Folder name="KeyboardMouse"><File path="Demos\Device\ClassDriver\KeyboardMouse\Descriptors.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\Descriptors.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.c"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.h"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\KeyboardMouse.txt"></File><File path="Demos\Device\ClassDriver\KeyboardMouse\makefile"></File></Folder><Folder name="MassStorage"><Folder name="Lib"><File path="Demos\Device\ClassDriver\MassStorage\Lib\DataflashManager.c"></File><File path="Demos\Device\ClassDriver\MassStorage\Lib\DataflashManager.h"></File><File path="Demos\Device\ClassDriver\MassStorage\Lib\SCSI.c"></File><File path="Demos\Device\ClassDriver\MassStorage\Lib\SCSI.h"></File></Folder><File path="Demos\Device\ClassDriver\MassStorage\Descriptors.c"></File><File path="Demos\Device\ClassDriver\MassStorage\Descriptors.h"></File><File path="Demos\Device\ClassDriver\MassStorage\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\MassStorage\makefile"></File><File path="Demos\Device\ClassDriver\MassStorage\MassStorage.c"></File><File path="Demos\Device\ClassDriver\MassStorage\MassStorage.h"></File><File path="Demos\Device\ClassDriver\MassStorage\MassStorage.txt"></File></Folder><Folder name="MassStorageKeyboard"><Folder name="Lib"><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Lib\DataflashManager.c"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Lib\DataflashManager.h"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Lib\SCSI.c"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Lib\SCSI.h"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Lib\SCSI_Codes.h"></File></Folder><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Descriptors.c"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Descriptors.h"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\makefile"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\MassStorageKeyboard.c"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\MassStorageKeyboard.h"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\MassStorageKeyboard\MassStorageKeyboard.txt"></File></Folder><Folder name="MIDI"><File path="Demos\Device\ClassDriver\MIDI\Descriptors.c"></File><File path="Demos\Device\ClassDriver\MIDI\Descriptors.h"></File><File path="Demos\Device\ClassDriver\MIDI\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\MIDI\makefile"></File><File path="Demos\Device\ClassDriver\MIDI\MIDI.c"></File><File path="Demos\Device\ClassDriver\MIDI\MIDI.h"></File><File path="Demos\Device\ClassDriver\MIDI\MIDI.txt"></File></Folder><Folder name="Mouse"><File path="Demos\Device\ClassDriver\Mouse\Descriptors.c"></File><File path="Demos\Device\ClassDriver\Mouse\Descriptors.h"></File><File path="Demos\Device\ClassDriver\Mouse\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\Mouse\makefile"></File><File path="Demos\Device\ClassDriver\Mouse\Mouse.c"></File><File path="Demos\Device\ClassDriver\Mouse\Mouse.h"></File><File path="Demos\Device\ClassDriver\Mouse\Mouse.txt"></File></Folder><Folder name="RNDISEthernet"><Folder name="Lib"><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\Webserver.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ARP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ARP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\DHCP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\DHCP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\Ethernet.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\Ethernet.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\EthernetProtocols.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ICMP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ICMP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\IP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\IP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ProtocolDecoders.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\ProtocolDecoders.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\TCP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\TCP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\UDP.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\UDP.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Lib\Webserver.c"></File></Folder><File path="Demos\Device\ClassDriver\RNDISEthernet\Descriptors.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Descriptors.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\LUFA RNDIS.inf"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\makefile"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\RNDISEthernet.c"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\RNDISEthernet.h"></File><File path="Demos\Device\ClassDriver\RNDISEthernet\RNDISEthernet.txt"></File></Folder><Folder name="VirtualSerial"><File path="Demos\Device\ClassDriver\VirtualSerial\Descriptors.c"></File><File path="Demos\Device\ClassDriver\VirtualSerial\Descriptors.h"></File><File path="Demos\Device\ClassDriver\VirtualSerial\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\VirtualSerial\LUFA VirtualSerial.inf"></File><File path="Demos\Device\ClassDriver\VirtualSerial\makefile"></File><File path="Demos\Device\ClassDriver\VirtualSerial\VirtualSerial.c"></File><File path="Demos\Device\ClassDriver\VirtualSerial\VirtualSerial.h"></File><File path="Demos\Device\ClassDriver\VirtualSerial\VirtualSerial.txt"></File></Folder><Folder name="VirtualSerialMouse"><File path="Demos\Device\ClassDriver\VirtualSerialMouse\Descriptors.c"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\Descriptors.h"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\Doxygen.conf"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\LUFA VirtualSerialMouse.inf"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\makefile"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\VirtualSerialMouse.c"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\VirtualSerialMouse.h"></File><File path="Demos\Device\ClassDriver\VirtualSerialMouse\VirtualSerialMouse.txt"></File></Folder><File path="Demos\Device\ClassDriver\makefile"></File></Folder><Folder name="LowLevel"><Folder name="AudioInput"><File path="Demos\Device\LowLevel\AudioInput\AudioInput.c"></File><File path="Demos\Device\LowLevel\AudioInput\AudioInput.h"></File><File path="Demos\Device\LowLevel\AudioInput\AudioInput.txt"></File><File path="Demos\Device\LowLevel\AudioInput\Descriptors.c"></File><File path="Demos\Device\LowLevel\AudioInput\Descriptors.h"></File><File path="Demos\Device\LowLevel\AudioInput\Doxygen.conf"></File><File path="Demos\Device\LowLevel\AudioInput\makefile"></File></Folder><Folder name="AudioOutput"><File path="Demos\Device\LowLevel\AudioOutput\AudioOutput.c"></File><File path="Demos\Device\LowLevel\AudioOutput\AudioOutput.h"></File><File path="Demos\Device\LowLevel\AudioOutput\AudioOutput.txt"></File><File path="Demos\Device\LowLevel\AudioOutput\Descriptors.c"></File><File path="Demos\Device\LowLevel\AudioOutput\Descriptors.h"></File><File path="Demos\Device\LowLevel\AudioOutput\Doxygen.conf"></File><File path="Demos\Device\LowLevel\AudioOutput\makefile"></File></Folder><Folder name="DualVirtualSerial"><File path="Demos\Device\LowLevel\DualVirtualSerial\Descriptors.c"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\Descriptors.h"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\Doxygen.conf"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\DualVirtualSerial.c"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\DualVirtualSerial.h"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\DualVirtualSerial.txt"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\LUFA DualVirtualSerial.inf"></File><File path="Demos\Device\LowLevel\DualVirtualSerial\makefile"></File></Folder><Folder name="GenericHID"><File path="Demos\Device\LowLevel\GenericHID\Descriptors.c"></File><File path="Demos\Device\LowLevel\GenericHID\Descriptors.h"></File><File path="Demos\Device\LowLevel\GenericHID\Doxygen.conf"></File><File path="Demos\Device\LowLevel\GenericHID\GenericHID.c"></File><File path="Demos\Device\LowLevel\GenericHID\GenericHID.h"></File><File path="Demos\Device\LowLevel\GenericHID\GenericHID.txt"></File><File path="Demos\Device\LowLevel\GenericHID\makefile"></File></Folder><Folder name="Joystick"><File path="Demos\Device\LowLevel\Joystick\Descriptors.c"></File><File path="Demos\Device\LowLevel\Joystick\Descriptors.h"></File><File path="Demos\Device\LowLevel\Joystick\Doxygen.conf"></File><File path="Demos\Device\LowLevel\Joystick\Joystick.c"></File><File path="Demos\Device\LowLevel\Joystick\Joystick.h"></File><File path="Demos\Device\LowLevel\Joystick\Joystick.txt"></File><File path="Demos\Device\LowLevel\Joystick\makefile"></File></Folder><Folder name="Keyboard"><File path="Demos\Device\LowLevel\Keyboard\Descriptors.c"></File><File path="Demos\Device\LowLevel\Keyboard\Descriptors.h"></File><File path="Demos\Device\LowLevel\Keyboard\Doxygen.conf"></File><File path="Demos\Device\LowLevel\Keyboard\Keyboard.c"></File><File path="Demos\Device\LowLevel\Keyboard\Keyboard.h"></File><File path="Demos\Device\LowLevel\Keyboard\Keyboard.txt"></File><File path="Demos\Device\LowLevel\Keyboard\makefile"></File></Folder><Folder name="KeyboardMouse"><File path="Demos\Device\LowLevel\KeyboardMouse\Descriptors.c"></File><File path="Demos\Device\LowLevel\KeyboardMouse\Descriptors.h"></File><File path="Demos\Device\LowLevel\KeyboardMouse\Doxygen.conf"></File><File path="Demos\Device\LowLevel\KeyboardMouse\KeyboardMouse.c"></File><File path="Demos\Device\LowLevel\KeyboardMouse\KeyboardMouse.h"></File><File path="Demos\Device\LowLevel\KeyboardMouse\KeyboardMouse.txt"></File><File path="Demos\Device\LowLevel\KeyboardMouse\makefile"></File></Folder><Folder name="MassStorage"><Folder name="Lib"><File path="Demos\Device\LowLevel\MassStorage\Lib\DataflashManager.c"></File><File path="Demos\Device\LowLevel\MassStorage\Lib\DataflashManager.h"></File><File path="Demos\Device\LowLevel\MassStorage\Lib\SCSI.c"></File><File path="Demos\Device\LowLevel\MassStorage\Lib\SCSI.h"></File><File path="Demos\Device\LowLevel\MassStorage\Lib\SCSI_Codes.h"></File></Folder><File path="Demos\Device\LowLevel\MassStorage\Descriptors.c"></File><File path="Demos\Device\LowLevel\MassStorage\Descriptors.h"></File><File path="Demos\Device\LowLevel\MassStorage\Doxygen.conf"></File><File path="Demos\Device\LowLevel\MassStorage\makefile"></File><File path="Demos\Device\LowLevel\MassStorage\MassStorage.c"></File><File path="Demos\Device\LowLevel\MassStorage\MassStorage.h"></File><File path="Demos\Device\LowLevel\MassStorage\MassStorage.txt"></File></Folder><Folder name="MIDI"><File path="Demos\Device\LowLevel\MIDI\Descriptors.c"></File><File path="Demos\Device\LowLevel\MIDI\Descriptors.h"></File><File path="Demos\Device\LowLevel\MIDI\Doxygen.conf"></File><File path="Demos\Device\LowLevel\MIDI\makefile"></File><File path="Demos\Device\LowLevel\MIDI\MIDI.c"></File><File path="Demos\Device\LowLevel\MIDI\MIDI.h"></File><File path="Demos\Device\LowLevel\MIDI\MIDI.txt"></File></Folder><Folder name="Mouse"><File path="Demos\Device\LowLevel\Mouse\Descriptors.c"></File><File path="Demos\Device\LowLevel\Mouse\Descriptors.h"></File><File path="Demos\Device\LowLevel\Mouse\Doxygen.conf"></File><File path="Demos\Device\LowLevel\Mouse\makefile"></File><File path="Demos\Device\LowLevel\Mouse\Mouse.c"></File><File path="Demos\Device\LowLevel\Mouse\Mouse.h"></File><File path="Demos\Device\LowLevel\Mouse\Mouse.txt"></File></Folder><Folder name="RNDISEthernet"><Folder name="Lib"><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\Webserver.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ARP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ARP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\DHCP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\DHCP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\Ethernet.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\Ethernet.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\EthernetProtocols.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ICMP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ICMP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\IP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\IP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ProtocolDecoders.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\ProtocolDecoders.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\RNDIS.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\RNDIS.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\RNDISConstants.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\TCP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\TCP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\UDP.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\UDP.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Lib\Webserver.c"></File></Folder><File path="Demos\Device\LowLevel\RNDISEthernet\Descriptors.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Descriptors.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\Doxygen.conf"></File><File path="Demos\Device\LowLevel\RNDISEthernet\LUFA RNDIS.inf"></File><File path="Demos\Device\LowLevel\RNDISEthernet\makefile"></File><File path="Demos\Device\LowLevel\RNDISEthernet\RNDISEthernet.c"></File><File path="Demos\Device\LowLevel\RNDISEthernet\RNDISEthernet.h"></File><File path="Demos\Device\LowLevel\RNDISEthernet\RNDISEthernet.txt"></File></Folder><Folder name="VirtualSerial"><File path="Demos\Device\LowLevel\VirtualSerial\Descriptors.c"></File><File path="Demos\Device\LowLevel\VirtualSerial\Descriptors.h"></File><File path="Demos\Device\LowLevel\VirtualSerial\Doxygen.conf"></File><File path="Demos\Device\LowLevel\VirtualSerial\LUFA VirtualSerial.inf"></File><File path="Demos\Device\LowLevel\VirtualSerial\makefile"></File><File path="Demos\Device\LowLevel\VirtualSerial\VirtualSerial.c"></File><File path="Demos\Device\LowLevel\VirtualSerial\VirtualSerial.h"></File><File path="Demos\Device\LowLevel\VirtualSerial\VirtualSerial.txt"></File></Folder><File path="Demos\Device\LowLevel\makefile"></File></Folder><Folder name="Incomplete"><Folder name="SideShow"><Folder name="Lib"><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowApplications.c"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowApplications.h"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowCommands.c"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowCommands.h"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowCommon.c"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowCommon.h"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowContent.c"></File><File path="Demos\Device\Incomplete\Sideshow\Lib\SideshowContent.h"></File></Folder><File path="Demos\Device\Incomplete\Sideshow\Descriptors.c"></File><File path="Demos\Device\Incomplete\Sideshow\Descriptors.h"></File><File path="Demos\Device\Incomplete\Sideshow\makefile"></File><File path="Demos\Device\Incomplete\Sideshow\Sideshow.c"></File><File path="Demos\Device\Incomplete\Sideshow\Sideshow.h"></File></Folder></Folder><File path="Demos\Device\makefile"></File></Folder><Folder name="Host"><Folder name="ClassDriver"><Folder name="JoystickHostWithParser"><File path="Demos\Host\ClassDriver\JoystickHostWithParser\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\JoystickHostWithParser\JoystickHostWithParser.c"></File><File path="Demos\Host\ClassDriver\JoystickHostWithParser\JoystickHostWithParser.h"></File><File path="Demos\Host\ClassDriver\JoystickHostWithParser\JoystickHostWithParser.txt"></File><File path="Demos\Host\ClassDriver\JoystickHostWithParser\makefile"></File></Folder><Folder name="KeyboardHost"><File path="Demos\Host\ClassDriver\KeyboardHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\KeyboardHost\KeyboardHost.c"></File><File path="Demos\Host\ClassDriver\KeyboardHost\KeyboardHost.h"></File><File path="Demos\Host\ClassDriver\KeyboardHost\makefile"></File><File path="Demos\Host\ClassDriver\KeyboardHost\KeyboardHost.txt"></File></Folder><Folder name="KeyboardHostWithParser"><File path="Demos\Host\ClassDriver\KeyboardHostWithParser\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\KeyboardHostWithParser\KeyboardHostWithParser.c"></File><File path="Demos\Host\ClassDriver\KeyboardHostWithParser\KeyboardHostWithParser.h"></File><File path="Demos\Host\ClassDriver\KeyboardHostWithParser\makefile"></File><File path="Demos\Host\ClassDriver\KeyboardHostWithParser\KeyboardHostWithParser.txt"></File></Folder><Folder name="MIDIHost"><File path="Demos\Host\ClassDriver\MIDIHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\MIDIHost\makefile"></File><File path="Demos\Host\ClassDriver\MIDIHost\MIDIHost.c"></File><File path="Demos\Host\ClassDriver\MIDIHost\MIDIHost.h"></File><File path="Demos\Host\ClassDriver\MIDIHost\MIDIHost.txt"></File></Folder><Folder name="MouseHost"><File path="Demos\Host\ClassDriver\MouseHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\MouseHost\makefile"></File><File path="Demos\Host\ClassDriver\MouseHost\MouseHost.c"></File><File path="Demos\Host\ClassDriver\MouseHost\MouseHost.h"></File><File path="Demos\Host\ClassDriver\MouseHost\MouseHost.txt"></File></Folder><Folder name="MouseHostWithParser"><File path="Demos\Host\ClassDriver\MouseHostWithParser\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\MouseHostWithParser\makefile"></File><File path="Demos\Host\ClassDriver\MouseHostWithParser\MouseHostWithParser.txt"></File><File path="Demos\Host\ClassDriver\MouseHostWithParser\MouseHostWithParser.c"></File><File path="Demos\Host\ClassDriver\MouseHostWithParser\MouseHostWithParser.h"></File></Folder><Folder name="MassStorageHost"><File path="Demos\Host\ClassDriver\MassStorageHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\MassStorageHost\makefile"></File><File path="Demos\Host\ClassDriver\MassStorageHost\MassStorageHost.c"></File><File path="Demos\Host\ClassDriver\MassStorageHost\MassStorageHost.h"></File><File path="Demos\Host\ClassDriver\MassStorageHost\MassStorageHost.txt"></File></Folder><Folder name="PrinterHost"><File path="Demos\Host\ClassDriver\PrinterHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\PrinterHost\makefile"></File><File path="Demos\Host\ClassDriver\PrinterHost\PrinterHost.c"></File><File path="Demos\Host\ClassDriver\PrinterHost\PrinterHost.h"></File><File path="Demos\Host\ClassDriver\PrinterHost\PrinterHost.txt"></File></Folder><Folder name="RNDISEthernetHost"><File path="Demos\Host\ClassDriver\RNDISEthernetHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\RNDISEthernetHost\makefile"></File><File path="Demos\Host\ClassDriver\RNDISEthernetHost\RNDISEthernetHost.c"></File><File path="Demos\Host\ClassDriver\RNDISEthernetHost\RNDISEthernetHost.h"></File><File path="Demos\Host\ClassDriver\RNDISEthernetHost\RNDISEthernetHost.txt"></File></Folder><Folder name="StillImageHost"><File path="Demos\Host\ClassDriver\StillImageHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\StillImageHost\makefile"></File><File path="Demos\Host\ClassDriver\StillImageHost\StillImageHost.c"></File><File path="Demos\Host\ClassDriver\StillImageHost\StillImageHost.h"></File><File path="Demos\Host\ClassDriver\StillImageHost\StillImageHost.txt"></File></Folder><Folder name="VirtualSerialHost"><File path="Demos\Host\ClassDriver\VirtualSerialHost\Doxygen.conf"></File><File path="Demos\Host\ClassDriver\VirtualSerialHost\makefile"></File><File path="Demos\Host\ClassDriver\VirtualSerialHost\VirtualSerialHost.c"></File><File path="Demos\Host\ClassDriver\VirtualSerialHost\VirtualSerialHost.h"></File><File path="Demos\Host\ClassDriver\VirtualSerialHost\VirtualSerialHost.txt"></File></Folder><File path="Demos\Host\ClassDriver\makefile"></File></Folder><Folder name="LowLevel"><Folder name="GenericHIDHost"><File path="Demos\Host\LowLevel\GenericHIDHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\GenericHIDHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\GenericHIDHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\GenericHIDHost\GenericHIDHost.c"></File><File path="Demos\Host\LowLevel\GenericHIDHost\GenericHIDHost.h"></File><File path="Demos\Host\LowLevel\GenericHIDHost\GenericHIDHost.txt"></File><File path="Demos\Host\LowLevel\GenericHIDHost\makefile"></File></Folder><Folder name="JoystickHostWithParser"><File path="Demos\Host\LowLevel\JoystickHostWithParser\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\Doxygen.conf"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\HIDReport.c"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\HIDReport.h"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\JoystickHostWithParser.c"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\JoystickHostWithParser.h"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\JoystickHostWithParser.txt"></File><File path="Demos\Host\LowLevel\JoystickHostWithParser\makefile"></File></Folder><Folder name="KeyboardHost"><File path="Demos\Host\LowLevel\KeyboardHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\KeyboardHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\KeyboardHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\KeyboardHost\KeyboardHost.c"></File><File path="Demos\Host\LowLevel\KeyboardHost\KeyboardHost.h"></File><File path="Demos\Host\LowLevel\KeyboardHost\KeyboardHost.txt"></File><File path="Demos\Host\LowLevel\KeyboardHost\makefile"></File></Folder><Folder name="KeyboardHostWithParser"><File path="Demos\Host\LowLevel\KeyboardHostWithParser\makefile"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\Doxygen.conf"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\HIDReport.c"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\HIDReport.h"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\KeyboardHostWithParser.c"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\KeyboardHostWithParser.h"></File><File path="Demos\Host\LowLevel\KeyboardHostWithParser\KeyboardHostWithParser.txt"></File></Folder><Folder name="MassStorageHost"><Folder name="Lib"><File path="Demos\Host\LowLevel\MassStorageHost\Lib\MassStoreCommands.c"></File><File path="Demos\Host\LowLevel\MassStorageHost\Lib\MassStoreCommands.h"></File><File path="Demos\Host\LowLevel\MassStorageHost\Lib\SCSI_Codes.h"></File></Folder><File path="Demos\Host\LowLevel\MassStorageHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\MassStorageHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\MassStorageHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\MassStorageHost\makefile"></File><File path="Demos\Host\LowLevel\MassStorageHost\MassStorageHost.c"></File><File path="Demos\Host\LowLevel\MassStorageHost\MassStorageHost.h"></File><File path="Demos\Host\LowLevel\MassStorageHost\MassStorageHost.txt"></File></Folder><Folder name="MIDIHost"><File path="Demos\Host\LowLevel\MIDIHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\MIDIHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\MIDIHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\MIDIHost\makefile"></File><File path="Demos\Host\LowLevel\MIDIHost\MIDIHost.c"></File><File path="Demos\Host\LowLevel\MIDIHost\MIDIHost.h"></File><File path="Demos\Host\LowLevel\MIDIHost\MIDIHost.txt"></File></Folder><Folder name="MouseHost"><File path="Demos\Host\LowLevel\MouseHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\MouseHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\MouseHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\MouseHost\makefile"></File><File path="Demos\Host\LowLevel\MouseHost\MouseHost.c"></File><File path="Demos\Host\LowLevel\MouseHost\MouseHost.h"></File><File path="Demos\Host\LowLevel\MouseHost\MouseHost.txt"></File></Folder><Folder name="MouseHostWithParser"><File path="Demos\Host\LowLevel\MouseHostWithParser\MouseHostWithParser.txt"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\Doxygen.conf"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\HIDReport.c"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\HIDReport.h"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\makefile"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\MouseHostWithParser.c"></File><File path="Demos\Host\LowLevel\MouseHostWithParser\MouseHostWithParser.h"></File></Folder><Folder name="PrinterHost"><Folder name="Lib"><File path="Demos\Host\LowLevel\PrinterHost\Lib\PrinterCommands.c"></File><File path="Demos\Host\LowLevel\PrinterHost\Lib\PrinterCommands.h"></File></Folder><File path="Demos\Host\LowLevel\PrinterHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\PrinterHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\PrinterHost\makefile"></File><File path="Demos\Host\LowLevel\PrinterHost\PrinterHost.c"></File><File path="Demos\Host\LowLevel\PrinterHost\PrinterHost.h"></File><File path="Demos\Host\LowLevel\PrinterHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\PrinterHost\PrinterHost.txt"></File></Folder><Folder name="RNDISEthernetHost"><Folder name="Lib"><File path="Demos\Host\LowLevel\RNDISEthernetHost\Lib\RNDISCommands.c"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\Lib\RNDISCommands.h"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\Lib\RNDISConstants.h"></File></Folder><File path="Demos\Host\LowLevel\RNDISEthernetHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\makefile"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\RNDISEthernetHost.c"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\RNDISEthernetHost.h"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\RNDISEthernetHost\RNDISHost.txt"></File></Folder><Folder name="StillImageHost"><Folder name="Lib"><File path="Demos\Host\LowLevel\StillImageHost\Lib\PIMACodes.h"></File><File path="Demos\Host\LowLevel\StillImageHost\Lib\StillImageCommands.c"></File><File path="Demos\Host\LowLevel\StillImageHost\Lib\StillImageCommands.h"></File></Folder><File path="Demos\Host\LowLevel\StillImageHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\StillImageHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\StillImageHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\StillImageHost\makefile"></File><File path="Demos\Host\LowLevel\StillImageHost\StillImageHost.c"></File><File path="Demos\Host\LowLevel\StillImageHost\StillImageHost.h"></File><File path="Demos\Host\LowLevel\StillImageHost\StillImageHost.txt"></File></Folder><Folder name="VirtualSerialHost"><File path="Demos\Host\LowLevel\VirtualSerialHost\ConfigDescriptor.c"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\ConfigDescriptor.h"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\Doxygen.conf"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\makefile"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\VirtualSerialHost.c"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\VirtualSerialHost.h"></File><File path="Demos\Host\LowLevel\VirtualSerialHost\VirtualSerialHost.txt"></File></Folder><File path="Demos\Host\LowLevel\makefile"></File></Folder><Folder name="Incomplete"><Folder name="BluetoothHost"><Folder name="Lib"><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothACLPackets.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothACLPackets.h"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothClassCodes.h"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothHCICommands.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothHCICommands.h"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothStack.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\Lib\BluetoothStack.h"></File></Folder><File path="Demos\Host\Incomplete\BluetoothHost\makefile"></File><File path="Demos\Host\Incomplete\BluetoothHost\BluetoothHost.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\BluetoothHost.h"></File><File path="Demos\Host\Incomplete\BluetoothHost\ConfigDescriptor.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\ConfigDescriptor.h"></File><File path="Demos\Host\Incomplete\BluetoothHost\DeviceDescriptor.c"></File><File path="Demos\Host\Incomplete\BluetoothHost\DeviceDescriptor.h"></File></Folder></Folder><File path="Demos\Host\makefile"></File></Folder><Folder name="DualRole"><Folder name="ClassDriver"><Folder name="MouseHostDevice"><File path="Demos\DualRole\ClassDriver\MouseHostDevice\Doxygen.conf"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\makefile"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\MouseHostDevice.c"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\MouseHostDevice.h"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\Descriptors.c"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\Descriptors.h"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\DeviceFunctions.c"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\HostFunctions.c"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\HostFunctions.h"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\DeviceFunctions.h"></File><File path="Demos\DualRole\ClassDriver\MouseHostDevice\MouseHostDevice.txt"></File></Folder><File path="Demos\DualRole\ClassDriver\makefile"></File></Folder><File path="Demos\DualRole\makefile"></File></Folder><File path="Demos\makefile"></File></Folder><Folder name="LUFA"><Folder name="Common"><File path="LUFA\Common\Common.h"></File><File path="LUFA\Common\FunctionAttributes.h"></File><File path="LUFA\Common\BoardTypes.h"></File></Folder><Folder name="Drivers"><Folder name="USB"><Folder name="LowLevel"><Folder name="Template"><File path="LUFA\Drivers\USB\LowLevel\Template\Template_Endpoint_RW.c"></File><File path="LUFA\Drivers\USB\LowLevel\Template\Template_Endpoint_Control_R.c"></File><File path="LUFA\Drivers\USB\LowLevel\Template\Template_Endpoint_Control_W.c"></File><File path="LUFA\Drivers\USB\LowLevel\Template\Template_Pipe_RW.c"></File></Folder><File path="LUFA\Drivers\USB\LowLevel\HostChapter9.h"></File><File path="LUFA\Drivers\USB\LowLevel\LowLevel.c"></File><File path="LUFA\Drivers\USB\LowLevel\LowLevel.h"></File><File path="LUFA\Drivers\USB\LowLevel\Pipe.c"></File><File path="LUFA\Drivers\USB\LowLevel\Pipe.h"></File><File path="LUFA\Drivers\USB\LowLevel\DevChapter9.c"></File><File path="LUFA\Drivers\USB\LowLevel\DevChapter9.h"></File><File path="LUFA\Drivers\USB\LowLevel\Device.h"></File><File path="LUFA\Drivers\USB\LowLevel\Endpoint.c"></File><File path="LUFA\Drivers\USB\LowLevel\Endpoint.h"></File><File path="LUFA\Drivers\USB\LowLevel\Host.c"></File><File path="LUFA\Drivers\USB\LowLevel\Host.h"></File><File path="LUFA\Drivers\USB\LowLevel\HostChapter9.c"></File><File path="LUFA\Drivers\USB\LowLevel\OTG.h"></File></Folder><Folder name="HighLevel"><File path="LUFA\Drivers\USB\HighLevel\USBTask.h"></File><File path="LUFA\Drivers\USB\HighLevel\Events.c"></File><File path="LUFA\Drivers\USB\HighLevel\Events.h"></File><File path="LUFA\Drivers\USB\HighLevel\USBInterrupt.c"></File><File path="LUFA\Drivers\USB\HighLevel\USBInterrupt.h"></File><File path="LUFA\Drivers\USB\HighLevel\USBTask.c"></File><File path="LUFA\Drivers\USB\HighLevel\StdDescriptors.h"></File><File path="LUFA\Drivers\USB\HighLevel\StdRequestType.h"></File><File path="LUFA\Drivers\USB\HighLevel\StreamCallbacks.h"></File><File path="LUFA\Drivers\USB\HighLevel\USBMode.h"></File><File path="LUFA\Drivers\USB\HighLevel\ConfigDescriptor.c"></File><File path="LUFA\Drivers\USB\HighLevel\ConfigDescriptor.h"></File></Folder><Folder name="Class"><Folder name="Device"><File path="LUFA\Drivers\USB\Class\Device\HID.c"></File><File path="LUFA\Drivers\USB\Class\Device\HID.h"></File><File path="LUFA\Drivers\USB\Class\Device\CDC.c"></File><File path="LUFA\Drivers\USB\Class\Device\CDC.h"></File><File path="LUFA\Drivers\USB\Class\Device\RNDIS.c"></File><File path="LUFA\Drivers\USB\Class\Device\RNDIS.h"></File><File path="LUFA\Drivers\USB\Class\Device\MassStorage.c"></File><File path="LUFA\Drivers\USB\Class\Device\MassStorage.h"></File><File path="LUFA\Drivers\USB\Class\Device\Audio.c"></File><File path="LUFA\Drivers\USB\Class\Device\Audio.h"></File><File path="LUFA\Drivers\USB\Class\Device\MIDI.c"></File><File path="LUFA\Drivers\USB\Class\Device\MIDI.h"></File></Folder><Folder name="Host"><File path="LUFA\Drivers\USB\Class\Host\HIDParser.c"></File><File path="LUFA\Drivers\USB\Class\Host\HIDParser.h"></File><File path="LUFA\Drivers\USB\Class\Host\HIDReportData.h"></File><File path="LUFA\Drivers\USB\Class\Host\CDC.c"></File><File path="LUFA\Drivers\USB\Class\Host\CDC.h"></File><File path="LUFA\Drivers\USB\Class\Host\HID.c"></File><File path="LUFA\Drivers\USB\Class\Host\HID.h"></File><File path="LUFA\Drivers\USB\Class\Host\MassStorage.c"></File><File path="LUFA\Drivers\USB\Class\Host\MassStorage.h"></File><File path="LUFA\Drivers\USB\Class\Host\StillImage.c"></File><File path="LUFA\Drivers\USB\Class\Host\StillImage.h"></File><File path="LUFA\Drivers\USB\Class\Host\MIDI.c"></File><File path="LUFA\Drivers\USB\Class\Host\MIDI.h"></File><File path="LUFA\Drivers\USB\Class\Host\Printer.c"></File><File path="LUFA\Drivers\USB\Class\Host\Printer.h"></File><File path="LUFA\Drivers\USB\Class\Host\RNDIS.h"></File><File path="LUFA\Drivers\USB\Class\Host\RNDIS.c"></File></Folder><Folder name="Common"><File path="LUFA\Drivers\USB\Class\Common\Audio.h"></File><File path="LUFA\Drivers\USB\Class\Common\CDC.h"></File><File path="LUFA\Drivers\USB\Class\Common\HID.h"></File><File path="LUFA\Drivers\USB\Class\Common\MassStorage.h"></File><File path="LUFA\Drivers\USB\Class\Common\MIDI.h"></File><File path="LUFA\Drivers\USB\Class\Common\RNDIS.h"></File><File path="LUFA\Drivers\USB\Class\Common\StillImage.h"></File><File path="LUFA\Drivers\USB\Class\Common\Printer.h"></File><File path="LUFA\Drivers\USB\Class\Common\RNDISConstants.h"></File></Folder><File path="LUFA\Drivers\USB\Class\Audio.h"></File><File path="LUFA\Drivers\USB\Class\CDC.h"></File><File path="LUFA\Drivers\USB\Class\HID.h"></File><File path="LUFA\Drivers\USB\Class\MassStorage.h"></File><File path="LUFA\Drivers\USB\Class\MIDI.h"></File><File path="LUFA\Drivers\USB\Class\RNDIS.h"></File><File path="LUFA\Drivers\USB\Class\StillImage.h"></File><File path="LUFA\Drivers\USB\Class\Printer.h"></File></Folder><File path="LUFA\Drivers\USB\USB.h"></File></Folder><Folder name="Misc"><File path="LUFA\Drivers\Misc\TerminalCodes.h"></File></Folder><Folder name="Board"><Folder name="USBKEY"><File path="LUFA\Drivers\Board\USBKEY\Dataflash.h"></File><File path="LUFA\Drivers\Board\USBKEY\Joystick.h"></File><File path="LUFA\Drivers\Board\USBKEY\AT45DB642D.h"></File><File path="LUFA\Drivers\Board\USBKEY\LEDs.h"></File><File path="LUFA\Drivers\Board\USBKEY\Buttons.h"></File></Folder><Folder name="STK526"><File path="LUFA\Drivers\Board\STK526\Dataflash.h"></File><File path="LUFA\Drivers\Board\STK526\Joystick.h"></File><File path="LUFA\Drivers\Board\STK526\AT45DB642D.h"></File><File path="LUFA\Drivers\Board\STK526\LEDs.h"></File><File path="LUFA\Drivers\Board\STK526\Buttons.h"></File></Folder><Folder name="STK525"><File path="LUFA\Drivers\Board\STK525\Dataflash.h"></File><File path="LUFA\Drivers\Board\STK525\Joystick.h"></File><File path="LUFA\Drivers\Board\STK525\AT45DB321C.h"></File><File path="LUFA\Drivers\Board\STK525\LEDs.h"></File><File path="LUFA\Drivers\Board\STK525\Buttons.h"></File></Folder><Folder name="RZUSBSTICK"><File path="LUFA\Drivers\Board\RZUSBSTICK\LEDs.h"></File></Folder><Folder name="ATAVRUSBRF01"><File path="LUFA\Drivers\Board\ATAVRUSBRF01\LEDs.h"></File><File path="LUFA\Drivers\Board\ATAVRUSBRF01\Buttons.h"></File></Folder><Folder name="BUMBLEB"><File path="LUFA\Drivers\Board\BUMBLEB\Buttons.h"></File><File path="LUFA\Drivers\Board\BUMBLEB\Joystick.h"></File><File path="LUFA\Drivers\Board\BUMBLEB\LEDs.h"></File></Folder><Folder name="XPLAIN"><File path="LUFA\Drivers\Board\XPLAIN\LEDs.h"></File><File path="LUFA\Drivers\Board\XPLAIN\AT45DB642D.h"></File><File path="LUFA\Drivers\Board\XPLAIN\Dataflash.h"></File></Folder><Folder name="EVK527"><File path="LUFA\Drivers\Board\EVK527\Buttons.h"></File><File path="LUFA\Drivers\Board\EVK527\LEDs.h"></File><File path="LUFA\Drivers\Board\EVK527\Joystick.h"></File><File path="LUFA\Drivers\Board\EVK527\AT45DB321C.h"></File><File path="LUFA\Drivers\Board\EVK527\Dataflash.h"></File></Folder><File path="LUFA\Drivers\Board\Temperature.h"></File><File path="LUFA\Drivers\Board\Dataflash.h"></File><File path="LUFA\Drivers\Board\Joystick.h"></File><File path="LUFA\Drivers\Board\Temperature.c"></File><File path="LUFA\Drivers\Board\LEDs.h"></File><File path="LUFA\Drivers\Board\Buttons.h"></File></Folder><Folder name="Peripheral"><Folder name="AVRU4U6U7"><File path="LUFA\Drivers\Peripheral\AVRU4U6U7\ADC.h"></File><File path="LUFA\Drivers\Peripheral\AVRU4U6U7\TWI.h"></File></Folder><File path="LUFA\Drivers\Peripheral\ADC.h"></File><File path="LUFA\Drivers\Peripheral\Serial.c"></File><File path="LUFA\Drivers\Peripheral\Serial.h"></File><File path="LUFA\Drivers\Peripheral\SPI.h"></File><File path="LUFA\Drivers\Peripheral\SerialStream.c"></File><File path="LUFA\Drivers\Peripheral\SerialStream.h"></File><File path="LUFA\Drivers\Peripheral\TWI.h"></File><File path="LUFA\Drivers\Peripheral\TWI.c"></File></Folder></Folder><Folder name="DriverStubs"><File path="LUFA\DriverStubs\Dataflash.h"></File><File path="LUFA\DriverStubs\Joystick.h"></File><File path="LUFA\DriverStubs\LEDs.h"></File><File path="LUFA\DriverStubs\Buttons.h"></File></Folder><Folder name="ManPages"><File path="LUFA\ManPages\AboutLUFA.txt"></File><File path="LUFA\ManPages\BuildingLinkableLibraries.txt"></File><File path="LUFA\ManPages\ChangeLog.txt"></File><File path="LUFA\ManPages\CompileTimeTokens.txt"></File><File path="LUFA\ManPages\DevelopingWithLUFA.txt"></File><File path="LUFA\ManPages\DeviceSupport.txt"></File><File path="LUFA\ManPages\DirectorySummaries.txt"></File><File path="LUFA\ManPages\Donating.txt"></File><File path="LUFA\ManPages\FutureChanges.txt"></File><File path="LUFA\ManPages\GettingStarted.txt"></File><File path="LUFA\ManPages\Groups.txt"></File><File path="LUFA\ManPages\LibraryResources.txt"></File><File path="LUFA\ManPages\LUFAPoweredProjects.txt"></File><File path="LUFA\ManPages\MainPage.txt"></File><File path="LUFA\ManPages\MigrationInformation.txt"></File><File path="LUFA\ManPages\VIDAndPIDValues.txt"></File><File path="LUFA\ManPages\WritingBoardDrivers.txt"></File><File path="LUFA\ManPages\ConfiguringApps.txt"></File><File path="LUFA\ManPages\CompilingApps.txt"></File><File path="LUFA\ManPages\ProgrammingApps.txt"></File><File path="LUFA\ManPages\LibraryApps.txt"></File><File path="LUFA\ManPages\Licence.txt"></File><File path="LUFA\ManPages\WhyUseLUFA.txt"></File><File path="LUFA\ManPages\LUFAvsAtmelStack.txt"></File><File path="LUFA\ManPages\AlternativeStacks.txt"></File></Folder><Folder name="Scheduler"><File path="LUFA\Scheduler\Scheduler.c"></File><File path="LUFA\Scheduler\Scheduler.h"></File></Folder><File path="LUFA\makefile"></File><File path="LUFA\Version.h"></File><File path="LUFA\Doxygen.conf"></File></Folder><Folder name="Bootloaders"><Folder name="DFU"><File path="Bootloaders\DFU\BootloaderDFU.c"></File><File path="Bootloaders\DFU\BootloaderDFU.h"></File><File path="Bootloaders\DFU\Descriptors.c"></File><File path="Bootloaders\DFU\Descriptors.h"></File><File path="Bootloaders\DFU\makefile"></File><File path="Bootloaders\DFU\BootloaderDFU.txt"></File><File path="Bootloaders\DFU\Doxygen.conf"></File></Folder><Folder name="CDC"><File path="Bootloaders\CDC\BootloaderCDC.c"></File><File path="Bootloaders\CDC\BootloaderCDC.h"></File><File path="Bootloaders\CDC\Descriptors.c"></File><File path="Bootloaders\CDC\Descriptors.h"></File><File path="Bootloaders\CDC\makefile"></File><File path="Bootloaders\CDC\LUFA CDC Bootloader.inf"></File><File path="Bootloaders\CDC\Doxygen.conf"></File><File path="Bootloaders\CDC\BootloaderCDC.txt"></File></Folder><Folder name="TeensyHID"><File path="Bootloaders\TeensyHID\Descriptors.c"></File><File path="Bootloaders\TeensyHID\Descriptors.h"></File><File path="Bootloaders\TeensyHID\makefile"></File><File path="Bootloaders\TeensyHID\TeensyHID.c"></File><File path="Bootloaders\TeensyHID\TeensyHID.h"></File><File path="Bootloaders\TeensyHID\TeensyHID.txt"></File></Folder><Folder name="Incomplete"><Folder name="MIDI"><Folder name="JavaHost"><File path="Bootloaders\Incomplete\MIDI\JavaHost\BIN2BOOT.java"></File><File path="Bootloaders\Incomplete\MIDI\JavaHost\MIDIMessageReceiver.java"></File></Folder><File path="Bootloaders\Incomplete\MIDI\BootloaderMIDI.c"></File><File path="Bootloaders\Incomplete\MIDI\BootloaderMIDI.h"></File><File path="Bootloaders\Incomplete\MIDI\Descriptors.c"></File><File path="Bootloaders\Incomplete\MIDI\Descriptors.h"></File><File path="Bootloaders\Incomplete\MIDI\Doxygen.conf"></File><File path="Bootloaders\Incomplete\MIDI\makefile"></File><File path="Bootloaders\Incomplete\MIDI\MIDI.c"></File></Folder></Folder><File path="Bootloaders\makefile"></File></Folder><Folder name="Projects"><Folder name="AVRISP-MKII"><Folder name="Lib"><Folder name="ISP"><File path="Projects\AVRISP-MKII\Lib\ISP\ISPProtocol.c"></File><File path="Projects\AVRISP-MKII\Lib\ISP\ISPProtocol.h"></File><File path="Projects\AVRISP-MKII\Lib\ISP\ISPTarget.c"></File><File path="Projects\AVRISP-MKII\Lib\ISP\ISPTarget.h"></File></Folder><Folder name="XPROG"><File path="Projects\AVRISP-MKII\Lib\XPROG\TINYNVM.c"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\TINYNVM.h"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XMEGANVM.c"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XMEGANVM.h"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XPROGProtocol.c"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XPROGProtocol.h"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XPROGTarget.c"></File><File path="Projects\AVRISP-MKII\Lib\XPROG\XPROGTarget.h"></File></Folder><File path="Projects\AVRISP-MKII\Lib\V2Protocol.c"></File><File path="Projects\AVRISP-MKII\Lib\V2Protocol.h"></File><File path="Projects\AVRISP-MKII\Lib\V2ProtocolConstants.h"></File><File path="Projects\AVRISP-MKII\Lib\V2ProtocolParams.c"></File><File path="Projects\AVRISP-MKII\Lib\V2ProtocolParams.h"></File></Folder><File path="Projects\AVRISP-MKII\AVRISP.c"></File><File path="Projects\AVRISP-MKII\AVRISP.h"></File><File path="Projects\AVRISP-MKII\AVRISP.txt"></File><File path="Projects\AVRISP-MKII\Descriptors.c"></File><File path="Projects\AVRISP-MKII\Descriptors.h"></File><File path="Projects\AVRISP-MKII\Doxygen.conf"></File><File path="Projects\AVRISP-MKII\makefile"></File></Folder><Folder name="Benito"><Folder name="Board"><File path="Projects\Benito\Board\LEDs.h"></File></Folder><Folder name="Lib"><File path="Projects\Benito\Lib\RingBuff.c"></File><File path="Projects\Benito\Lib\RingBuff.h"></File></Folder><File path="Projects\Benito\Benito.c"></File><File path="Projects\Benito\Benito.h"></File><File path="Projects\Benito\Descriptors.c"></File><File path="Projects\Benito\Descriptors.h"></File><File path="Projects\Benito\Doxygen.conf"></File><File path="Projects\Benito\makefile"></File><File path="Projects\Benito\Benito.txt"></File><File path="Projects\Benito\Benito Programmer.inf"></File></Folder><Folder name="LEDNotifier"><Folder name="Board"><File path="Projects\LEDNotifier\Board\LEDs.h"></File></Folder><Folder name="CPUUsageApp"><File path="Projects\LEDNotifier\CPUUsageApp\CPUMonitor.cs"></File><File path="Projects\LEDNotifier\CPUUsageApp\CPUMonitor.csproj"></File><File path="Projects\LEDNotifier\CPUUsageApp\CPUMonitor.Designer.cs"></File><File path="Projects\LEDNotifier\CPUUsageApp\CPUMonitor.resx"></File><File path="Projects\LEDNotifier\CPUUsageApp\Program.cs"></File></Folder><Folder name="HotmailNotifierApp"><File path="Projects\LEDNotifier\HotmailNotifierApp\MailNotifier.cs"></File><File path="Projects\LEDNotifier\HotmailNotifierApp\MailNotifier.csproj"></File><File path="Projects\LEDNotifier\HotmailNotifierApp\MailNotifier.Designer.cs"></File><File path="Projects\LEDNotifier\HotmailNotifierApp\MailNotifier.resx"></File><File path="Projects\LEDNotifier\HotmailNotifierApp\Program.cs"></File></Folder><Folder name="LEDMixerApp"><File path="Projects\LEDNotifier\LEDMixerApp\LEDMixer.cs"></File><File path="Projects\LEDNotifier\LEDMixerApp\LEDMixer.csproj"></File><File path="Projects\LEDNotifier\LEDMixerApp\LEDMixer.Designer.cs"></File><File path="Projects\LEDNotifier\LEDMixerApp\LEDMixer.resx"></File><File path="Projects\LEDNotifier\LEDMixerApp\Program.cs"></File></Folder><File path="Projects\LEDNotifier\Descriptors.c"></File><File path="Projects\LEDNotifier\Descriptors.h"></File><File path="Projects\LEDNotifier\Doxygen.conf"></File><File path="Projects\LEDNotifier\LEDNotifier.c"></File><File path="Projects\LEDNotifier\LEDNotifier.h"></File><File path="Projects\LEDNotifier\LEDNotifier.txt"></File><File path="Projects\LEDNotifier\LUFA LED Notifier.inf"></File><File path="Projects\LEDNotifier\makefile"></File></Folder><Folder name="MagStripe"><Folder name="Lib"><File path="Projects\Magstripe\Lib\CircularBitBuffer.c"></File><File path="Projects\Magstripe\Lib\CircularBitBuffer.h"></File><File path="Projects\Magstripe\Lib\MagstripeHW.h"></File></Folder><File path="Projects\Magstripe\Descriptors.c"></File><File path="Projects\Magstripe\Descriptors.h"></File><File path="Projects\Magstripe\Magstripe.c"></File><File path="Projects\Magstripe\Magstripe.h"></File><File path="Projects\Magstripe\makefile"></File><File path="Projects\Magstripe\Magstripe.txt"></File><File path="Projects\Magstripe\Doxygen.conf"></File></Folder><Folder name="MissileLauncher"><File path="Projects\MissileLauncher\ConfigDescriptor.c"></File><File path="Projects\MissileLauncher\ConfigDescriptor.h"></File><File path="Projects\MissileLauncher\Doxygen.conf"></File><File path="Projects\MissileLauncher\makefile"></File><File path="Projects\MissileLauncher\MissileLauncher.c"></File><File path="Projects\MissileLauncher\MissileLauncher.h"></File><File path="Projects\MissileLauncher\MissileLauncher.txt"></File></Folder><Folder name="TemperatureDataLogger"><Folder name="Lib"><Folder name="FATFs"><File path="Projects\TemperatureDataLogger\Lib\FATFs\diskio.c"></File><File path="Projects\TemperatureDataLogger\Lib\FATFs\diskio.h"></File><File path="Projects\TemperatureDataLogger\Lib\FATFs\ff.c"></File><File path="Projects\TemperatureDataLogger\Lib\FATFs\ff.h"></File><File path="Projects\TemperatureDataLogger\Lib\FATFs\ffconf.h"></File><File path="Projects\TemperatureDataLogger\Lib\FATFs\integer.h"></File></Folder><File path="Projects\TemperatureDataLogger\Lib\DataflashManager.c"></File><File path="Projects\TemperatureDataLogger\Lib\DataflashManager.h"></File><File path="Projects\TemperatureDataLogger\Lib\SCSI.c"></File><File path="Projects\TemperatureDataLogger\Lib\SCSI.h"></File><File path="Projects\TemperatureDataLogger\Lib\DS1307.c"></File><File path="Projects\TemperatureDataLogger\Lib\DS1307.h"></File></Folder><Folder name="TempLogHostApp"><File path="Projects\TemperatureDataLogger\TempLogHostApp\DataLoggerSettings.cs"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\DataLoggerSettings.Designer.cs"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\DataLoggerSettings.resx"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\Hid.Linux.dll"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\Hid.Net.dll"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\Hid.Win32.dll"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\Program.cs"></File><File path="Projects\TemperatureDataLogger\TempLogHostApp\TempLoggerHostApp.csproj"></File></Folder><File path="Projects\TemperatureDataLogger\Descriptors.c"></File><File path="Projects\TemperatureDataLogger\Descriptors.h"></File><File path="Projects\TemperatureDataLogger\makefile"></File><File path="Projects\TemperatureDataLogger\TempDataLogger.c"></File><File path="Projects\TemperatureDataLogger\TempDataLogger.h"></File><File path="Projects\TemperatureDataLogger\TemperatureDataLogger.txt"></File><File path="Projects\TemperatureDataLogger\Doxygen.conf"></File></Folder><Folder name="USBtoSerial"><Folder name="Lib"><File path="Projects\USBtoSerial\Lib\RingBuff.c"></File><File path="Projects\USBtoSerial\Lib\RingBuff.h"></File></Folder><File path="Projects\USBtoSerial\Descriptors.c"></File><File path="Projects\USBtoSerial\Descriptors.h"></File><File path="Projects\USBtoSerial\Doxygen.conf"></File><File path="Projects\USBtoSerial\LUFA USBtoSerial.inf"></File><File path="Projects\USBtoSerial\makefile"></File><File path="Projects\USBtoSerial\USBtoSerial.c"></File><File path="Projects\USBtoSerial\USBtoSerial.h"></File><File path="Projects\USBtoSerial\USBtoSerial.txt"></File></Folder><Folder name="Webserver"><Folder name="Lib"><Folder name="uip"><Folder name="conf"><File path="Projects\Webserver\Lib\uip\conf\apps-conf.h"></File><File path="Projects\Webserver\Lib\uip\conf\clock-arch.c"></File><File path="Projects\Webserver\Lib\uip\conf\clock-arch.h"></File><File path="Projects\Webserver\Lib\uip\conf\global-conf.h"></File><File path="Projects\Webserver\Lib\uip\conf\uip-conf.h"></File></Folder><File path="Projects\Webserver\Lib\uip\clock.h"></File><File path="Projects\Webserver\Lib\uip\lc.h"></File><File path="Projects\Webserver\Lib\uip\lc-addrlabels.h"></File><File path="Projects\Webserver\Lib\uip\lc-switch.h"></File><File path="Projects\Webserver\Lib\uip\psock.c"></File><File path="Projects\Webserver\Lib\uip\psock.h"></File><File path="Projects\Webserver\Lib\uip\pt.h"></File><File path="Projects\Webserver\Lib\uip\timer.c"></File><File path="Projects\Webserver\Lib\uip\timer.h"></File><File path="Projects\Webserver\Lib\uip\uip.c"></File><File path="Projects\Webserver\Lib\uip\uip.h"></File><File path="Projects\Webserver\Lib\uip\uip_arch.h"></File><File path="Projects\Webserver\Lib\uip\uip_arp.c"></File><File path="Projects\Webserver\Lib\uip\uip_arp.h"></File><File path="Projects\Webserver\Lib\uip\uip-fw.c"></File><File path="Projects\Webserver\Lib\uip\uip-fw.h"></File><File path="Projects\Webserver\Lib\uip\uiplib.c"></File><File path="Projects\Webserver\Lib\uip\uiplib.h"></File><File path="Projects\Webserver\Lib\uip\uip-neighbor.c"></File><File path="Projects\Webserver\Lib\uip\uip-neighbor.h"></File><File path="Projects\Webserver\Lib\uip\uipopt.h"></File><File path="Projects\Webserver\Lib\uip\uip-split.c"></File><File path="Projects\Webserver\Lib\uip\uip-split.h"></File></Folder><Folder name="FatFS"><File path="Projects\Webserver\Lib\FATFs\diskio.c"></File><File path="Projects\Webserver\Lib\FATFs\diskio.h"></File><File path="Projects\Webserver\Lib\FATFs\ff.c"></File><File path="Projects\Webserver\Lib\FATFs\ff.h"></File><File path="Projects\Webserver\Lib\FATFs\ffconf.h"></File><File path="Projects\Webserver\Lib\FATFs\integer.h"></File></Folder><File path="Projects\Webserver\Lib\DHCPApp.c"></File><File path="Projects\Webserver\Lib\DHCPApp.h"></File><File path="Projects\Webserver\Lib\DataflashManager.c"></File><File path="Projects\Webserver\Lib\DataflashManager.h"></File><File path="Projects\Webserver\Lib\uIPManagement.c"></File><File path="Projects\Webserver\Lib\uIPManagement.h"></File><File path="Projects\Webserver\Lib\HTTPServerApp.c"></File><File path="Projects\Webserver\Lib\HTTPServerApp.h"></File><File path="Projects\Webserver\Lib\SCSI.c"></File><File path="Projects\Webserver\Lib\SCSI.h"></File></Folder><File path="Projects\Webserver\makefile"></File><File path="Projects\Webserver\Webserver.c"></File><File path="Projects\Webserver\Webserver.h"></File><File path="Projects\Webserver\Doxygen.conf"></File><File path="Projects\Webserver\Webserver.txt"></File><File path="Projects\Webserver\Descriptors.c"></File><File path="Projects\Webserver\Descriptors.h"></File><File path="Projects\Webserver\USBHostMode.c"></File><File path="Projects\Webserver\USBHostMode.h"></File><File path="Projects\Webserver\USBDeviceMode.c"></File><File path="Projects\Webserver\USBDeviceMode.h"></File></Folder><Folder name="XPLAINBridge"><Folder name="Lib"><File path="Projects\XPLAINBridge\Lib\RingBuff.c"></File><File path="Projects\XPLAINBridge\Lib\RingBuff.h"></File><File path="Projects\XPLAINBridge\Lib\SoftUART.c"></File><File path="Projects\XPLAINBridge\Lib\SoftUART.h"></File></Folder><File path="Projects\XPLAINBridge\LUFA XPLAIN Bridge.inf"></File><File path="Projects\XPLAINBridge\makefile"></File><File path="Projects\XPLAINBridge\XPLAINBridge.c"></File><File path="Projects\XPLAINBridge\XPLAINBridge.h"></File><File path="Projects\XPLAINBridge\XPLAINBridge.txt"></File><File path="Projects\XPLAINBridge\USARTDescriptors.c"></File><File path="Projects\XPLAINBridge\USARTDescriptors.h"></File><File path="Projects\XPLAINBridge\AVRISPDescriptors.c"></File><File path="Projects\XPLAINBridge\AVRISPDescriptors.h"></File><File path="Projects\XPLAINBridge\Doxygen.conf"></File></Folder><Folder name="Incomplete"><Folder name="StandaloneProgrammer"><Folder name="Lib"><Folder name="PetiteFATFs"><File path="Projects\Incomplete\StandaloneProgrammer\Lib\PetiteFATFs\diskio.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\PetiteFATFs\diskio.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\PetiteFATFs\integer.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\PetiteFATFs\pff.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\PetiteFATFs\pff.h"></File></Folder><File path="Projects\Incomplete\StandaloneProgrammer\Lib\DataflashManager.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\DataflashManager.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\SCSI.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\SCSI.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\ProgrammerConfig.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Lib\ProgrammerConfig.h"></File></Folder><File path="Projects\Incomplete\StandaloneProgrammer\Descriptors.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\Descriptors.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\makefile"></File><File path="Projects\Incomplete\StandaloneProgrammer\StandaloneProgrammer.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\StandaloneProgrammer.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\DiskDevice.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\DiskDevice.h"></File><File path="Projects\Incomplete\StandaloneProgrammer\DiskHost.c"></File><File path="Projects\Incomplete\StandaloneProgrammer\DiskHost.h"></File></Folder></Folder><File path="Projects\makefile"></File></Folder><File path="makefile"></File><File path="README.txt"></File></Project>
\ No newline at end of file
index 990156f..a3da35f 100644 (file)
@@ -128,9 +128,9 @@ SRC = $(TARGET).c                                                 \
          Descriptors.c                                               \\r
          Lib/DataflashManager.c                                      \\r
          Lib/SCSI.c                                                  \\r
          Descriptors.c                                               \\r
          Lib/DataflashManager.c                                      \\r
          Lib/SCSI.c                                                  \\r
+         Lib/DS1307.c                                                \\r
          Lib/FATFs/diskio.c                                          \\r
          Lib/FATFs/ff.c                                              \\r
          Lib/FATFs/diskio.c                                          \\r
          Lib/FATFs/ff.c                                              \\r
-         Lib/DS1307.c                                                \\r
          $(LUFA_PATH)/LUFA/Drivers/Board/Temperature.c               \\r
          $(LUFA_PATH)/LUFA/Drivers/Peripheral/TWI.c                  \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c        \\r
          $(LUFA_PATH)/LUFA/Drivers/Board/Temperature.c               \\r
          $(LUFA_PATH)/LUFA/Drivers/Peripheral/TWI.c                  \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c        \\r
diff --git a/Projects/Webserver/Descriptors.c b/Projects/Webserver/Descriptors.c
new file mode 100644 (file)
index 0000000..40ce620
--- /dev/null
@@ -0,0 +1,217 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  USB Device Descriptors, for library use when in USB device mode. Descriptors are special \r
+ *  computer-readable structures which the host requests upon device enumeration, to determine\r
+ *  the device's capabilities and functions.  \r
+ */\r
+\r
+#include "Descriptors.h"\r
+\r
+/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as\r
+ * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.\r
+ * This allows the host to track a device across insertions on different ports, allowing them to retain allocated\r
+ * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices\r
+ * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value\r
+ * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and\r
+ * port location).\r
+ */\r
+#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)\r
+       #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.\r
+#endif\r
+\r
+/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall\r
+ *  device characteristics, including the supported USB version, control endpoint size and the\r
+ *  number of device configurations. The descriptor is read out by the USB host when the enumeration\r
+ *  process begins.\r
+ */\r
+USB_Descriptor_Device_t PROGMEM DeviceDescriptor =\r
+{\r
+       .Header                 = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},\r
+               \r
+       .USBSpecification       = VERSION_BCD(01.10),\r
+       .Class                  = 0x00,\r
+       .SubClass               = 0x00,\r
+       .Protocol               = 0x00,\r
+                               \r
+       .Endpoint0Size          = FIXED_CONTROL_ENDPOINT_SIZE,\r
+               \r
+       .VendorID               = 0x03EB,\r
+       .ProductID              = 0x2045,\r
+       .ReleaseNumber          = 0x0000,\r
+               \r
+       .ManufacturerStrIndex   = 0x01,\r
+       .ProductStrIndex        = 0x02,\r
+       .SerialNumStrIndex      = USE_INTERNAL_SERIAL,\r
+               \r
+       .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS\r
+};\r
+\r
+/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage\r
+ *  of the device in one of its supported configurations, including information about any device interfaces\r
+ *  and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting\r
+ *  a configuration so that the host may correctly communicate with the USB device.\r
+ */\r
+USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =\r
+{\r
+       .Config = \r
+               {\r
+                       .Header                 = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},\r
+\r
+                       .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),\r
+                       .TotalInterfaces        = 1,\r
+                               \r
+                       .ConfigurationNumber    = 1,\r
+                       .ConfigurationStrIndex  = NO_DESCRIPTOR,\r
+                               \r
+                       .ConfigAttributes       = USB_CONFIG_ATTR_BUSPOWERED,\r
+                       \r
+                       .MaxPowerConsumption    = USB_CONFIG_POWER_MA(100)\r
+               },\r
+               \r
+       .Interface = \r
+               {\r
+                       .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},\r
+\r
+                       .InterfaceNumber        = 0,\r
+                       .AlternateSetting       = 0,\r
+                       \r
+                       .TotalEndpoints         = 2,\r
+                               \r
+                       .Class                  = 0x08,\r
+                       .SubClass               = 0x06,\r
+                       .Protocol               = 0x50,\r
+                               \r
+                       .InterfaceStrIndex      = NO_DESCRIPTOR\r
+               },\r
+\r
+       .DataInEndpoint = \r
+               {\r
+                       .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
+\r
+                       .EndpointAddress        = (ENDPOINT_DESCRIPTOR_DIR_IN | MASS_STORAGE_IN_EPNUM),\r
+                       .Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
+                       .EndpointSize           = MASS_STORAGE_IO_EPSIZE,\r
+                       .PollingIntervalMS      = 0x00\r
+               },\r
+\r
+       .DataOutEndpoint = \r
+               {\r
+                       .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
+\r
+                       .EndpointAddress        = (ENDPOINT_DESCRIPTOR_DIR_OUT | MASS_STORAGE_OUT_EPNUM),\r
+                       .Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
+                       .EndpointSize           = MASS_STORAGE_IO_EPSIZE,\r
+                       .PollingIntervalMS      = 0x00\r
+               }\r
+};\r
+\r
+/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests\r
+ *  the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate\r
+ *  via the language ID table available at USB.org what languages the device supports for its string descriptors.\r
+ */\r
+USB_Descriptor_String_t PROGMEM LanguageString =\r
+{\r
+       .Header                 = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},\r
+               \r
+       .UnicodeString          = {LANGUAGE_ID_ENG}\r
+};\r
+\r
+/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable\r
+ *  form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device\r
+ *  Descriptor.\r
+ */\r
+USB_Descriptor_String_t PROGMEM ManufacturerString =\r
+{\r
+       .Header                 = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},\r
+               \r
+       .UnicodeString          = L"Dean Camera"\r
+};\r
+\r
+/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,\r
+ *  and is read out upon request by the host when the appropriate string ID is requested, listed in the Device\r
+ *  Descriptor.\r
+ */\r
+USB_Descriptor_String_t PROGMEM ProductString =\r
+{\r
+       .Header                 = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},\r
+               \r
+       .UnicodeString          = L"LUFA Mass Storage Demo"\r
+};\r
+\r
+/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"\r
+ *  documentation) by the application code so that the address and size of a requested descriptor can be given\r
+ *  to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function\r
+ *  is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the\r
+ *  USB host.\r
+ */\r
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)\r
+{\r
+       const uint8_t  DescriptorType   = (wValue >> 8);\r
+       const uint8_t  DescriptorNumber = (wValue & 0xFF);\r
+\r
+       void*    Address = NULL;\r
+       uint16_t Size    = NO_DESCRIPTOR;\r
+\r
+       switch (DescriptorType)\r
+       {\r
+               case DTYPE_Device: \r
+                       Address = (void*)&DeviceDescriptor;\r
+                       Size    = sizeof(USB_Descriptor_Device_t);\r
+                       break;\r
+               case DTYPE_Configuration: \r
+                       Address = (void*)&ConfigurationDescriptor;\r
+                       Size    = sizeof(USB_Descriptor_Configuration_t);\r
+                       break;\r
+               case DTYPE_String: \r
+                       switch (DescriptorNumber)\r
+                       {\r
+                               case 0x00: \r
+                                       Address = (void*)&LanguageString;\r
+                                       Size    = pgm_read_byte(&LanguageString.Header.Size);\r
+                                       break;\r
+                               case 0x01: \r
+                                       Address = (void*)&ManufacturerString;\r
+                                       Size    = pgm_read_byte(&ManufacturerString.Header.Size);\r
+                                       break;\r
+                               case 0x02: \r
+                                       Address = (void*)&ProductString;\r
+                                       Size    = pgm_read_byte(&ProductString.Header.Size);\r
+                                       break;\r
+                       }\r
+                       \r
+                       break;\r
+       }\r
+       \r
+       *DescriptorAddress = Address;\r
+       return Size;\r
+}\r
diff --git a/Projects/Webserver/Descriptors.h b/Projects/Webserver/Descriptors.h
new file mode 100644 (file)
index 0000000..dcaadda
--- /dev/null
@@ -0,0 +1,72 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Header file for Descriptors.c.\r
+ */\r
\r
+#ifndef _DESCRIPTORS_H_\r
+#define _DESCRIPTORS_H_\r
+\r
+       /* Includes: */\r
+               #include <avr/pgmspace.h>\r
+\r
+               #include <LUFA/Drivers/USB/USB.h>\r
+               #include <LUFA/Drivers/USB/Class/MassStorage.h>\r
+\r
+       /* Macros: */\r
+               /** Endpoint number of the Mass Storage device-to-host data IN endpoint. */\r
+               #define MASS_STORAGE_IN_EPNUM          3        \r
+\r
+               /** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */\r
+               #define MASS_STORAGE_OUT_EPNUM         4        \r
+\r
+               /** Size in bytes of the Mass Storage data endpoints. */\r
+               #define MASS_STORAGE_IO_EPSIZE         64\r
+               \r
+       /* Type Defines: */             \r
+               /** Type define for the device configuration descriptor structure. This must be defined in the\r
+                *  application code, as the configuration descriptor contains several sub-descriptors which\r
+                *  vary between devices, and which describe the device's usage to the host.\r
+                */\r
+               typedef struct\r
+               {\r
+                       USB_Descriptor_Configuration_Header_t Config;\r
+                       USB_Descriptor_Interface_t            Interface;\r
+                       USB_Descriptor_Endpoint_t             DataInEndpoint;\r
+                       USB_Descriptor_Endpoint_t             DataOutEndpoint;\r
+               } USB_Descriptor_Configuration_t;\r
+               \r
+       /* Function Prototypes: */\r
+               uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)\r
+                                                                                       ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);\r
+\r
+#endif\r
diff --git a/Projects/Webserver/Lib/DataflashManager.c b/Projects/Webserver/Lib/DataflashManager.c
new file mode 100644 (file)
index 0000000..1de866e
--- /dev/null
@@ -0,0 +1,525 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Functions to manage the physical dataflash media, including reading and writing of\r
+ *  blocks of data. These functions are called by the SCSI layer when data must be stored\r
+ *  or retrieved to/from the physical storage media. If a different media is used (such\r
+ *  as a SD card or EEPROM), functions similar to these will need to be generated.\r
+ */\r
+\r
+#define  INCLUDE_FROM_DATAFLASHMANAGER_C\r
+#include "DataflashManager.h"\r
+\r
+/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from\r
+ *  the pre-selected data OUT endpoint. This routine reads in OS sized blocks from the endpoint and writes\r
+ *  them to the dataflash in Dataflash page sized blocks.\r
+ *\r
+ *  \param[in] MSInterfaceInfo  Pointer to a structure containing a Mass Storage Class configuration and state\r
+ *  \param[in] BlockAddress  Data block starting address for the write sequence\r
+ *  \param[in] TotalBlocks   Number of blocks of data to write\r
+ */\r
+void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)\r
+{\r
+       uint16_t CurrDFPage          = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);\r
+       uint16_t CurrDFPageByte      = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);\r
+       uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
+       bool     UsingSecondBuffer   = false;\r
+\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
+       Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)\r
+       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
+       Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);\r
+       Dataflash_SendAddressBytes(CurrDFPage, 0);\r
+       Dataflash_WaitWhileBusy();\r
+#endif\r
+\r
+       /* Send the dataflash buffer write command */\r
+       Dataflash_SendByte(DF_CMD_BUFF1WRITE);\r
+       Dataflash_SendAddressBytes(0, CurrDFPageByte);\r
+\r
+       /* Wait until endpoint is ready before continuing */\r
+       if (Endpoint_WaitUntilReady())\r
+         return;\r
+\r
+       while (TotalBlocks)\r
+       {\r
+               uint8_t BytesInBlockDiv16 = 0;\r
+               \r
+               /* Write an endpoint packet sized data block to the dataflash */\r
+               while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))\r
+               {\r
+                       /* Check if the endpoint is currently empty */\r
+                       if (!(Endpoint_IsReadWriteAllowed()))\r
+                       {\r
+                               /* Clear the current endpoint bank */\r
+                               Endpoint_ClearOUT();\r
+                               \r
+                               /* Wait until the host has sent another packet */\r
+                               if (Endpoint_WaitUntilReady())\r
+                                 return;\r
+                       }\r
+\r
+                       /* Check if end of dataflash page reached */\r
+                       if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))\r
+                       {\r
+                               /* Write the dataflash buffer contents back to the dataflash page */\r
+                               Dataflash_WaitWhileBusy();\r
+                               Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);\r
+                               Dataflash_SendAddressBytes(CurrDFPage, 0);\r
+\r
+                               /* Reset the dataflash buffer counter, increment the page counter */\r
+                               CurrDFPageByteDiv16 = 0;\r
+                               CurrDFPage++;\r
+\r
+                               /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */\r
+                               if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))\r
+                                 UsingSecondBuffer = !(UsingSecondBuffer);\r
+\r
+                               /* Select the next dataflash chip based on the new dataflash page index */\r
+                               Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)\r
+                               /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */\r
+                               if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))\r
+                               {\r
+                                       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
+                                       Dataflash_WaitWhileBusy();\r
+                                       Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);\r
+                                       Dataflash_SendAddressBytes(CurrDFPage, 0);\r
+                                       Dataflash_WaitWhileBusy();\r
+                               }\r
+#endif\r
+\r
+                               /* Send the dataflash buffer write command */\r
+                               Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);\r
+                               Dataflash_SendAddressBytes(0, 0);                               \r
+                       }\r
+\r
+                       /* Write one 16-byte chunk of data to the dataflash */\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       Dataflash_SendByte(Endpoint_Read_Byte());\r
+                       \r
+                       /* Increment the dataflash page 16 byte block counter */\r
+                       CurrDFPageByteDiv16++;\r
+\r
+                       /* Increment the block 16 byte block counter */\r
+                       BytesInBlockDiv16++;\r
+\r
+                       /* Check if the current command is being aborted by the host */\r
+                       if (MSInterfaceInfo->State.IsMassStoreReset)\r
+                         return;                       \r
+               }\r
+                       \r
+               /* Decrement the blocks remaining counter and reset the sub block counter */\r
+               TotalBlocks--;\r
+       }\r
+\r
+       /* Write the dataflash buffer contents back to the dataflash page */\r
+       Dataflash_WaitWhileBusy();\r
+       Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);\r
+       Dataflash_SendAddressBytes(CurrDFPage, 0x00);\r
+       Dataflash_WaitWhileBusy();\r
+\r
+       /* If the endpoint is empty, clear it ready for the next packet from the host */\r
+       if (!(Endpoint_IsReadWriteAllowed()))\r
+         Endpoint_ClearOUT();\r
+\r
+       /* Deselect all dataflash chips */\r
+       Dataflash_DeselectChip();\r
+}\r
+\r
+/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into\r
+ *  the pre-selected data IN endpoint. This routine reads in Dataflash page sized blocks from the Dataflash\r
+ *  and writes them in OS sized blocks to the endpoint.\r
+ *\r
+ *  \param[in] MSInterfaceInfo  Pointer to a structure containing a Mass Storage Class configuration and state\r
+ *  \param[in] BlockAddress  Data block starting address for the read sequence\r
+ *  \param[in] TotalBlocks   Number of blocks of data to read\r
+ */\r
+void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks)\r
+{\r
+       uint16_t CurrDFPage          = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);\r
+       uint16_t CurrDFPageByte      = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);\r
+       uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
+\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
+       Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
+       /* Send the dataflash main memory page read command */\r
+       Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);\r
+       Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);\r
+       Dataflash_SendByte(0x00);\r
+       Dataflash_SendByte(0x00);\r
+       Dataflash_SendByte(0x00);\r
+       Dataflash_SendByte(0x00);\r
+       \r
+       /* Wait until endpoint is ready before continuing */\r
+       if (Endpoint_WaitUntilReady())\r
+         return;\r
+       \r
+       while (TotalBlocks)\r
+       {\r
+               uint8_t BytesInBlockDiv16 = 0;\r
+               \r
+               /* Write an endpoint packet sized data block to the dataflash */\r
+               while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))\r
+               {\r
+                       /* Check if the endpoint is currently full */\r
+                       if (!(Endpoint_IsReadWriteAllowed()))\r
+                       {\r
+                               /* Clear the endpoint bank to send its contents to the host */\r
+                               Endpoint_ClearIN();\r
+                               \r
+                               /* Wait until the endpoint is ready for more data */\r
+                               if (Endpoint_WaitUntilReady())\r
+                                 return;\r
+                       }\r
+                       \r
+                       /* Check if end of dataflash page reached */\r
+                       if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))\r
+                       {\r
+                               /* Reset the dataflash buffer counter, increment the page counter */\r
+                               CurrDFPageByteDiv16 = 0;\r
+                               CurrDFPage++;\r
+\r
+                               /* Select the next dataflash chip based on the new dataflash page index */\r
+                               Dataflash_SelectChipFromPage(CurrDFPage);\r
+                               \r
+                               /* Send the dataflash main memory page read command */\r
+                               Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);\r
+                               Dataflash_SendAddressBytes(CurrDFPage, 0);\r
+                               Dataflash_SendByte(0x00);\r
+                               Dataflash_SendByte(0x00);\r
+                               Dataflash_SendByte(0x00);\r
+                               Dataflash_SendByte(0x00);\r
+                       }       \r
+\r
+                       /* Read one 16-byte chunk of data from the dataflash */\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       Endpoint_Write_Byte(Dataflash_ReceiveByte());\r
+                       \r
+                       /* Increment the dataflash page 16 byte block counter */\r
+                       CurrDFPageByteDiv16++;\r
+                       \r
+                       /* Increment the block 16 byte block counter */\r
+                       BytesInBlockDiv16++;\r
+\r
+                       /* Check if the current command is being aborted by the host */\r
+                       if (MSInterfaceInfo->State.IsMassStoreReset)\r
+                         return;\r
+               }\r
+               \r
+               /* Decrement the blocks remaining counter */\r
+               TotalBlocks--;\r
+       }\r
+       \r
+       /* If the endpoint is full, send its contents to the host */\r
+       if (!(Endpoint_IsReadWriteAllowed()))\r
+         Endpoint_ClearIN();\r
+\r
+       /* Deselect all dataflash chips */\r
+       Dataflash_DeselectChip();\r
+}\r
+\r
+/** Writes blocks (OS blocks, not Dataflash pages) to the storage medium, the board dataflash IC(s), from\r
+ *  the a given RAM buffer. This routine reads in OS sized blocks from the buffer and writes them to the\r
+ *  dataflash in Dataflash page sized blocks. This can be linked to FAT libraries to write files to the\r
+ *  dataflash.\r
+ *\r
+ *  \param[in] BlockAddress  Data block starting address for the write sequence\r
+ *  \param[in] TotalBlocks   Number of blocks of data to write\r
+ *  \param[in] BufferPtr     Pointer to the data source RAM buffer\r
+ */\r
+void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, const uint8_t* BufferPtr)\r
+{\r
+       uint16_t CurrDFPage          = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);\r
+       uint16_t CurrDFPageByte      = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);\r
+       uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
+       bool     UsingSecondBuffer   = false;\r
+\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
+       Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)\r
+       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
+       Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);\r
+       Dataflash_SendAddressBytes(CurrDFPage, 0);\r
+       Dataflash_WaitWhileBusy();\r
+#endif\r
+\r
+       /* Send the dataflash buffer write command */\r
+       Dataflash_SendByte(DF_CMD_BUFF1WRITE);\r
+       Dataflash_SendAddressBytes(0, CurrDFPageByte);\r
+       \r
+       while (TotalBlocks)\r
+       {\r
+               uint8_t BytesInBlockDiv16 = 0;\r
+               \r
+               /* Write an endpoint packet sized data block to the dataflash */\r
+               while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))\r
+               {\r
+                       /* Check if end of dataflash page reached */\r
+                       if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))\r
+                       {\r
+                               /* Write the dataflash buffer contents back to the dataflash page */\r
+                               Dataflash_WaitWhileBusy();\r
+                               Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);\r
+                               Dataflash_SendAddressBytes(CurrDFPage, 0);\r
+\r
+                               /* Reset the dataflash buffer counter, increment the page counter */\r
+                               CurrDFPageByteDiv16 = 0;\r
+                               CurrDFPage++;\r
+\r
+                               /* Once all the dataflash ICs have had their first buffers filled, switch buffers to maintain throughput */\r
+                               if (Dataflash_GetSelectedChip() == DATAFLASH_CHIP_MASK(DATAFLASH_TOTALCHIPS))\r
+                                 UsingSecondBuffer = !(UsingSecondBuffer);\r
+\r
+                               /* Select the next dataflash chip based on the new dataflash page index */\r
+                               Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
+#if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)\r
+                               /* If less than one dataflash page remaining, copy over the existing page to preserve trailing data */\r
+                               if ((TotalBlocks * (VIRTUAL_MEMORY_BLOCK_SIZE >> 4)) < (DATAFLASH_PAGE_SIZE >> 4))\r
+                               {\r
+                                       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
+                                       Dataflash_WaitWhileBusy();\r
+                                       Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_MAINMEMTOBUFF2 : DF_CMD_MAINMEMTOBUFF1);\r
+                                       Dataflash_SendAddressBytes(CurrDFPage, 0);\r
+                                       Dataflash_WaitWhileBusy();\r
+                               }\r
+#endif\r
+\r
+                               /* Send the dataflash buffer write command */\r
+                               Dataflash_ToggleSelectedChipCS();\r
+                               Dataflash_SendByte(DF_CMD_BUFF1WRITE);\r
+                               Dataflash_SendAddressBytes(0, 0);\r
+                       }\r
+                       \r
+                       /* Write one 16-byte chunk of data to the dataflash */\r
+                       for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)\r
+                         Dataflash_SendByte(*(BufferPtr++));\r
+                       \r
+                       /* Increment the dataflash page 16 byte block counter */\r
+                       CurrDFPageByteDiv16++;\r
+\r
+                       /* Increment the block 16 byte block counter */\r
+                       BytesInBlockDiv16++;            \r
+               }\r
+                       \r
+               /* Decrement the blocks remaining counter and reset the sub block counter */\r
+               TotalBlocks--;\r
+       }\r
+\r
+       /* Write the dataflash buffer contents back to the dataflash page */\r
+       Dataflash_WaitWhileBusy();\r
+       Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2TOMAINMEMWITHERASE : DF_CMD_BUFF1TOMAINMEMWITHERASE);\r
+       Dataflash_SendAddressBytes(CurrDFPage, 0x00);\r
+       Dataflash_WaitWhileBusy();\r
+\r
+       /* Deselect all dataflash chips */\r
+       Dataflash_DeselectChip();\r
+}\r
+\r
+/** Reads blocks (OS blocks, not Dataflash pages) from the storage medium, the board dataflash IC(s), into\r
+ *  the a preallocated RAM buffer. This routine reads in Dataflash page sized blocks from the Dataflash\r
+ *  and writes them in OS sized blocks to the given buffer. This can be linked to FAT libraries to read\r
+ *  the files stored on the dataflash.\r
+ *\r
+ *  \param[in] BlockAddress  Data block starting address for the read sequence\r
+ *  \param[in] TotalBlocks   Number of blocks of data to read\r
+ *  \param[out] BufferPtr    Pointer to the data destination RAM buffer\r
+ */\r
+void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks, uint8_t* BufferPtr)\r
+{\r
+       uint16_t CurrDFPage          = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) / DATAFLASH_PAGE_SIZE);\r
+       uint16_t CurrDFPageByte      = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);\r
+       uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
+\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
+       Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
+       /* Send the dataflash main memory page read command */\r
+       Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);\r
+       Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);\r
+       Dataflash_SendByte(0x00);\r
+       Dataflash_SendByte(0x00);\r
+       Dataflash_SendByte(0x00);\r
+       Dataflash_SendByte(0x00);\r
+\r
+       while (TotalBlocks)\r
+       {\r
+               uint8_t BytesInBlockDiv16 = 0;\r
+               \r
+               /* Write an endpoint packet sized data block to the dataflash */\r
+               while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))\r
+               {\r
+                       /* Check if end of dataflash page reached */\r
+                       if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))\r
+                       {\r
+                               /* Reset the dataflash buffer counter, increment the page counter */\r
+                               CurrDFPageByteDiv16 = 0;\r
+                               CurrDFPage++;\r
+\r
+                               /* Select the next dataflash chip based on the new dataflash page index */\r
+                               Dataflash_SelectChipFromPage(CurrDFPage);\r
+                               \r
+                               /* Send the dataflash main memory page read command */\r
+                               Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);\r
+                               Dataflash_SendAddressBytes(CurrDFPage, 0);\r
+                               Dataflash_SendByte(0x00);\r
+                               Dataflash_SendByte(0x00);\r
+                               Dataflash_SendByte(0x00);\r
+                               Dataflash_SendByte(0x00);\r
+                       }       \r
+\r
+                       /* Read one 16-byte chunk of data from the dataflash */\r
+                       for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)\r
+                         *(BufferPtr++) = Dataflash_ReceiveByte();\r
+                       \r
+                       /* Increment the dataflash page 16 byte block counter */\r
+                       CurrDFPageByteDiv16++;\r
+                       \r
+                       /* Increment the block 16 byte block counter */\r
+                       BytesInBlockDiv16++;\r
+               }\r
+               \r
+               /* Decrement the blocks remaining counter */\r
+               TotalBlocks--;\r
+       }\r
+\r
+       /* Deselect all dataflash chips */\r
+       Dataflash_DeselectChip();\r
+}\r
+\r
+/** Disables the dataflash memory write protection bits on the board Dataflash ICs, if enabled. */\r
+void DataflashManager_ResetDataflashProtections(void)\r
+{\r
+       /* Select first dataflash chip, send the read status register command */\r
+       Dataflash_SelectChip(DATAFLASH_CHIP1);\r
+       Dataflash_SendByte(DF_CMD_GETSTATUS);\r
+       \r
+       /* Check if sector protection is enabled */\r
+       if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)\r
+       {\r
+               Dataflash_ToggleSelectedChipCS();\r
+\r
+               /* Send the commands to disable sector protection */\r
+               Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);\r
+               Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);\r
+               Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);\r
+               Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);\r
+       }\r
+       \r
+       /* Select second dataflash chip (if present on selected board), send read status register command */\r
+       #if (DATAFLASH_TOTALCHIPS == 2)\r
+       Dataflash_SelectChip(DATAFLASH_CHIP2);\r
+       Dataflash_SendByte(DF_CMD_GETSTATUS);\r
+       \r
+       /* Check if sector protection is enabled */\r
+       if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)\r
+       {\r
+               Dataflash_ToggleSelectedChipCS();\r
+\r
+               /* Send the commands to disable sector protection */\r
+               Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[0]);\r
+               Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[1]);\r
+               Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);\r
+               Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);\r
+       }\r
+       #endif\r
+       \r
+       /* Deselect current dataflash chip */\r
+       Dataflash_DeselectChip();\r
+}\r
+\r
+/** Performs a simple test on the attached Dataflash IC(s) to ensure that they are working.\r
+ *\r
+ *  \return Boolean true if all media chips are working, false otherwise\r
+ */\r
+bool DataflashManager_CheckDataflashOperation(void)\r
+{\r
+       uint8_t ReturnByte;\r
+\r
+       /* Test first Dataflash IC is present and responding to commands */\r
+       Dataflash_SelectChip(DATAFLASH_CHIP1);\r
+       Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);\r
+       ReturnByte = Dataflash_ReceiveByte();\r
+       Dataflash_DeselectChip();\r
+\r
+       /* If returned data is invalid, fail the command */\r
+       if (ReturnByte != DF_MANUFACTURER_ATMEL)\r
+         return false;\r
+\r
+       #if (DATAFLASH_TOTALCHIPS == 2)\r
+       /* Test second Dataflash IC is present and responding to commands */\r
+       Dataflash_SelectChip(DATAFLASH_CHIP2);\r
+       Dataflash_SendByte(DF_CMD_READMANUFACTURERDEVICEINFO);\r
+       ReturnByte = Dataflash_ReceiveByte();\r
+       Dataflash_DeselectChip();\r
+\r
+       /* If returned data is invalid, fail the command */\r
+       if (ReturnByte != DF_MANUFACTURER_ATMEL)\r
+         return false;\r
+       #endif\r
+       \r
+       return true;\r
+}\r
diff --git a/Projects/Webserver/Lib/DataflashManager.h b/Projects/Webserver/Lib/DataflashManager.h
new file mode 100644 (file)
index 0000000..d3ea0ff
--- /dev/null
@@ -0,0 +1,80 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Header file for DataflashManager.c.\r
+ */\r
\r
+#ifndef _DATAFLASH_MANAGER_H\r
+#define _DATAFLASH_MANAGER_H\r
+\r
+       /* Includes: */\r
+               #include <avr/io.h>\r
+               
+               #include "Descriptors.h"\r
+\r
+               #include <LUFA/Common/Common.h>\r
+               #include <LUFA/Drivers/USB/USB.h>\r
+               #include <LUFA/Drivers/USB/Class/MassStorage.h>\r
+               #include <LUFA/Drivers/Board/Dataflash.h>\r
+\r
+       /* Preprocessor Checks: */\r
+               #if (DATAFLASH_PAGE_SIZE % 16)\r
+                       #error Dataflash page size must be a multiple of 16 bytes.\r
+               #endif\r
+\r
+       /* Defines: */\r
+               /** Total number of bytes of the storage medium, comprised of one or more dataflash ICs. */\r
+               #define VIRTUAL_MEMORY_BYTES                ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)\r
+\r
+               /** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying\r
+                *  storage media (Dataflash) using a different native block size. Do not change this value.\r
+                */\r
+               #define VIRTUAL_MEMORY_BLOCK_SIZE           512\r
+               \r
+               /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not\r
+                *  change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.\r
+                */\r
+               #define VIRTUAL_MEMORY_BLOCKS               (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)\r
+               \r
+       /* Function Prototypes: */\r
+               void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, const uint32_t BlockAddress,\r
+                                                 uint16_t TotalBlocks);\r
+               void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, const uint32_t BlockAddress,\r
+                                                uint16_t TotalBlocks);\r
+               void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,\r
+                                                     const uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);\r
+               void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,\r
+                                                    uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);\r
+               void DataflashManager_ResetDataflashProtections(void);\r
+               bool DataflashManager_CheckDataflashOperation(void);\r
+               \r
+#endif\r
diff --git a/Projects/Webserver/Lib/FATFs/00readme.txt b/Projects/Webserver/Lib/FATFs/00readme.txt
new file mode 100644 (file)
index 0000000..295be3b
--- /dev/null
@@ -0,0 +1,110 @@
+FatFs Module Source Files R0.07e                        (C)ChaN, 2010\r
+\r
+\r
+FILES\r
+\r
+  ffconf.h   Configuration file for FatFs module.\r
+  ff.h       Common include file for FatFs and application module.\r
+  ff.c       FatFs module.\r
+  diskio.h   Common include file for FatFs and disk I/O module.\r
+  diskio.c   Skeleton of low level disk I/O module.\r
+  integer.h  Alternative type definitions for integer variables.\r
+  option     Optional external functions.\r
+\r
+  Low level disk I/O module is not included in this archive because the FatFs\r
+  module is only a generic file system layer and not depend on any specific\r
+  storage device. You have to provide a low level disk I/O module that written\r
+  to control your storage device.\r
+\r
+\r
+\r
+AGREEMENTS\r
+\r
+ FatFs module is an open source software to implement FAT file system to\r
+ small embedded systems. This is a free software and is opened for education,\r
+ research and commercial developments under license policy of following trems.\r
+\r
+  Copyright (C) 2010, ChaN, all right reserved.\r
+\r
+ * The FatFs module is a free software and there is NO WARRANTY.\r
+ * No restriction on use. You can use, modify and redistribute it for\r
+   personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.\r
+ * Redistributions of source code must retain the above copyright notice.\r
+\r
+\r
+\r
+REVISION HISTORY\r
+\r
+  Feb 26, 2006  R0.00  Prototype\r
+\r
+  Apr 29, 2006  R0.01  First release.\r
+\r
+  Jun 01, 2006  R0.02  Added FAT12.\r
+                       Removed unbuffered mode.\r
+                       Fixed a problem on small (<32M) patition.\r
+\r
+  Jun 10, 2006  R0.02a Added a configuration option _FS_MINIMUM.\r
+\r
+  Sep 22, 2006  R0.03  Added f_rename.\r
+                       Changed option _FS_MINIMUM to _FS_MINIMIZE.\r
+\r
+  Dec 11, 2006  R0.03a Improved cluster scan algolithm to write files fast.\r
+                       Fixed f_mkdir creates incorrect directory on FAT32.\r
+\r
+  Feb 04, 2007  R0.04  Supported multiple drive system. (FatFs)\r
+                       Changed some APIs for multiple drive system.\r
+                       Added f_mkfs. (FatFs)\r
+                       Added _USE_FAT32 option. (Tiny-FatFs)\r
+\r
+  Apr 01, 2007  R0.04a Supported multiple partitions on a plysical drive. (FatFs)\r
+                       Fixed an endian sensitive code in f_mkfs. (FatFs)\r
+                       Added a capability of extending the file size to f_lseek.\r
+                       Added minimization level 3.\r
+                       Fixed a problem that can collapse a sector when recreate an\r
+                       existing file in any sub-directory at non FAT32 cfg. (Tiny-FatFs)\r
+\r
+  May 05, 2007  R0.04b Added _USE_NTFLAG option.\r
+                       Added FSInfo support.\r
+                       Fixed some problems corresponds to FAT32. (Tiny-FatFs)\r
+                       Fixed DBCS name can result FR_INVALID_NAME.\r
+                       Fixed short seek (0 < ofs <= csize) collapses the file object.\r
+\r
+  Aug 25, 2007  R0.05  Changed arguments of f_read, f_write.\r
+                       Changed arguments of f_mkfs. (FatFs)\r
+                       Fixed f_mkfs on FAT32 creates incorrect FSInfo. (FatFs)\r
+                       Fixed f_mkdir on FAT32 creates incorrect directory. (FatFs)\r
+\r
+  Feb 03, 2008  R0.05a Added f_truncate().\r
+                       Added f_utime().\r
+                       Fixed off by one error at FAT sub-type determination.\r
+                       Fixed btr in f_read() can be mistruncated.\r
+                       Fixed cached sector is not flushed when create and close without write.\r
+\r
+  Apr 01, 2008  R0.06  Added f_forward(). (Tiny-FatFs)\r
+                       Added string functions: fputc(), fputs(), fprintf() and fgets().\r
+                       Improved performance of f_lseek() on move to the same or following cluster.\r
+\r
+  Apr 01, 2010, R0.07  Merged Tiny-FatFs as a buffer configuration option.\r
+                       Added long file name support.\r
+                       Added multiple code page support.\r
+                       Added re-entrancy for multitask operation.\r
+                       Added auto cluster size selection to f_mkfs().\r
+                       Added rewind option to f_readdir().\r
+                       Changed result code of critical errors.\r
+                       Renamed string functions to avoid name collision.\r
+\r
+  Apr 14, 2010, R0.07a Separated out OS dependent code on reentrant cfg.\r
+                       Added multiple sector size support.\r
+\r
+  Jun 21, 2010, R0.07c Fixed f_unlink() may return FR_OK on error.\r
+                       Fixed wrong cache control in f_lseek().\r
+                       Added relative path feature.\r
+                       Added f_chdir().\r
+                       Added f_chdrive().\r
+                       Added proper case conversion for extended characters.\r
+\r
+  Nov 03,'2010 R0.07e  Separated out configuration options from ff.h to ffconf.h.\r
+                       Added a configuration option, _LFN_UNICODE.\r
+                       Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.\r
+                       Fixed name matching error on the 13 char boundary.\r
+                       Changed f_readdir() to return the SFN with always upper case on non-LFN cfg.\r
diff --git a/Projects/Webserver/Lib/FATFs/diskio.c b/Projects/Webserver/Lib/FATFs/diskio.c
new file mode 100644 (file)
index 0000000..c7c837b
--- /dev/null
@@ -0,0 +1,92 @@
+/*-----------------------------------------------------------------------*/\r
+/* Low level disk I/O module skeleton for FatFs     (C)ChaN, 2007        */\r
+/*-----------------------------------------------------------------------*/\r
+/* This is a stub disk I/O module that acts as front end of the existing */\r
+/* disk I/O modules and attach it to FatFs module with common interface. */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+#include "diskio.h"\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Inidialize a Drive                                                    */\r
+\r
+DSTATUS disk_initialize (\r
+       BYTE drv                                /* Physical drive nmuber (0..) */\r
+)\r
+{\r
+       return FR_OK;\r
+}\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Return Disk Status                                                    */\r
+\r
+DSTATUS disk_status (\r
+       BYTE drv                /* Physical drive nmuber (0..) */\r
+)\r
+{\r
+       return FR_OK;\r
+}\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Read Sector(s)                                                        */\r
+\r
+DRESULT disk_read (\r
+       BYTE drv,               /* Physical drive nmuber (0..) */\r
+       BYTE *buff,             /* Data buffer to store read data */\r
+       DWORD sector,   /* Sector address (LBA) */\r
+       BYTE count              /* Number of sectors to read (1..255) */\r
+)\r
+{\r
+       DataflashManager_ReadBlocks_RAM(sector, count, buff);\r
+       return RES_OK;\r
+}\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Write Sector(s)                                                       */\r
+\r
+#if _READONLY == 0\r
+DRESULT disk_write (\r
+       BYTE drv,                       /* Physical drive nmuber (0..) */\r
+       const BYTE *buff,       /* Data to be written */\r
+       DWORD sector,           /* Sector address (LBA) */\r
+       BYTE count                      /* Number of sectors to write (1..255) */\r
+)\r
+{\r
+       DataflashManager_WriteBlocks_RAM(sector, count, buff);\r
+       return RES_OK;\r
+}\r
+#endif /* _READONLY */\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Miscellaneous Functions                                               */\r
+\r
+DRESULT disk_ioctl (\r
+       BYTE drv,               /* Physical drive nmuber (0..) */\r
+       BYTE ctrl,              /* Control code */\r
+       void *buff              /* Buffer to send/receive control data */\r
+)\r
+{\r
+       if (ctrl == CTRL_SYNC)\r
+         return RES_OK;\r
+       else\r
+         return RES_PARERR;\r
+}\r
+\r
+\r
+DWORD get_fattime (void)\r
+{\r
+       return ((DWORD)1 << 25) |\r
+              ((DWORD)1 << 21) |\r
+              ((DWORD)1 << 16) |\r
+              ((DWORD)1 << 11) |\r
+              ((DWORD)1 << 5)  |\r
+              ((DWORD)1 << 0);\r
+}\r
diff --git a/Projects/Webserver/Lib/FATFs/diskio.h b/Projects/Webserver/Lib/FATFs/diskio.h
new file mode 100644 (file)
index 0000000..3df93ae
--- /dev/null
@@ -0,0 +1,72 @@
+/*-----------------------------------------------------------------------\r
+/  Low level disk interface modlue include file  R0.07   (C)ChaN, 2010\r
+/-----------------------------------------------------------------------*/\r
+\r
+#ifndef _DISKIO\r
+\r
+#define _READONLY      0       /* 1: Read-only mode */\r
+#define _USE_IOCTL     1\r
+\r
+#include "integer.h"\r
+#include "ff.h"\r
+\r
+#include "../DataflashManager.h"\r
+\r
+\r
+/* Status of Disk Functions */\r
+typedef BYTE   DSTATUS;\r
+\r
+/* Results of Disk Functions */\r
+typedef enum {\r
+       RES_OK = 0,             /* 0: Successful */\r
+       RES_ERROR,              /* 1: R/W Error */\r
+       RES_WRPRT,              /* 2: Write Protected */\r
+       RES_NOTRDY,             /* 3: Not Ready */\r
+       RES_PARERR              /* 4: Invalid Parameter */\r
+} DRESULT;\r
+\r
+\r
+/*---------------------------------------*/\r
+/* Prototypes for disk control functions */\r
+\r
+BOOL assign_drives (int argc, char *argv[]);\r
+DSTATUS disk_initialize (BYTE);\r
+DSTATUS disk_status (BYTE);\r
+DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);\r
+#if    _READONLY == 0\r
+DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);\r
+#endif\r
+DRESULT disk_ioctl (BYTE, BYTE, void*);\r
+\r
+\r
+/* Disk Status Bits (DSTATUS) */\r
+\r
+#define STA_NOINIT             0x01    /* Drive not initialized */\r
+#define STA_NODISK             0x02    /* No medium in the drive */\r
+#define STA_PROTECT            0x04    /* Write protected */\r
+\r
+\r
+/* Command code for disk_ioctrl() */\r
+\r
+/* Generic command */\r
+#define CTRL_SYNC                      0       /* Mandatory for write functions */\r
+#define GET_SECTOR_COUNT       1       /* Mandatory for only f_mkfs() */\r
+#define GET_SECTOR_SIZE                2       /* Mandatory for multiple sector size cfg */\r
+#define GET_BLOCK_SIZE         3       /* Mandatory for only f_mkfs() */\r
+#define CTRL_POWER                     4\r
+#define CTRL_LOCK                      5\r
+#define CTRL_EJECT                     6\r
+/* MMC/SDC command */\r
+#define MMC_GET_TYPE           10\r
+#define MMC_GET_CSD                    11\r
+#define MMC_GET_CID                    12\r
+#define MMC_GET_OCR                    13\r
+#define MMC_GET_SDSTAT         14\r
+/* ATA/CF command */\r
+#define ATA_GET_REV                    20\r
+#define ATA_GET_MODEL          21\r
+#define ATA_GET_SN                     22\r
+\r
+\r
+#define _DISKIO\r
+#endif\r
diff --git a/Projects/Webserver/Lib/FATFs/diskio.lst b/Projects/Webserver/Lib/FATFs/diskio.lst
new file mode 100644 (file)
index 0000000..d3e7805
--- /dev/null
@@ -0,0 +1,149 @@
+   1                           .file   "diskio.c"\r
+   2                   __SREG__ = 0x3f\r
+   3                   __SP_H__ = 0x3e\r
+   4                   __SP_L__ = 0x3d\r
+   5                   __CCP__  = 0x34\r
+   6                   __tmp_reg__ = 0\r
+   7                   __zero_reg__ = 1\r
+  15                   .Ltext0:\r
+  16                           .section        .text.disk_initialize,"ax",@progbits\r
+  17                   .global disk_initialize\r
+  19                   disk_initialize:\r
+  20                   .LFB54:\r
+  21                   .LSM0:\r
+  22                   .LVL0:\r
+  23                   /* prologue: function */\r
+  24                   /* frame size = 0 */\r
+  25                   .LSM1:\r
+  26 0000 80E0                 ldi r24,lo8(0)\r
+  27                   .LVL1:\r
+  28                   /* epilogue start */\r
+  29 0002 0895                 ret\r
+  30                   .LFE54:\r
+  32                           .section        .text.disk_status,"ax",@progbits\r
+  33                   .global disk_status\r
+  35                   disk_status:\r
+  36                   .LFB55:\r
+  37                   .LSM2:\r
+  38                   .LVL2:\r
+  39                   /* prologue: function */\r
+  40                   /* frame size = 0 */\r
+  41                   .LSM3:\r
+  42 0000 80E0                 ldi r24,lo8(0)\r
+  43                   .LVL3:\r
+  44                   /* epilogue start */\r
+  45 0002 0895                 ret\r
+  46                   .LFE55:\r
+  48                           .section        .text.disk_ioctl,"ax",@progbits\r
+  49                   .global disk_ioctl\r
+  51                   disk_ioctl:\r
+  52                   .LFB58:\r
+  53                   .LSM4:\r
+  54                   .LVL4:\r
+  55                   /* prologue: function */\r
+  56                   /* frame size = 0 */\r
+  57                   .LSM5:\r
+  58 0000 6623                 tst r22\r
+  59 0002 01F0                 breq .L6\r
+  60 0004 84E0                 ldi r24,lo8(4)\r
+  61                   .LVL5:\r
+  62 0006 0895                 ret\r
+  63                   .LVL6:\r
+  64                   .L6:\r
+  65 0008 80E0                 ldi r24,lo8(0)\r
+  66                   .LVL7:\r
+  67                   .LSM6:\r
+  68 000a 0895                 ret\r
+  69                   .LFE58:\r
+  71                           .section        .text.get_fattime,"ax",@progbits\r
+  72                   .global get_fattime\r
+  74                   get_fattime:\r
+  75                   .LFB59:\r
+  76                   .LSM7:\r
+  77                   /* prologue: function */\r
+  78                   /* frame size = 0 */\r
+  79                   .LSM8:\r
+  80 0000 61E2                 ldi r22,lo8(35719201)\r
+  81 0002 78E0                 ldi r23,hi8(35719201)\r
+  82 0004 81E2                 ldi r24,hlo8(35719201)\r
+  83 0006 92E0                 ldi r25,hhi8(35719201)\r
+  84                   /* epilogue start */\r
+  85 0008 0895                 ret\r
+  86                   .LFE59:\r
+  88                           .section        .text.disk_write,"ax",@progbits\r
+  89                   .global disk_write\r
+  91                   disk_write:\r
+  92                   .LFB57:\r
+  93                   .LSM9:\r
+  94                   .LVL8:\r
+  95 0000 0F93                 push r16\r
+  96                   .LVL9:\r
+  97                   /* prologue: function */\r
+  98                   /* frame size = 0 */\r
+  99 0002 FB01                 movw r30,r22\r
+ 100                   .LSM10:\r
+ 101 0004 CA01                 movw r24,r20\r
+ 102 0006 B901                 movw r22,r18\r
+ 103                   .LVL10:\r
+ 104 0008 402F                 mov r20,r16\r
+ 105                   .LVL11:\r
+ 106 000a 50E0                 ldi r21,lo8(0)\r
+ 107 000c 9F01                 movw r18,r30\r
+ 108                   .LVL12:\r
+ 109 000e 0E94 0000            call DataflashManager_WriteBlocks_RAM\r
+ 110                   .LVL13:\r
+ 111                   .LSM11:\r
+ 112 0012 80E0                 ldi r24,lo8(0)\r
+ 113                   /* epilogue start */\r
+ 114 0014 0F91                 pop r16\r
+ 115                   .LVL14:\r
+ 116 0016 0895                 ret\r
+ 117                   .LFE57:\r
+ 119                           .section        .text.disk_read,"ax",@progbits\r
+ 120                   .global disk_read\r
+ 122                   disk_read:\r
+ 123                   .LFB56:\r
+ 124                   .LSM12:\r
+ 125                   .LVL15:\r
+ 126 0000 0F93                 push r16\r
+ 127                   .LVL16:\r
+ 128                   /* prologue: function */\r
+ 129                   /* frame size = 0 */\r
+ 130 0002 FB01                 movw r30,r22\r
+ 131                   .LSM13:\r
+ 132 0004 CA01                 movw r24,r20\r
+ 133 0006 B901                 movw r22,r18\r
+ 134                   .LVL17:\r
+ 135 0008 402F                 mov r20,r16\r
+ 136                   .LVL18:\r
+ 137 000a 50E0                 ldi r21,lo8(0)\r
+ 138 000c 9F01                 movw r18,r30\r
+ 139                   .LVL19:\r
+ 140 000e 0E94 0000            call DataflashManager_ReadBlocks_RAM\r
+ 141                   .LVL20:\r
+ 142                   .LSM14:\r
+ 143 0012 80E0                 ldi r24,lo8(0)\r
+ 144                   /* epilogue start */\r
+ 145 0014 0F91                 pop r16\r
+ 146                   .LVL21:\r
+ 147 0016 0895                 ret\r
+ 148                   .LFE56:\r
+ 214                   .Letext0:\r
+DEFINED SYMBOLS\r
+                            *ABS*:00000000 diskio.c\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:2      *ABS*:0000003f __SREG__\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:3      *ABS*:0000003e __SP_H__\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:4      *ABS*:0000003d __SP_L__\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:5      *ABS*:00000034 __CCP__\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:6      *ABS*:00000000 __tmp_reg__\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:7      *ABS*:00000001 __zero_reg__\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:19     .text.disk_initialize:00000000 disk_initialize\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:35     .text.disk_status:00000000 disk_status\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:51     .text.disk_ioctl:00000000 disk_ioctl\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:74     .text.get_fattime:00000000 get_fattime\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:91     .text.disk_write:00000000 disk_write\r
+C:\Users\Dean\AppData\Local\Temp/cc5TUdwu.s:122    .text.disk_read:00000000 disk_read\r
+\r
+UNDEFINED SYMBOLS\r
+DataflashManager_WriteBlocks_RAM\r
+DataflashManager_ReadBlocks_RAM\r
diff --git a/Projects/Webserver/Lib/FATFs/ff.c b/Projects/Webserver/Lib/FATFs/ff.c
new file mode 100644 (file)
index 0000000..6382fea
--- /dev/null
@@ -0,0 +1,3153 @@
+/*----------------------------------------------------------------------------/\r
+/  FatFs - FAT file system module  R0.07e                    (C)ChaN, 2010\r
+/-----------------------------------------------------------------------------/\r
+/ FatFs module is a generic FAT file system module for small embedded systems.\r
+/ This is a free software that opened for education, research and commercial\r
+/ developments under license policy of following trems.\r
+/\r
+/  Copyright (C) 2010, ChaN, all right reserved.\r
+/\r
+/ * The FatFs module is a free software and there is NO WARRANTY.\r
+/ * No restriction on use. You can use, modify and redistribute it for\r
+/   personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.\r
+/ * Redistributions of source code must retain the above copyright notice.\r
+/\r
+/-----------------------------------------------------------------------------/\r
+/ Feb 26,'06 R0.00  Prototype.\r
+/\r
+/ Apr 29,'06 R0.01  First stable version.\r
+/\r
+/ Jun 01,'06 R0.02  Added FAT12 support.\r
+/                   Removed unbuffered mode.\r
+/                   Fixed a problem on small (<32M) patition.\r
+/ Jun 10,'06 R0.02a Added a configuration option (_FS_MINIMUM).\r
+/\r
+/ Sep 22,'06 R0.03  Added f_rename().\r
+/                   Changed option _FS_MINIMUM to _FS_MINIMIZE.\r
+/ Dec 11,'06 R0.03a Improved cluster scan algolithm to write files fast.\r
+/                   Fixed f_mkdir() creates incorrect directory on FAT32.\r
+/\r
+/ Feb 04,'07 R0.04  Supported multiple drive system.\r
+/                   Changed some interfaces for multiple drive system.\r
+/                   Changed f_mountdrv() to f_mount().\r
+/                   Added f_mkfs().\r
+/ Apr 01,'07 R0.04a Supported multiple partitions on a plysical drive.\r
+/                   Added a capability of extending file size to f_lseek().\r
+/                   Added minimization level 3.\r
+/                   Fixed an endian sensitive code in f_mkfs().\r
+/ May 05,'07 R0.04b Added a configuration option _USE_NTFLAG.\r
+/                   Added FSInfo support.\r
+/                   Fixed DBCS name can result FR_INVALID_NAME.\r
+/                   Fixed short seek (<= csize) collapses the file object.\r
+/\r
+/ Aug 25,'07 R0.05  Changed arguments of f_read(), f_write() and f_mkfs().\r
+/                   Fixed f_mkfs() on FAT32 creates incorrect FSInfo.\r
+/                   Fixed f_mkdir() on FAT32 creates incorrect directory.\r
+/ Feb 03,'08 R0.05a Added f_truncate() and f_utime().\r
+/                   Fixed off by one error at FAT sub-type determination.\r
+/                   Fixed btr in f_read() can be mistruncated.\r
+/                   Fixed cached sector is not flushed when create and close\r
+/                   without write.\r
+/\r
+/ Apr 01,'08 R0.06  Added fputc(), fputs(), fprintf() and fgets().\r
+/                   Improved performance of f_lseek() on moving to the same\r
+/                   or following cluster.\r
+/\r
+/ Apr 01,'09 R0.07  Merged Tiny-FatFs as a buffer configuration option.\r
+/                   Added long file name support.\r
+/                   Added multiple code page support.\r
+/                   Added re-entrancy for multitask operation.\r
+/                   Added auto cluster size selection to f_mkfs().\r
+/                   Added rewind option to f_readdir().\r
+/                   Changed result code of critical errors.\r
+/                   Renamed string functions to avoid name collision.\r
+/ Apr 14,'09 R0.07a Separated out OS dependent code on reentrant cfg.\r
+/                   Added multiple sector size support.\r
+/ Jun 21,'09 R0.07c Fixed f_unlink() can return FR_OK on error.\r
+/                   Fixed wrong cache control in f_lseek().\r
+/                   Added relative path feature.\r
+/                   Added f_chdir() and f_chdrive().\r
+/                   Added proper case conversion to extended char.\r
+/ Nov 03,'09 R0.07e Separated out configuration options from ff.h to ffconf.h.\r
+/                   Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.\r
+/                   Fixed name matching error on the 13 char boundary.\r
+/                   Added a configuration option, _LFN_UNICODE.\r
+/                   Changed f_readdir() to return the SFN with always upper\r
+/                   case on non-LFN cfg.\r
+/---------------------------------------------------------------------------*/\r
+\r
+#include "ff.h"                        /* FatFs configurations and declarations */\r
+#include "diskio.h"            /* Declarations of low level disk I/O functions */\r
+\r
+/*--------------------------------------------------------------------------\r
+\r
+   Module Private Definitions\r
+\r
+---------------------------------------------------------------------------*/\r
+\r
+#if _FATFS != 0x007E\r
+#error Wrong include file (ff.h).\r
+#endif\r
+\r
+#if _FS_REENTRANT\r
+#if _USE_LFN == 1\r
+#error Static LFN work area must not be used in re-entrant configuration.\r
+#endif\r
+#define        ENTER_FF(fs)            { if (!lock_fs(fs)) return FR_TIMEOUT; }\r
+#define        LEAVE_FF(fs, res)       { unlock_fs(fs, res); return res; }\r
+\r
+#else\r
+#define        ENTER_FF(fs)\r
+#define LEAVE_FF(fs, res)      return res\r
+\r
+#endif\r
+\r
+#define        ABORT(fs, res)          { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); }\r
+\r
+#ifndef NULL\r
+#define        NULL    0\r
+#endif\r
+\r
+/* Name status flags */\r
+#define NS                     11              /* Offset of name status byte */\r
+#define NS_LOSS                0x01    /* Out of 8.3 format */\r
+#define NS_LFN         0x02    /* Force to create LFN entry */\r
+#define NS_LAST                0x04    /* Last segment */\r
+#define NS_BODY                0x08    /* Lower case flag (body) */\r
+#define NS_EXT         0x10    /* Lower case flag (ext) */\r
+#define NS_DOT         0x20    /* Dot entry */\r
+\r
+\r
+\r
+\r
+/*--------------------------------------------------------------------------\r
+\r
+   Private Work Area\r
+\r
+---------------------------------------------------------------------------*/\r
+\r
+#if _DRIVES < 1 || _DRIVES > 9\r
+#error Number of drives must be 1-9.\r
+#endif\r
+static\r
+FATFS *FatFs[_DRIVES]; /* Pointer to the file system objects (logical drives) */\r
+\r
+static\r
+WORD Fsid;                             /* File system mount ID */\r
+\r
+#if _FS_RPATH\r
+static\r
+BYTE Drive;                            /* Current drive */\r
+#endif\r
+\r
+\r
+#if _USE_LFN == 1      /* LFN with static LFN working buffer */\r
+static\r
+WCHAR LfnBuf[_MAX_LFN + 1];\r
+#define        NAMEBUF(sp,lp)  BYTE sp[12]; WCHAR *lp = LfnBuf\r
+#define INITBUF(dj,sp,lp)      dj.fn = sp; dj.lfn = lp\r
+\r
+#elif _USE_LFN > 1     /* LFN with dynamic LFN working buffer */\r
+#define        NAMEBUF(sp,lp)  BYTE sp[12]; WCHAR lbuf[_MAX_LFN + 1], *lp = lbuf\r
+#define INITBUF(dj,sp,lp)      dj.fn = sp; dj.lfn = lp\r
+\r
+#else                          /* No LFN */\r
+#define        NAMEBUF(sp,lp)  BYTE sp[12]\r
+#define INITBUF(dj,sp,lp)      dj.fn = sp\r
+\r
+#endif\r
+\r
+\r
+\r
+\r
+/*--------------------------------------------------------------------------\r
+\r
+   Module Private Functions\r
+\r
+---------------------------------------------------------------------------*/\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* String functions                                                      */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+/* Copy memory to memory */\r
+static\r
+void mem_cpy (void* dst, const void* src, int cnt) {\r
+       char *d = (char*)dst;\r
+       const char *s = (const char *)src;\r
+       while (cnt--) *d++ = *s++;\r
+}\r
+\r
+/* Fill memory */\r
+static\r
+void mem_set (void* dst, int val, int cnt) {\r
+       char *d = (char*)dst;\r
+       while (cnt--) *d++ = (char)val;\r
+}\r
+\r
+/* Compare memory to memory */\r
+static\r
+int mem_cmp (const void* dst, const void* src, int cnt) {\r
+       const char *d = (const char *)dst, *s = (const char *)src;\r
+       int r = 0;\r
+       while (cnt-- && (r = *d++ - *s++) == 0) ;\r
+       return r;\r
+}\r
+\r
+/* Check if chr is contained in the string */\r
+static\r
+int chk_chr (const char* str, int chr) {\r
+       while (*str && *str != chr) str++;\r
+       return *str;\r
+}\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Request/Release grant to access the volume                            */\r
+/*-----------------------------------------------------------------------*/\r
+#if _FS_REENTRANT\r
+\r
+static\r
+BOOL lock_fs (\r
+       FATFS *fs               /* File system object */\r
+)\r
+{\r
+       return ff_req_grant(fs->sobj);\r
+}\r
+\r
+\r
+static\r
+void unlock_fs (\r
+       FATFS *fs,              /* File system object */\r
+       FRESULT res             /* Result code to be returned */\r
+)\r
+{\r
+       if (res != FR_NOT_ENABLED &&\r
+               res != FR_INVALID_DRIVE &&\r
+               res != FR_INVALID_OBJECT &&\r
+               res != FR_TIMEOUT) {\r
+               ff_rel_grant(fs->sobj);\r
+       }\r
+}\r
+#endif\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Change window offset                                                  */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+static\r
+FRESULT move_window (\r
+       FATFS *fs,              /* File system object */\r
+       DWORD sector    /* Sector number to make apperance in the fs->win[] */\r
+)                                      /* Move to zero only writes back dirty window */\r
+{\r
+       DWORD wsect;\r
+\r
+\r
+       wsect = fs->winsect;\r
+       if (wsect != sector) {  /* Changed current window */\r
+#if !_FS_READONLY\r
+               if (fs->wflag) {        /* Write back dirty window if needed */\r
+                       if (disk_write(fs->drive, fs->win, wsect, 1) != RES_OK)\r
+                               return FR_DISK_ERR;\r
+                       fs->wflag = 0;\r
+                       if (wsect < (fs->fatbase + fs->sects_fat)) {    /* In FAT area */\r
+                               BYTE nf;\r
+                               for (nf = fs->n_fats; nf > 1; nf--) {   /* Refrect the change to all FAT copies */\r
+                                       wsect += fs->sects_fat;\r
+                                       disk_write(fs->drive, fs->win, wsect, 1);\r
+                               }\r
+                       }\r
+               }\r
+#endif\r
+               if (sector) {\r
+                       if (disk_read(fs->drive, fs->win, sector, 1) != RES_OK)\r
+                               return FR_DISK_ERR;\r
+                       fs->winsect = sector;\r
+               }\r
+       }\r
+\r
+       return FR_OK;\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Clean-up cached data                                                  */\r
+/*-----------------------------------------------------------------------*/\r
+#if !_FS_READONLY\r
+static\r
+FRESULT sync ( /* FR_OK: successful, FR_DISK_ERR: failed */\r
+       FATFS *fs       /* File system object */\r
+)\r
+{\r
+       FRESULT res;\r
+\r
+\r
+       res = move_window(fs, 0);\r
+       if (res == FR_OK) {\r
+               /* Update FSInfo sector if needed */\r
+               if (fs->fs_type == FS_FAT32 && fs->fsi_flag) {\r
+                       fs->winsect = 0;\r
+                       mem_set(fs->win, 0, 512);\r
+                       ST_WORD(fs->win+BS_55AA, 0xAA55);\r
+                       ST_DWORD(fs->win+FSI_LeadSig, 0x41615252);\r
+                       ST_DWORD(fs->win+FSI_StrucSig, 0x61417272);\r
+                       ST_DWORD(fs->win+FSI_Free_Count, fs->free_clust);\r
+                       ST_DWORD(fs->win+FSI_Nxt_Free, fs->last_clust);\r
+                       disk_write(fs->drive, fs->win, fs->fsi_sector, 1);\r
+                       fs->fsi_flag = 0;\r
+               }\r
+               /* Make sure that no pending write process in the physical drive */\r
+               if (disk_ioctl(fs->drive, CTRL_SYNC, (void*)NULL) != RES_OK)\r
+                       res = FR_DISK_ERR;\r
+       }\r
+\r
+       return res;\r
+}\r
+#endif\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* FAT access - Read value of a FAT entry                                */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+\r
+DWORD get_fat (        /* 0xFFFFFFFF:Disk error, 1:Interal error, Else:Cluster status */\r
+       FATFS *fs,      /* File system object */\r
+       DWORD clst      /* Cluster# to get the link information */\r
+)\r
+{\r
+       UINT wc, bc;\r
+       DWORD fsect;\r
+\r
+\r
+       if (clst < 2 || clst >= fs->max_clust)  /* Range check */\r
+               return 1;\r
+\r
+       fsect = fs->fatbase;\r
+       switch (fs->fs_type) {\r
+       case FS_FAT12 :\r
+               bc = clst; bc += bc / 2;\r
+               if (move_window(fs, fsect + (bc / SS(fs)))) break;\r
+               wc = fs->win[bc & (SS(fs) - 1)]; bc++;\r
+               if (move_window(fs, fsect + (bc / SS(fs)))) break;\r
+               wc |= (WORD)fs->win[bc & (SS(fs) - 1)] << 8;\r
+               return (clst & 1) ? (wc >> 4) : (wc & 0xFFF);\r
+\r
+       case FS_FAT16 :\r
+               if (move_window(fs, fsect + (clst / (SS(fs) / 2)))) break;\r
+               return LD_WORD(&fs->win[((WORD)clst * 2) & (SS(fs) - 1)]);\r
+\r
+       case FS_FAT32 :\r
+               if (move_window(fs, fsect + (clst / (SS(fs) / 4)))) break;\r
+               return LD_DWORD(&fs->win[((WORD)clst * 4) & (SS(fs) - 1)]) & 0x0FFFFFFF;\r
+       }\r
+\r
+       return 0xFFFFFFFF;      /* An error occured at the disk I/O layer */\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* FAT access - Change value of a FAT entry                              */\r
+/*-----------------------------------------------------------------------*/\r
+#if !_FS_READONLY\r
+\r
+FRESULT put_fat (\r
+       FATFS *fs,      /* File system object */\r
+       DWORD clst,     /* Cluster# to be changed in range of 2 to fs->max_clust - 1 */\r
+       DWORD val       /* New value to mark the cluster */\r
+)\r
+{\r
+       UINT bc;\r
+       BYTE *p;\r
+       DWORD fsect;\r
+       FRESULT res;\r
+\r
+\r
+       if (clst < 2 || clst >= fs->max_clust) {        /* Range check */\r
+               res = FR_INT_ERR;\r
+\r
+       } else {\r
+               fsect = fs->fatbase;\r
+               switch (fs->fs_type) {\r
+               case FS_FAT12 :\r
+                       bc = clst; bc += bc / 2;\r
+                       res = move_window(fs, fsect + (bc / SS(fs)));\r
+                       if (res != FR_OK) break;\r
+                       p = &fs->win[bc & (SS(fs) - 1)];\r
+                       *p = (clst & 1) ? ((*p & 0x0F) | ((BYTE)val << 4)) : (BYTE)val;\r
+                       bc++;\r
+                       fs->wflag = 1;\r
+                       res = move_window(fs, fsect + (bc / SS(fs)));\r
+                       if (res != FR_OK) break;\r
+                       p = &fs->win[bc & (SS(fs) - 1)];\r
+                       *p = (clst & 1) ? (BYTE)(val >> 4) : ((*p & 0xF0) | ((BYTE)(val >> 8) & 0x0F));\r
+                       break;\r
+\r
+               case FS_FAT16 :\r
+                       res = move_window(fs, fsect + (clst / (SS(fs) / 2)));\r
+                       if (res != FR_OK) break;\r
+                       ST_WORD(&fs->win[((WORD)clst * 2) & (SS(fs) - 1)], (WORD)val);\r
+                       break;\r
+\r
+               case FS_FAT32 :\r
+                       res = move_window(fs, fsect + (clst / (SS(fs) / 4)));\r
+                       if (res != FR_OK) break;\r
+                       ST_DWORD(&fs->win[((WORD)clst * 4) & (SS(fs) - 1)], val);\r
+                       break;\r
+\r
+               default :\r
+                       res = FR_INT_ERR;\r
+               }\r
+               fs->wflag = 1;\r
+       }\r
+\r
+       return res;\r
+}\r
+#endif /* !_FS_READONLY */\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* FAT handling - Remove a cluster chain                                 */\r
+/*-----------------------------------------------------------------------*/\r
+#if !_FS_READONLY\r
+static\r
+FRESULT remove_chain (\r
+       FATFS *fs,                      /* File system object */\r
+       DWORD clst                      /* Cluster# to remove a chain from */\r
+)\r
+{\r
+       FRESULT res;\r
+       DWORD nxt;\r
+\r
+\r
+       if (clst < 2 || clst >= fs->max_clust) {        /* Check the range of cluster# */\r
+               res = FR_INT_ERR;\r
+\r
+       } else {\r
+               res = FR_OK;\r
+               while (clst < fs->max_clust) {                  /* Not a last link? */\r
+                       nxt = get_fat(fs, clst);                        /* Get cluster status */\r
+                       if (nxt == 0) break;                            /* Empty cluster? */\r
+                       if (nxt == 1) { res = FR_INT_ERR; break; }      /* Internal error? */\r
+                       if (nxt == 0xFFFFFFFF) { res = FR_DISK_ERR; break; }    /* Disk error? */\r
+                       res = put_fat(fs, clst, 0);                     /* Mark the cluster "empty" */\r
+                       if (res != FR_OK) break;\r
+                       if (fs->free_clust != 0xFFFFFFFF) {     /* Update FSInfo */\r
+                               fs->free_clust++;\r
+                               fs->fsi_flag = 1;\r
+                       }\r
+                       clst = nxt;     /* Next cluster */\r
+               }\r
+       }\r
+\r
+       return res;\r
+}\r
+#endif\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* FAT handling - Stretch or Create a cluster chain                      */\r
+/*-----------------------------------------------------------------------*/\r
+#if !_FS_READONLY\r
+static\r
+DWORD create_chain (   /* 0:No free cluster, 1:Internal error, 0xFFFFFFFF:Disk error, >=2:New cluster# */\r
+       FATFS *fs,                      /* File system object */\r
+       DWORD clst                      /* Cluster# to stretch. 0 means create a new chain. */\r
+)\r
+{\r
+       DWORD cs, ncl, scl, mcl;\r
+\r
+\r
+       mcl = fs->max_clust;\r
+       if (clst == 0) {                /* Create new chain */\r
+               scl = fs->last_clust;                   /* Get suggested start point */\r
+               if (scl == 0 || scl >= mcl) scl = 1;\r
+       }\r
+       else {                                  /* Stretch existing chain */\r
+               cs = get_fat(fs, clst);                 /* Check the cluster status */\r
+               if (cs < 2) return 1;                   /* It is an invalid cluster */\r
+               if (cs < mcl) return cs;                /* It is already followed by next cluster */\r
+               scl = clst;\r
+       }\r
+\r
+       ncl = scl;                              /* Start cluster */\r
+       for (;;) {\r
+               ncl++;                                                  /* Next cluster */\r
+               if (ncl >= mcl) {                               /* Wrap around */\r
+                       ncl = 2;\r
+                       if (ncl > scl) return 0;        /* No free custer */\r
+               }\r
+               cs = get_fat(fs, ncl);                  /* Get the cluster status */\r
+               if (cs == 0) break;                             /* Found a free cluster */\r
+               if (cs == 0xFFFFFFFF || cs == 1)/* An error occured */\r
+                       return cs;\r
+               if (ncl == scl) return 0;               /* No free custer */\r
+       }\r
+\r
+       if (put_fat(fs, ncl, 0x0FFFFFFF))       /* Mark the new cluster "in use" */\r
+               return 0xFFFFFFFF;\r
+       if (clst != 0) {                                        /* Link it to the previous one if needed */\r
+               if (put_fat(fs, clst, ncl))\r
+                       return 0xFFFFFFFF;\r
+       }\r
+\r
+       fs->last_clust = ncl;                           /* Update FSINFO */\r
+       if (fs->free_clust != 0xFFFFFFFF) {\r
+               fs->free_clust--;\r
+               fs->fsi_flag = 1;\r
+       }\r
+\r
+       return ncl;             /* Return new cluster number */\r
+}\r
+#endif /* !_FS_READONLY */\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Get sector# from cluster#                                             */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+\r
+DWORD clust2sect (     /* !=0: Sector number, 0: Failed - invalid cluster# */\r
+       FATFS *fs,              /* File system object */\r
+       DWORD clst              /* Cluster# to be converted */\r
+)\r
+{\r
+       clst -= 2;\r
+       if (clst >= (fs->max_clust - 2)) return 0;              /* Invalid cluster# */\r
+       return clst * fs->csize + fs->database;\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Directory handling - Seek directory index                             */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+static\r
+FRESULT dir_seek (\r
+       DIR *dj,                /* Pointer to directory object */\r
+       WORD idx                /* Directory index number */\r
+)\r
+{\r
+       DWORD clst;\r
+       WORD ic;\r
+\r
+\r
+       dj->index = idx;\r
+       clst = dj->sclust;\r
+       if (clst == 1 || clst >= dj->fs->max_clust)     /* Check start cluster range */\r
+               return FR_INT_ERR;\r
+       if (!clst && dj->fs->fs_type == FS_FAT32)       /* Replace cluster# 0 with root cluster# if in FAT32 */\r
+               clst = dj->fs->dirbase;\r
+\r
+       if (clst == 0) {        /* Static table */\r
+               dj->clust = clst;\r
+               if (idx >= dj->fs->n_rootdir)           /* Index is out of range */\r
+                       return FR_INT_ERR;\r
+               dj->sect = dj->fs->dirbase + idx / (SS(dj->fs) / 32);   /* Sector# */\r
+       }\r
+       else {                          /* Dynamic table */\r
+               ic = SS(dj->fs) / 32 * dj->fs->csize;   /* Entries per cluster */\r
+               while (idx >= ic) {     /* Follow cluster chain */\r
+                       clst = get_fat(dj->fs, clst);                           /* Get next cluster */\r
+                       if (clst == 0xFFFFFFFF) return FR_DISK_ERR;     /* Disk error */\r
+                       if (clst < 2 || clst >= dj->fs->max_clust)      /* Reached to end of table or int error */\r
+                               return FR_INT_ERR;\r
+                       idx -= ic;\r
+               }\r
+               dj->clust = clst;\r
+               dj->sect = clust2sect(dj->fs, clst) + idx / (SS(dj->fs) / 32);  /* Sector# */\r
+       }\r
+\r
+       dj->dir = dj->fs->win + (idx % (SS(dj->fs) / 32)) * 32; /* Ptr to the entry in the sector */\r
+\r
+       return FR_OK;   /* Seek succeeded */\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Directory handling - Move directory index next                        */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+static\r
+FRESULT dir_next (     /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:EOT and could not streach */\r
+       DIR *dj,                /* Pointer to directory object */\r
+       BOOL streach    /* FALSE: Do not streach table, TRUE: Streach table if needed */\r
+)\r
+{\r
+       DWORD clst;\r
+       WORD i;\r
+\r
+\r
+       i = dj->index + 1;\r
+       if (!i || !dj->sect)    /* Report EOT when index has reached 65535 */\r
+               return FR_NO_FILE;\r
+\r
+       if (!(i % (SS(dj->fs) / 32))) { /* Sector changed? */\r
+               dj->sect++;                                     /* Next sector */\r
+\r
+               if (dj->clust == 0) {   /* Static table */\r
+                       if (i >= dj->fs->n_rootdir)     /* Report EOT when end of table */\r
+                               return FR_NO_FILE;\r
+               }\r
+               else {                                  /* Dynamic table */\r
+                       if (((i / (SS(dj->fs) / 32)) & (dj->fs->csize - 1)) == 0) {     /* Cluster changed? */\r
+                               clst = get_fat(dj->fs, dj->clust);                              /* Get next cluster */\r
+                               if (clst <= 1) return FR_INT_ERR;\r
+                               if (clst == 0xFFFFFFFF) return FR_DISK_ERR;\r
+                               if (clst >= dj->fs->max_clust) {                                /* When it reached end of dynamic table */\r
+#if !_FS_READONLY\r
+                                       BYTE c;\r
+                                       if (!streach) return FR_NO_FILE;                        /* When do not streach, report EOT */\r
+                                       clst = create_chain(dj->fs, dj->clust);         /* Streach cluster chain */\r
+                                       if (clst == 0) return FR_DENIED;                        /* No free cluster */\r
+                                       if (clst == 1) return FR_INT_ERR;\r
+                                       if (clst == 0xFFFFFFFF) return FR_DISK_ERR;\r
+                                       /* Clean-up streached table */\r
+                                       if (move_window(dj->fs, 0)) return FR_DISK_ERR; /* Flush active window */\r
+                                       mem_set(dj->fs->win, 0, SS(dj->fs));                    /* Clear window buffer */\r
+                                       dj->fs->winsect = clust2sect(dj->fs, clst);     /* Cluster start sector */\r
+                                       for (c = 0; c < dj->fs->csize; c++) {           /* Fill the new cluster with 0 */\r
+                                               dj->fs->wflag = 1;\r
+                                               if (move_window(dj->fs, 0)) return FR_DISK_ERR;\r
+                                               dj->fs->winsect++;\r
+                                       }\r
+                                       dj->fs->winsect -= c;                                           /* Rewind window address */\r
+#else\r
+                                       return FR_NO_FILE;                      /* Report EOT */\r
+#endif\r
+                               }\r
+                               dj->clust = clst;                               /* Initialize data for new cluster */\r
+                               dj->sect = clust2sect(dj->fs, clst);\r
+                       }\r
+               }\r
+       }\r
+\r
+       dj->index = i;\r
+       dj->dir = dj->fs->win + (i % (SS(dj->fs) / 32)) * 32;\r
+\r
+       return FR_OK;\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* LFN handling - Test/Pick/Fit an LFN segment from/to directory entry   */\r
+/*-----------------------------------------------------------------------*/\r
+#if _USE_LFN\r
+static\r
+const BYTE LfnOfs[] = {1,3,5,7,9,14,16,18,20,22,24,28,30};     /* Offset of LFN chars in the directory entry */\r
+\r
+\r
+static\r
+BOOL cmp_lfn (                 /* TRUE:Matched, FALSE:Not matched */\r
+       WCHAR *lfnbuf,          /* Pointer to the LFN to be compared */\r
+       BYTE *dir                       /* Pointer to the directory entry containing a part of LFN */\r
+)\r
+{\r
+       int i, s;\r
+       WCHAR wc, uc;\r
+\r
+\r
+       i = ((dir[LDIR_Ord] & 0xBF) - 1) * 13;  /* Get offset in the LFN buffer */\r
+       s = 0; wc = 1;\r
+       do {\r
+               uc = LD_WORD(dir+LfnOfs[s]);    /* Pick an LFN character from the entry */\r
+               if (wc) {       /* Last char has not been processed */\r
+                       wc = ff_wtoupper(uc);           /* Convert it to upper case */\r
+                       if (i >= _MAX_LFN || wc != ff_wtoupper(lfnbuf[i++]))    /* Compare it */\r
+                               return FALSE;                   /* Not matched */\r
+               } else {\r
+                       if (uc != 0xFFFF) return FALSE; /* Check filler */\r
+               }\r
+       } while (++s < 13);                             /* Repeat until all chars in the entry are checked */\r
+\r
+       if ((dir[LDIR_Ord] & 0x40) && wc && lfnbuf[i])  /* Last segment matched but different length */\r
+               return FALSE;\r
+\r
+       return TRUE;                                    /* The part of LFN matched */\r
+}\r
+\r
+\r
+\r
+static\r
+BOOL pick_lfn (                        /* TRUE:Succeeded, FALSE:Buffer overflow */\r
+       WCHAR *lfnbuf,          /* Pointer to the Unicode-LFN buffer */\r
+       BYTE *dir                       /* Pointer to the directory entry */\r
+)\r
+{\r
+       int i, s;\r
+       WCHAR wc, uc;\r
+\r
+\r
+       i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13;  /* Offset in the LFN buffer */\r
+\r
+       s = 0; wc = 1;\r
+       do {\r
+               uc = LD_WORD(dir+LfnOfs[s]);                    /* Pick an LFN character from the entry */\r
+               if (wc) {       /* Last char has not been processed */\r
+                       if (i >= _MAX_LFN) return FALSE;        /* Buffer overflow? */\r
+                       lfnbuf[i++] = wc = uc;                          /* Store it */\r
+               } else {\r
+                       if (uc != 0xFFFF) return FALSE;         /* Check filler */\r
+               }\r
+       } while (++s < 13);                                             /* Read all character in the entry */\r
+\r
+       if (dir[LDIR_Ord] & 0x40) {                             /* Put terminator if it is the last LFN part */\r
+               if (i >= _MAX_LFN) return FALSE;        /* Buffer overflow? */\r
+               lfnbuf[i] = 0;\r
+       }\r
+\r
+       return TRUE;\r
+}\r
+\r
+\r
+#if !_FS_READONLY\r
+static\r
+void fit_lfn (\r
+       const WCHAR *lfnbuf,    /* Pointer to the LFN buffer */\r
+       BYTE *dir,                              /* Pointer to the directory entry */\r
+       BYTE ord,                               /* LFN order (1-20) */\r
+       BYTE sum                                /* SFN sum */\r
+)\r
+{\r
+       int i, s;\r
+       WCHAR wc;\r
+\r
+\r
+       dir[LDIR_Chksum] = sum;                 /* Set check sum */\r
+       dir[LDIR_Attr] = AM_LFN;                /* Set attribute. LFN entry */\r
+       dir[LDIR_Type] = 0;\r
+       ST_WORD(dir+LDIR_FstClusLO, 0);\r
+\r
+       i = (ord - 1) * 13;                             /* Get offset in the LFN buffer */\r
+       s = wc = 0;\r
+       do {\r
+               if (wc != 0xFFFF) wc = lfnbuf[i++];     /* Get an effective char */\r
+               ST_WORD(dir+LfnOfs[s], wc);     /* Put it */\r
+               if (!wc) wc = 0xFFFF;           /* Padding chars following last char */\r
+       } while (++s < 13);\r
+       if (wc == 0xFFFF || !lfnbuf[i]) ord |= 0x40;    /* Bottom LFN part is the start of LFN sequence */\r
+       dir[LDIR_Ord] = ord;                    /* Set the LFN order */\r
+}\r
+\r
+#endif\r
+#endif\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Create numbered name                                                  */\r
+/*-----------------------------------------------------------------------*/\r
+#if _USE_LFN\r
+void gen_numname (\r
+       BYTE *dst,                      /* Pointer to genartated SFN */\r
+       const BYTE *src,        /* Pointer to source SFN to be modified */\r
+       const WCHAR *lfn,       /* Pointer to LFN */\r
+       WORD num                        /* Sequense number */\r
+)\r
+{\r
+       char ns[8];\r
+       int i, j;\r
+\r
+\r
+       mem_cpy(dst, src, 11);\r
+\r
+       if (num > 5) {  /* On many collisions, generate a hash number instead of sequencial number */\r
+               do num = (num >> 1) + (num << 15) + (WORD)*lfn++; while (*lfn);\r
+       }\r
+\r
+       /* itoa */\r
+       i = 7;\r
+       do {\r
+               ns[i--] = (num % 10) + '0';\r
+               num /= 10;\r
+       } while (num);\r
+       ns[i] = '~';\r
+\r
+       /* Append the number */\r
+       for (j = 0; j < i && dst[j] != ' '; j++) {\r
+               if (IsDBCS1(dst[j])) {\r
+                       if (j == i - 1) break;\r
+                       j++;\r
+               }\r
+       }\r
+       do {\r
+               dst[j++] = (i < 8) ? ns[i++] : ' ';\r
+       } while (j < 8);\r
+}\r
+#endif\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Calculate sum of an SFN                                               */\r
+/*-----------------------------------------------------------------------*/\r
+#if _USE_LFN\r
+static\r
+BYTE sum_sfn (\r
+       const BYTE *dir         /* Ptr to directory entry */\r
+)\r
+{\r
+       BYTE sum = 0;\r
+       int n = 11;\r
+\r
+       do sum = (sum >> 1) + (sum << 7) + *dir++; while (--n);\r
+       return sum;\r
+}\r
+#endif\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Directory handling - Find an object in the directory                  */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+static\r
+FRESULT dir_find (\r
+       DIR *dj                 /* Pointer to the directory object linked to the file name */\r
+)\r
+{\r
+       FRESULT res;\r
+       BYTE c, *dir;\r
+#if _USE_LFN\r
+       BYTE a, ord, sum;\r
+#endif\r
+\r
+       res = dir_seek(dj, 0);                  /* Rewind directory object */\r
+       if (res != FR_OK) return res;\r
+\r
+#if _USE_LFN\r
+       ord = sum = 0xFF;\r
+#endif\r
+       do {\r
+               res = move_window(dj->fs, dj->sect);\r
+               if (res != FR_OK) break;\r
+               dir = dj->dir;                                  /* Ptr to the directory entry of current index */\r
+               c = dir[DIR_Name];\r
+               if (c == 0) { res = FR_NO_FILE; break; }        /* Reached to end of table */\r
+#if _USE_LFN   /* LFN configuration */\r
+               a = dir[DIR_Attr] & AM_MASK;\r
+               if (c == 0xE5 || ((a & AM_VOL) && a != AM_LFN)) {       /* An entry without valid data */\r
+                       ord = 0xFF;\r
+               } else {\r
+                       if (a == AM_LFN) {                      /* An LFN entry is found */\r
+                               if (dj->lfn) {\r
+                                       if (c & 0x40) {         /* Is it start of LFN sequence? */\r
+                                               sum = dir[LDIR_Chksum];\r
+                                               c &= 0xBF; ord = c;     /* LFN start order */\r
+                                               dj->lfn_idx = dj->index;\r
+                                       }\r
+                                       /* Check validity of the LFN entry and compare it with given name */\r
+                                       ord = (c == ord && sum == dir[LDIR_Chksum] && cmp_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF;\r
+                               }\r
+                       } else {                                        /* An SFN entry is found */\r
+                               if (!ord && sum == sum_sfn(dir)) break; /* LFN matched? */\r
+                               ord = 0xFF; dj->lfn_idx = 0xFFFF;       /* Reset LFN sequence */\r
+                               if (!(dj->fn[NS] & NS_LOSS) && !mem_cmp(dir, dj->fn, 11)) break;        /* SFN matched? */\r
+                       }\r
+               }\r
+#else          /* Non LFN configuration */\r
+               if (!(dir[DIR_Attr] & AM_VOL) && !mem_cmp(dir, dj->fn, 11)) /* Is it a valid entry? */\r
+                       break;\r
+#endif\r
+               res = dir_next(dj, FALSE);              /* Next entry */\r
+       } while (res == FR_OK);\r
+\r
+       return res;\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Read an object from the directory                                     */\r
+/*-----------------------------------------------------------------------*/\r
+#if _FS_MINIMIZE <= 1\r
+static\r
+FRESULT dir_read (\r
+       DIR *dj                 /* Pointer to the directory object that pointing the entry to be read */\r
+)\r
+{\r
+       FRESULT res;\r
+       BYTE c, *dir;\r
+#if _USE_LFN\r
+       BYTE a, ord = 0xFF, sum = 0xFF;\r
+#endif\r
+\r
+       res = FR_NO_FILE;\r
+       while (dj->sect) {\r
+               res = move_window(dj->fs, dj->sect);\r
+               if (res != FR_OK) break;\r
+               dir = dj->dir;                                  /* Ptr to the directory entry of current index */\r
+               c = dir[DIR_Name];\r
+               if (c == 0) { res = FR_NO_FILE; break; }        /* Reached to end of table */\r
+#if _USE_LFN   /* LFN configuration */\r
+               a = dir[DIR_Attr] & AM_MASK;\r
+               if (c == 0xE5 || (!_FS_RPATH && c == '.') || ((a & AM_VOL) && a != AM_LFN)) {   /* An entry without valid data */\r
+                       ord = 0xFF;\r
+               } else {\r
+                       if (a == AM_LFN) {                      /* An LFN entry is found */\r
+                               if (c & 0x40) {                 /* Is it start of LFN sequence? */\r
+                                       sum = dir[LDIR_Chksum];\r
+                                       c &= 0xBF; ord = c;\r
+                                       dj->lfn_idx = dj->index;\r
+                               }\r
+                               /* Check LFN validity and capture it */\r
+                               ord = (c == ord && sum == dir[LDIR_Chksum] && pick_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF;\r
+                       } else {                                        /* An SFN entry is found */\r
+                               if (ord || sum != sum_sfn(dir)) /* Is there a valid LFN? */\r
+                                       dj->lfn_idx = 0xFFFF;           /* It has no LFN. */\r
+                               break;\r
+                       }\r
+               }\r
+#else          /* Non LFN configuration */\r
+               if (c != 0xE5 && (_FS_RPATH || c != '.') && !(dir[DIR_Attr] & AM_VOL))  /* Is it a valid entry? */\r
+                       break;\r
+#endif\r
+               res = dir_next(dj, FALSE);                              /* Next entry */\r
+               if (res != FR_OK) break;\r
+       }\r
+\r
+       if (res != FR_OK) dj->sect = 0;\r
+\r
+       return res;\r
+}\r
+#endif\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Register an object to the directory                                   */\r
+/*-----------------------------------------------------------------------*/\r
+#if !_FS_READONLY\r
+static\r
+FRESULT dir_register ( /* FR_OK:Successful, FR_DENIED:No free entry or too many SFN collision, FR_DISK_ERR:Disk error */\r
+       DIR *dj                         /* Target directory with object name to be created */\r
+)\r
+{\r
+       FRESULT res;\r
+       BYTE c, *dir;\r
+#if _USE_LFN   /* LFN configuration */\r
+       WORD n, ne, is;\r
+       BYTE sn[12], *fn, sum;\r
+       WCHAR *lfn;\r
+\r
+\r
+       fn = dj->fn; lfn = dj->lfn;\r
+       mem_cpy(sn, fn, 12);\r
+\r
+       if (_FS_RPATH && (sn[NS] & NS_DOT)) return FR_INVALID_NAME;     /* Cannot create dot entry */\r
+\r
+       if (sn[NS] & NS_LOSS) {                 /* When LFN is out of 8.3 format, generate a numbered name */\r
+               fn[NS] = 0; dj->lfn = NULL;                     /* Find only SFN */\r
+               for (n = 1; n < 100; n++) {\r
+                       gen_numname(fn, sn, lfn, n);    /* Generate a numbered name */\r
+                       res = dir_find(dj);                             /* Check if the name collides with existing SFN */\r
+                       if (res != FR_OK) break;\r
+               }\r
+               if (n == 100) return FR_DENIED;         /* Abort if too many collisions */\r
+               if (res != FR_NO_FILE) return res;      /* Abort if the result is other than 'not collided' */\r
+               fn[NS] = sn[NS]; dj->lfn = lfn;\r
+       }\r
+\r
+       if (sn[NS] & NS_LFN) {                  /* When LFN is to be created, reserve reserve an SFN + LFN entries. */\r
+               for (ne = 0; lfn[ne]; ne++) ;\r
+               ne = (ne + 25) / 13;\r
+       } else {                                                /* Otherwise reserve only an SFN entry. */\r
+               ne = 1;\r
+       }\r
+\r
+       /* Reserve contiguous entries */\r
+       res = dir_seek(dj, 0);\r
+       if (res != FR_OK) return res;\r
+       n = is = 0;\r
+       do {\r
+               res = move_window(dj->fs, dj->sect);\r
+               if (res != FR_OK) break;\r
+               c = *dj->dir;                           /* Check the entry status */\r
+               if (c == 0xE5 || c == 0) {      /* Is it a blank entry? */\r
+                       if (n == 0) is = dj->index;     /* First index of the contigulus entry */\r
+                       if (++n == ne) break;   /* A contiguous entry that requiered count is found */\r
+               } else {\r
+                       n = 0;                                  /* Not a blank entry. Restart to search */\r
+               }\r
+               res = dir_next(dj, TRUE);       /* Next entry with table streach */\r
+       } while (res == FR_OK);\r
+\r
+       if (res == FR_OK && ne > 1) {   /* Initialize LFN entry if needed */\r
+               res = dir_seek(dj, is);\r
+               if (res == FR_OK) {\r
+                       sum = sum_sfn(dj->fn);  /* Sum of the SFN tied to the LFN */\r
+                       ne--;\r
+                       do {                                    /* Store LFN entries in bottom first */\r
+                               res = move_window(dj->fs, dj->sect);\r
+                               if (res != FR_OK) break;\r
+                               fit_lfn(dj->lfn, dj->dir, (BYTE)ne, sum);\r
+                               dj->fs->wflag = 1;\r
+                               res = dir_next(dj, FALSE);      /* Next entry */\r
+                       } while (res == FR_OK && --ne);\r
+               }\r
+       }\r
+\r
+#else  /* Non LFN configuration */\r
+       res = dir_seek(dj, 0);\r
+       if (res == FR_OK) {\r
+               do {    /* Find a blank entry for the SFN */\r
+                       res = move_window(dj->fs, dj->sect);\r
+                       if (res != FR_OK) break;\r
+                       c = *dj->dir;\r
+                       if (c == 0xE5 || c == 0) break; /* Is it a blank entry? */\r
+                       res = dir_next(dj, TRUE);               /* Next entry with table streach */\r
+               } while (res == FR_OK);\r
+       }\r
+#endif\r
+\r
+       if (res == FR_OK) {             /* Initialize the SFN entry */\r
+               res = move_window(dj->fs, dj->sect);\r
+               if (res == FR_OK) {\r
+                       dir = dj->dir;\r
+                       mem_set(dir, 0, 32);            /* Clean the entry */\r
+                       mem_cpy(dir, dj->fn, 11);       /* Put SFN */\r
+                       dir[DIR_NTres] = *(dj->fn+NS) & (NS_BODY | NS_EXT);     /* Put NT flag */\r
+                       dj->fs->wflag = 1;\r
+               }\r
+       }\r
+\r
+       return res;\r
+}\r
+#endif /* !_FS_READONLY */\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Remove an object from the directory                                   */\r
+/*-----------------------------------------------------------------------*/\r
+#if !_FS_READONLY && !_FS_MINIMIZE\r
+static\r
+FRESULT dir_remove (   /* FR_OK: Successful, FR_DISK_ERR: A disk error */\r
+       DIR *dj                         /* Directory object pointing the entry to be removed */\r
+)\r
+{\r
+       FRESULT res;\r
+#if _USE_LFN   /* LFN configuration */\r
+       WORD i;\r
+\r
+       i = dj->index;  /* SFN index */\r
+       res = dir_seek(dj, (WORD)((dj->lfn_idx == 0xFFFF) ? i : dj->lfn_idx));  /* Goto the SFN or top of the LFN entries */\r
+       if (res == FR_OK) {\r
+               do {\r
+                       res = move_window(dj->fs, dj->sect);\r
+                       if (res != FR_OK) break;\r
+                       *dj->dir = 0xE5;                        /* Mark the entry "deleted" */\r
+                       dj->fs->wflag = 1;\r
+                       if (dj->index >= i) break;      /* When reached SFN, all entries of the object has been deleted. */\r
+                       res = dir_next(dj, FALSE);      /* Next entry */\r
+               } while (res == FR_OK);\r
+               if (res == FR_NO_FILE) res = FR_INT_ERR;\r
+       }\r
+\r
+#else                  /* Non LFN configuration */\r
+       res = dir_seek(dj, dj->index);\r
+       if (res == FR_OK) {\r
+               res = move_window(dj->fs, dj->sect);\r
+               if (res == FR_OK) {\r
+                       *dj->dir = 0xE5;                        /* Mark the entry "deleted" */\r
+                       dj->fs->wflag = 1;\r
+               }\r
+       }\r
+#endif\r
+\r
+       return res;\r
+}\r
+#endif /* !_FS_READONLY */\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Pick a segment and create the object name in directory form           */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+static\r
+FRESULT create_name (\r
+       DIR *dj,                        /* Pointer to the directory object */\r
+       const XCHAR **path      /* Pointer to pointer to the segment in the path string */\r
+)\r
+{\r
+#ifdef _EXCVT\r
+       static const BYTE cvt[] = _EXCVT;\r
+#endif\r
+\r
+#if _USE_LFN   /* LFN configuration */\r
+       BYTE b, cf;\r
+       WCHAR w, *lfn;\r
+       int i, ni, si, di;\r
+       const XCHAR *p;\r
+\r
+       /* Create LFN in Unicode */\r
+       si = di = 0;\r
+       p = *path;\r
+       lfn = dj->lfn;\r
+       for (;;) {\r
+               w = p[si++];                                    /* Get a character */\r
+               if (w < ' ' || w == '/' || w == '\\') break;    /* Break on end of segment */\r
+               if (di >= _MAX_LFN)                             /* Reject too long name */\r
+                       return FR_INVALID_NAME;\r
+#if !_LFN_UNICODE\r
+               w &= 0xFF;\r
+               if (IsDBCS1(w)) {                               /* If it is a DBC 1st byte */\r
+                       b = p[si++];                            /* Get 2nd byte */\r
+                       if (!IsDBCS2(b))                        /* Reject invalid code for DBC */\r
+                               return FR_INVALID_NAME;\r
+                       w = (w << 8) + b;\r
+               }\r
+               w = ff_convert(w, 1);                   /* Convert OEM to Unicode */\r
+               if (!w) return FR_INVALID_NAME; /* Reject invalid code */\r
+#endif\r
+               if (w < 0x80 && chk_chr("\"*:<>\?|\x7F", w)) /* Reject illegal chars for LFN */\r
+                       return FR_INVALID_NAME;\r
+               lfn[di++] = w;                                  /* Store the Unicode char */\r
+       }\r
+       *path = &p[si];                                         /* Rerurn pointer to the next segment */\r
+       cf = (w < ' ') ? NS_LAST : 0;           /* Set last segment flag if end of path */\r
+#if _FS_RPATH\r
+       if ((di == 1 && lfn[di - 1] == '.') || /* Is this a dot entry? */\r
+               (di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) {\r
+               lfn[di] = 0;\r
+               for (i = 0; i < 11; i++)\r
+                       dj->fn[i] = (i < di) ? '.' : ' ';\r
+               dj->fn[i] = cf | NS_DOT;                /* This is a dot entry */\r
+               return FR_OK;\r
+       }\r
+#endif\r
+       while (di) {                                            /* Strip trailing spaces and dots */\r
+               w = lfn[di - 1];\r
+               if (w != ' ' && w != '.') break;\r
+               di--;\r
+       }\r
+       if (!di) return FR_INVALID_NAME;        /* Reject null string */\r
+\r
+       lfn[di] = 0;                                            /* LFN is created */\r
+\r
+       /* Create SFN in directory form */\r
+       mem_set(dj->fn, ' ', 11);\r
+       for (si = 0; lfn[si] == ' ' || lfn[si] == '.'; si++) ;  /* Strip leading spaces and dots */\r
+       if (si) cf |= NS_LOSS | NS_LFN;\r
+       while (di && lfn[di - 1] != '.') di--;  /* Find extension (di<=si: no extension) */\r
+\r
+       b = i = 0; ni = 8;\r
+       for (;;) {\r
+               w = lfn[si++];                                  /* Get an LFN char */\r
+               if (!w) break;                                  /* Break on enf of the LFN */\r
+               if (w == ' ' || (w == '.' && si != di)) {       /* Remove spaces and dots */\r
+                       cf |= NS_LOSS | NS_LFN; continue;\r
+               }\r
+\r
+               if (i >= ni || si == di) {              /* Extension or end of SFN */\r
+                       if (ni == 11) {                         /* Long extension */\r
+                               cf |= NS_LOSS | NS_LFN; break;\r
+                       }\r
+                       if (si != di) cf |= NS_LOSS | NS_LFN;   /* Out of 8.3 format */\r
+                       if (si > di) break;                     /* No extension */\r
+                       si = di; i = 8; ni = 11;        /* Enter extension section */\r
+                       b <<= 2; continue;\r
+               }\r
+\r
+               if (w >= 0x80) {                                /* Non ASCII char */\r
+#ifdef _EXCVT\r
+                       w = ff_convert(w, 0);           /* Unicode -> OEM code */\r
+                       if (w) w = cvt[w - 0x80];       /* Convert extended char to upper (SBCS) */\r
+#else\r
+                       w = ff_convert(ff_wtoupper(w), 0);      /* Upper converted Unicode -> OEM code */\r
+#endif\r
+                       cf |= NS_LFN;                           /* Force create LFN entry */\r
+               }\r
+\r
+               if (_DF1S && w >= 0x100) {              /* Double byte char */\r
+                       if (i >= ni - 1) {\r
+                               cf |= NS_LOSS | NS_LFN; i = ni; continue;\r
+                       }\r
+                       dj->fn[i++] = (BYTE)(w >> 8);\r
+               } else {                                                /* Single byte char */\r
+                       if (!w || chk_chr("+,;[=]", w)) {               /* Replace illegal chars for SFN */\r
+                               w = '_'; cf |= NS_LOSS | NS_LFN;        /* Lossy conversion */\r
+                       } else {\r
+                               if (IsUpper(w)) {               /* ASCII large capital */\r
+                                       b |= 2;\r
+                               } else {\r
+                                       if (IsLower(w)) {       /* ASCII small capital */\r
+                                               b |= 1; w -= 0x20;\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+               dj->fn[i++] = (BYTE)w;\r
+       }\r
+\r
+       if (dj->fn[0] == 0xE5) dj->fn[0] = 0x05;        /* If the first char collides with deleted mark, replace it with 0x05 */\r
+\r
+       if (ni == 8) b <<= 2;\r
+       if ((b & 0x0C) == 0x0C || (b & 0x03) == 0x03)   /* Create LFN entry when there are composite capitals */\r
+               cf |= NS_LFN;\r
+       if (!(cf & NS_LFN)) {                                           /* When LFN is in 8.3 format without extended char, NT flags are created */\r
+               if ((b & 0x03) == 0x01) cf |= NS_EXT;   /* NT flag (Extension has only small capital) */\r
+               if ((b & 0x0C) == 0x04) cf |= NS_BODY;  /* NT flag (Filename has only small capital) */\r
+       }\r
+\r
+       dj->fn[NS] = cf;        /* SFN is created */\r
+\r
+       return FR_OK;\r
+\r
+\r
+#else  /* Non-LFN configuration */\r
+       BYTE b, c, d, *sfn;\r
+       int ni, si, i;\r
+       const char *p;\r
+\r
+       /* Create file name in directory form */\r
+       sfn = dj->fn;\r
+       mem_set(sfn, ' ', 11);\r
+       si = i = b = 0; ni = 8;\r
+       p = *path;\r
+#if _FS_RPATH\r
+       if (p[si] == '.') { /* Is this a dot entry? */\r
+               for (;;) {\r
+                       c = p[si++];\r
+                       if (c != '.' || si >= 3) break;\r
+                       sfn[i++] = c;\r
+               }\r
+               if (c != '/' && c != '\\' && c > ' ') return FR_INVALID_NAME;\r
+               *path = &p[si];                                                                 /* Rerurn pointer to the next segment */\r
+               sfn[NS] = (c <= ' ') ? NS_LAST | NS_DOT : NS_DOT;       /* Set last segment flag if end of path */\r
+               return FR_OK;\r
+       }\r
+#endif\r
+       for (;;) {\r
+               c = p[si++];\r
+               if (c <= ' ' || c == '/' || c == '\\') break;   /* Break on end of segment */\r
+               if (c == '.' || i >= ni) {\r
+                       if (ni != 8 || c != '.') return FR_INVALID_NAME;\r
+                       i = 8; ni = 11;\r
+                       b <<= 2; continue;\r
+               }\r
+               if (c >= 0x80) {                                /* Extended char */\r
+#ifdef _EXCVT\r
+                       c = cvt[c - 0x80];                      /* Convert extend char (SBCS) */\r
+#else\r
+                       b |= 3;                                         /* Eliminate NT flag if ext char is exist */\r
+#if !_DF1S     /* ASCII only cfg */\r
+                       return FR_INVALID_NAME;\r
+#endif\r
+#endif\r
+               }\r
+               if (IsDBCS1(c)) {                               /* DBC 1st byte? */\r
+                       d = p[si++];                            /* Get 2nd byte */\r
+                       if (!IsDBCS2(d) || i >= ni - 1) /* Reject invalid DBC */\r
+                               return FR_INVALID_NAME;\r
+                       sfn[i++] = c;\r
+                       sfn[i++] = d;\r
+               } else {                                                /* Single byte code */\r
+                       if (chk_chr(" \"*+,[=]|\x7F", c))       /* Reject illegal chrs for SFN */\r
+                               return FR_INVALID_NAME;\r
+                       if (IsUpper(c)) {                       /* ASCII large capital? */\r
+                               b |= 2;\r
+                       } else {\r
+                               if (IsLower(c)) {               /* ASCII small capital? */\r
+                                       b |= 1; c -= 0x20;\r
+                               }\r
+                       }\r
+                       sfn[i++] = c;\r
+               }\r
+       }\r
+       *path = &p[si];                                         /* Rerurn pointer to the next segment */\r
+       c = (c <= ' ') ? NS_LAST : 0;           /* Set last segment flag if end of path */\r
+\r
+       if (!i) return FR_INVALID_NAME;         /* Reject null string */\r
+       if (sfn[0] == 0xE5) sfn[0] = 0x05;      /* When first char collides with 0xE5, replace it with 0x05 */\r
+\r
+       if (ni == 8) b <<= 2;\r
+       if ((b & 0x03) == 0x01) c |= NS_EXT;    /* NT flag (Extension has only small capital) */\r
+       if ((b & 0x0C) == 0x04) c |= NS_BODY;   /* NT flag (Filename has only small capital) */\r
+\r
+       sfn[NS] = c;            /* Store NT flag, File name is created */\r
+\r
+       return FR_OK;\r
+#endif\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Get file information from directory entry                             */\r
+/*-----------------------------------------------------------------------*/\r
+#if _FS_MINIMIZE <= 1\r
+static\r
+void get_fileinfo (            /* No return code */\r
+       DIR *dj,                        /* Pointer to the directory object */\r
+       FILINFO *fno            /* Pointer to the file information to be filled */\r
+)\r
+{\r
+       int i;\r
+       BYTE c, nt, *dir;\r
+       char *p;\r
+\r
+\r
+       p = fno->fname;\r
+       if (dj->sect) {\r
+               dir = dj->dir;\r
+               nt = dir[DIR_NTres];            /* NT flag */\r
+               for (i = 0; i < 8; i++) {       /* Copy name body */\r
+                       c = dir[i];\r
+                       if (c == ' ') break;\r
+                       if (c == 0x05) c = 0xE5;\r
+                       if (_USE_LFN && (nt & NS_BODY) && IsUpper(c)) c += 0x20;\r
+                       *p++ = c;\r
+               }\r
+               if (dir[8] != ' ') {            /* Copy name extension */\r
+                       *p++ = '.';\r
+                       for (i = 8; i < 11; i++) {\r
+                               c = dir[i];\r
+                               if (c == ' ') break;\r
+                               if (_USE_LFN && (nt & NS_EXT) && IsUpper(c)) c += 0x20;\r
+                               *p++ = c;\r
+                       }\r
+               }\r
+               fno->fattrib = dir[DIR_Attr];                           /* Attribute */\r
+               fno->fsize = LD_DWORD(dir+DIR_FileSize);        /* Size */\r
+               fno->fdate = LD_WORD(dir+DIR_WrtDate);          /* Date */\r
+               fno->ftime = LD_WORD(dir+DIR_WrtTime);          /* Time */\r
+       }\r
+       *p = 0;\r
+\r
+#if _USE_LFN\r
+       if (fno->lfname) {\r
+               XCHAR *tp = fno->lfname;\r
+               WCHAR w, *lfn;\r
+\r
+               i = 0;\r
+               if (dj->sect && dj->lfn_idx != 0xFFFF) {/* Get LFN if available */\r
+                       lfn = dj->lfn;\r
+                       while ((w = *lfn++) != 0) {                     /* Get an LFN char */\r
+#if !_LFN_UNICODE\r
+                               w = ff_convert(w, 0);                   /* Unicode -> OEM conversion */\r
+                               if (!w) { i = 0; break; }               /* Could not convert, no LFN */\r
+                               if (_DF1S && w >= 0x100)                /* Put 1st byte if it is a DBC */\r
+                                       tp[i++] = (XCHAR)(w >> 8);\r
+#endif\r
+                               if (i >= fno->lfsize - 1) { i = 0; break; }     /* Buffer overrun, no LFN */\r
+                               tp[i++] = (XCHAR)w;\r
+                       }\r
+               }\r
+               tp[i] = 0;      /* Terminator */\r
+       }\r
+#endif\r
+}\r
+#endif /* _FS_MINIMIZE <= 1 */\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Follow a file path                                                    */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+static\r
+FRESULT follow_path (  /* FR_OK(0): successful, !=0: error code */\r
+       DIR *dj,                        /* Directory object to return last directory and found object */\r
+       const XCHAR *path       /* Full-path string to find a file or directory */\r
+)\r
+{\r
+       FRESULT res;\r
+       BYTE *dir, last;\r
+\r
+\r
+       while (!_USE_LFN && *path == ' ') path++;       /* Skip leading spaces */\r
+#if _FS_RPATH\r
+       if (*path == '/' || *path == '\\') { /* There is a heading separator */\r
+               path++; dj->sclust = 0;         /* Strip it and start from the root dir */\r
+       } else {                                                        /* No heading saparator */\r
+               dj->sclust = dj->fs->cdir;      /* Start from the current dir */\r
+       }\r
+#else\r
+       if (*path == '/' || *path == '\\')      /* Strip heading separator if exist */\r
+               path++;\r
+       dj->sclust = 0;                                         /* Start from the root dir */\r
+#endif\r
+\r
+       if ((UINT)*path < ' ') {                        /* Null path means the start directory itself */\r
+               res = dir_seek(dj, 0);\r
+               dj->dir = NULL;\r
+\r
+       } else {                                                        /* Follow path */\r
+               for (;;) {\r
+                       res = create_name(dj, &path);   /* Get a segment */\r
+                       if (res != FR_OK) break;\r
+                       res = dir_find(dj);                             /* Find it */\r
+                       last = *(dj->fn+NS) & NS_LAST;\r
+                       if (res != FR_OK) {                             /* Could not find the object */\r
+                               if (res == FR_NO_FILE && !last)\r
+                                       res = FR_NO_PATH;\r
+                               break;\r
+                       }\r
+                       if (last) break;                                /* Last segment match. Function completed. */\r
+                       dir = dj->dir;                                  /* There is next segment. Follow the sub directory */\r
+                       if (!(dir[DIR_Attr] & AM_DIR)) { /* Cannot follow because it is a file */\r
+                               res = FR_NO_PATH; break;\r
+                       }\r
+                       dj->sclust = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);\r
+               }\r
+       }\r
+\r
+       return res;\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Load boot record and check if it is an FAT boot record                */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+static\r
+BYTE check_fs (        /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record, 3:Error */\r
+       FATFS *fs,      /* File system object */\r
+       DWORD sect      /* Sector# (lba) to check if it is an FAT boot record or not */\r
+)\r
+{\r
+       if (disk_read(fs->drive, fs->win, sect, 1) != RES_OK)   /* Load boot record */\r
+               return 3;\r
+       if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55)               /* Check record signature (always placed at offset 510 even if the sector size is >512) */\r
+               return 2;\r
+\r
+       if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146) /* Check "FAT" string */\r
+               return 0;\r
+       if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)\r
+               return 0;\r
+\r
+       return 1;\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Make sure that the file system is valid                               */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+\r
+FRESULT chk_mounted (  /* FR_OK(0): successful, !=0: any error occured */\r
+       const XCHAR **path,     /* Pointer to pointer to the path name (drive number) */\r
+       FATFS **rfs,            /* Pointer to pointer to the found file system object */\r
+       BYTE chk_wp                     /* !=0: Check media write protection for write access */\r
+)\r
+{\r
+       BYTE fmt, *tbl;\r
+       UINT vol;\r
+       DSTATUS stat;\r
+       DWORD bsect, fsize, tsect, mclst;\r
+       const XCHAR *p = *path;\r
+       FATFS *fs;\r
+\r
+       /* Get logical drive number from the path name */\r
+       vol = p[0] - '0';                               /* Is there a drive number? */\r
+       if (vol <= 9 && p[1] == ':') {  /* Found a drive number, get and strip it */\r
+               p += 2; *path = p;                      /* Return pointer to the path name */\r
+       } else {                                                /* No drive number is given */\r
+#if _FS_RPATH\r
+               vol = Drive;                            /* Use current drive */\r
+#else\r
+               vol = 0;                                        /* Use drive 0 */\r
+#endif\r
+       }\r
+\r
+       /* Check if the logical drive is valid or not */\r
+       if (vol >= _DRIVES)                     /* Is the drive number valid? */\r
+               return FR_INVALID_DRIVE;\r
+       *rfs = fs = FatFs[vol];                 /* Returen pointer to the corresponding file system object */\r
+       if (!fs) return FR_NOT_ENABLED; /* Is the file system object available? */\r
+\r
+       ENTER_FF(fs);                                   /* Lock file system */\r
+\r
+       if (fs->fs_type) {                              /* If the logical drive has been mounted */\r
+               stat = disk_status(fs->drive);\r
+               if (!(stat & STA_NOINIT)) {     /* and the physical drive is kept initialized (has not been changed), */\r
+#if !_FS_READONLY\r
+                       if (chk_wp && (stat & STA_PROTECT))     /* Check write protection if needed */\r
+                               return FR_WRITE_PROTECTED;\r
+#endif\r
+                       return FR_OK;                   /* The file system object is valid */\r
+               }\r
+       }\r
+\r
+       /* The logical drive must be mounted. Following code attempts to mount the volume */\r
+\r
+       fs->fs_type = 0;                                        /* Clear the file system object */\r
+       fs->drive = (BYTE)LD2PD(vol);           /* Bind the logical drive and a physical drive */\r
+       stat = disk_initialize(fs->drive);      /* Initialize low level disk I/O layer */\r
+       if (stat & STA_NOINIT)                          /* Check if the drive is ready */\r
+               return FR_NOT_READY;\r
+#if _MAX_SS != 512                                             /* Get disk sector size if needed */\r
+       if (disk_ioctl(fs->drive, GET_SECTOR_SIZE, &SS(fs)) != RES_OK || SS(fs) > _MAX_SS)\r
+               return FR_NO_FILESYSTEM;\r
+#endif\r
+#if !_FS_READONLY\r
+       if (chk_wp && (stat & STA_PROTECT))     /* Check disk write protection if needed */\r
+               return FR_WRITE_PROTECTED;\r
+#endif\r
+       /* Search FAT partition on the drive */\r
+       fmt = check_fs(fs, bsect = 0);          /* Check sector 0 as an SFD format */\r
+       if (fmt == 1) {                                         /* Not an FAT boot record, it may be patitioned */\r
+               /* Check a partition listed in top of the partition table */\r
+               tbl = &fs->win[MBR_Table + LD2PT(vol) * 16];    /* Partition table */\r
+               if (tbl[4]) {                                                                   /* Is the partition existing? */\r
+                       bsect = LD_DWORD(&tbl[8]);                                      /* Partition offset in LBA */\r
+                       fmt = check_fs(fs, bsect);                                      /* Check the partition */\r
+               }\r
+       }\r
+       if (fmt == 3) return FR_DISK_ERR;\r
+       if (fmt || LD_WORD(fs->win+BPB_BytsPerSec) != SS(fs))   /* No valid FAT patition is found */\r
+               return FR_NO_FILESYSTEM;\r
+\r
+       /* Initialize the file system object */\r
+       fsize = LD_WORD(fs->win+BPB_FATSz16);                           /* Number of sectors per FAT */\r
+       if (!fsize) fsize = LD_DWORD(fs->win+BPB_FATSz32);\r
+       fs->sects_fat = fsize;\r
+       fs->n_fats = fs->win[BPB_NumFATs];                                      /* Number of FAT copies */\r
+       fsize *= fs->n_fats;                                                            /* (Number of sectors in FAT area) */\r
+       fs->fatbase = bsect + LD_WORD(fs->win+BPB_RsvdSecCnt); /* FAT start sector (lba) */\r
+       fs->csize = fs->win[BPB_SecPerClus];                            /* Number of sectors per cluster */\r
+       fs->n_rootdir = LD_WORD(fs->win+BPB_RootEntCnt);        /* Nmuber of root directory entries */\r
+       tsect = LD_WORD(fs->win+BPB_TotSec16);                          /* Number of sectors on the volume */\r
+       if (!tsect) tsect = LD_DWORD(fs->win+BPB_TotSec32);\r
+       fs->max_clust = mclst = (tsect                                          /* Last cluster# + 1 (Number of clusters + 2) */\r
+               - LD_WORD(fs->win+BPB_RsvdSecCnt) - fsize - fs->n_rootdir / (SS(fs)/32)\r
+               ) / fs->csize + 2;\r
+\r
+       fmt = FS_FAT12;                                                                         /* Determine the FAT sub type */\r
+       if (mclst >= 0xFF7) fmt = FS_FAT16;                                     /* Number of clusters >= 0xFF5 */\r
+       if (mclst >= 0xFFF7) fmt = FS_FAT32;                            /* Number of clusters >= 0xFFF5 */\r
+\r
+       if (fmt == FS_FAT32)\r
+               fs->dirbase = LD_DWORD(fs->win+BPB_RootClus);   /* Root directory start cluster */\r
+       else\r
+               fs->dirbase = fs->fatbase + fsize;                              /* Root directory start sector (lba) */\r
+       fs->database = fs->fatbase + fsize + fs->n_rootdir / (SS(fs)/32);       /* Data start sector (lba) */\r
+\r
+#if !_FS_READONLY\r
+       /* Initialize allocation information */\r
+       fs->free_clust = 0xFFFFFFFF;\r
+       fs->wflag = 0;\r
+       /* Get fsinfo if needed */\r
+       if (fmt == FS_FAT32) {\r
+               fs->fsi_flag = 0;\r
+               fs->fsi_sector = bsect + LD_WORD(fs->win+BPB_FSInfo);\r
+               if (disk_read(fs->drive, fs->win, fs->fsi_sector, 1) == RES_OK &&\r
+                       LD_WORD(fs->win+BS_55AA) == 0xAA55 &&\r
+                       LD_DWORD(fs->win+FSI_LeadSig) == 0x41615252 &&\r
+                       LD_DWORD(fs->win+FSI_StrucSig) == 0x61417272) {\r
+                       fs->last_clust = LD_DWORD(fs->win+FSI_Nxt_Free);\r
+                       fs->free_clust = LD_DWORD(fs->win+FSI_Free_Count);\r
+               }\r
+       }\r
+#endif\r
+       fs->fs_type = fmt;              /* FAT sub-type */\r
+       fs->winsect = 0;                /* Invalidate sector cache */\r
+#if _FS_RPATH\r
+       fs->cdir = 0;                   /* Current directory (root dir) */\r
+#endif\r
+       fs->id = ++Fsid;                /* File system mount ID */\r
+\r
+       return FR_OK;\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Check if the file/dir object is valid or not                          */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+static\r
+FRESULT validate (     /* FR_OK(0): The object is valid, !=0: Invalid */\r
+       FATFS *fs,              /* Pointer to the file system object */\r
+       WORD id                 /* Member id of the target object to be checked */\r
+)\r
+{\r
+       if (!fs || !fs->fs_type || fs->id != id)\r
+               return FR_INVALID_OBJECT;\r
+\r
+       ENTER_FF(fs);           /* Lock file system */\r
+\r
+       if (disk_status(fs->drive) & STA_NOINIT)\r
+               return FR_NOT_READY;\r
+\r
+       return FR_OK;\r
+}\r
+\r
+\r
+\r
+\r
+/*--------------------------------------------------------------------------\r
+\r
+   Public Functions\r
+\r
+--------------------------------------------------------------------------*/\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Mount/Unmount a Locical Drive                                         */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_mount (\r
+       BYTE vol,               /* Logical drive number to be mounted/unmounted */\r
+       FATFS *fs               /* Pointer to new file system object (NULL for unmount)*/\r
+)\r
+{\r
+       FATFS *rfs;\r
+\r
+\r
+       if (vol >= _DRIVES)                             /* Check if the drive number is valid */\r
+               return FR_INVALID_DRIVE;\r
+       rfs = FatFs[vol];                               /* Get current fs object */\r
+\r
+       if (rfs) {\r
+#if _FS_REENTRANT                                      /* Discard sync object of the current volume */\r
+               if (!ff_del_syncobj(rfs->sobj)) return FR_INT_ERR;\r
+#endif\r
+               rfs->fs_type = 0;                       /* Clear old fs object */\r
+       }\r
+\r
+       if (fs) {\r
+               fs->fs_type = 0;                        /* Clear new fs object */\r
+#if _FS_REENTRANT                                      /* Create sync object for the new volume */\r
+               if (!ff_cre_syncobj(vol, &fs->sobj)) return FR_INT_ERR;\r
+#endif\r
+       }\r
+       FatFs[vol] = fs;                                /* Register new fs object */\r
+\r
+       return FR_OK;\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Open or Create a File                                                 */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_open (\r
+       FIL *fp,                        /* Pointer to the blank file object */\r
+       const XCHAR *path,      /* Pointer to the file name */\r
+       BYTE mode                       /* Access mode and file open mode flags */\r
+)\r
+{\r
+       FRESULT res;\r
+       DIR dj;\r
+       NAMEBUF(sfn, lfn);\r
+       BYTE *dir;\r
+\r
+\r
+       fp->fs = NULL;          /* Clear file object */\r
+#if !_FS_READONLY\r
+       mode &= (FA_READ | FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW);\r
+       res = chk_mounted(&path, &dj.fs, (BYTE)(mode & (FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)));\r
+#else\r
+       mode &= FA_READ;\r
+       res = chk_mounted(&path, &dj.fs, 0);\r
+#endif\r
+       if (res != FR_OK) LEAVE_FF(dj.fs, res);\r
+       INITBUF(dj, sfn, lfn);\r
+       res = follow_path(&dj, path);   /* Follow the file path */\r
+\r
+#if !_FS_READONLY\r
+       /* Create or Open a file */\r
+       if (mode & (FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW)) {\r
+               DWORD ps, cl;\r
+\r
+               if (res != FR_OK) {                     /* No file, create new */\r
+                       if (res == FR_NO_FILE)  /* There is no file to open, create a new entry */\r
+                               res = dir_register(&dj);\r
+                       if (res != FR_OK) LEAVE_FF(dj.fs, res);\r
+                       mode |= FA_CREATE_ALWAYS;\r
+                       dir = dj.dir;                   /* Created entry (SFN entry) */\r
+               }\r
+               else {                                          /* Any object is already existing */\r
+                       if (mode & FA_CREATE_NEW)                       /* Cannot create new */\r
+                               LEAVE_FF(dj.fs, FR_EXIST);\r
+                       dir = dj.dir;\r
+                       if (!dir || (dir[DIR_Attr] & (AM_RDO | AM_DIR)))        /* Cannot overwrite it (R/O or DIR) */\r
+                               LEAVE_FF(dj.fs, FR_DENIED);\r
+                       if (mode & FA_CREATE_ALWAYS) {          /* Resize it to zero on over write mode */\r
+                               cl = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);    /* Get start cluster */\r
+                               ST_WORD(dir+DIR_FstClusHI, 0);  /* cluster = 0 */\r
+                               ST_WORD(dir+DIR_FstClusLO, 0);\r
+                               ST_DWORD(dir+DIR_FileSize, 0);  /* size = 0 */\r
+                               dj.fs->wflag = 1;\r
+                               ps = dj.fs->winsect;                    /* Remove the cluster chain */\r
+                               if (cl) {\r
+                                       res = remove_chain(dj.fs, cl);\r
+                                       if (res) LEAVE_FF(dj.fs, res);\r
+                                       dj.fs->last_clust = cl - 1;     /* Reuse the cluster hole */\r
+                               }\r
+                               res = move_window(dj.fs, ps);\r
+                               if (res != FR_OK) LEAVE_FF(dj.fs, res);\r
+                       }\r
+               }\r
+               if (mode & FA_CREATE_ALWAYS) {\r
+                       dir[DIR_Attr] = 0;                                      /* Reset attribute */\r
+                       ps = get_fattime();\r
+                       ST_DWORD(dir+DIR_CrtTime, ps);          /* Created time */\r
+                       dj.fs->wflag = 1;\r
+                       mode |= FA__WRITTEN;                            /* Set file changed flag */\r
+               }\r
+       }\r
+       /* Open an existing file */\r
+       else {\r
+#endif /* !_FS_READONLY */\r
+               if (res != FR_OK) LEAVE_FF(dj.fs, res); /* Follow failed */\r
+               dir = dj.dir;\r
+               if (!dir || (dir[DIR_Attr] & AM_DIR))   /* It is a directory */\r
+                       LEAVE_FF(dj.fs, FR_NO_FILE);\r
+#if !_FS_READONLY\r
+               if ((mode & FA_WRITE) && (dir[DIR_Attr] & AM_RDO)) /* R/O violation */\r
+                       LEAVE_FF(dj.fs, FR_DENIED);\r
+       }\r
+       fp->dir_sect = dj.fs->winsect;          /* Pointer to the directory entry */\r
+       fp->dir_ptr = dj.dir;\r
+#endif\r
+       fp->flag = mode;                                        /* File access mode */\r
+       fp->org_clust =                                         /* File start cluster */\r
+               ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);\r
+       fp->fsize = LD_DWORD(dir+DIR_FileSize); /* File size */\r
+       fp->fptr = 0; fp->csect = 255;          /* File pointer */\r
+       fp->dsect = 0;\r
+       fp->fs = dj.fs; fp->id = dj.fs->id;     /* Owner file system object of the file */\r
+\r
+       LEAVE_FF(dj.fs, FR_OK);\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Read File                                                             */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_read (\r
+       FIL *fp,                /* Pointer to the file object */\r
+       void *buff,             /* Pointer to data buffer */\r
+       UINT btr,               /* Number of bytes to read */\r
+       UINT *br                /* Pointer to number of bytes read */\r
+)\r
+{\r
+       FRESULT res;\r
+       DWORD clst, sect, remain;\r
+       UINT rcnt, cc;\r
+       BYTE *rbuff = buff;\r
+\r
+\r
+       *br = 0;        /* Initialize bytes read */\r
+\r
+       res = validate(fp->fs, fp->id);                                 /* Check validity of the object */\r
+       if (res != FR_OK) LEAVE_FF(fp->fs, res);\r
+       if (fp->flag & FA__ERROR)                                               /* Check abort flag */\r
+               LEAVE_FF(fp->fs, FR_INT_ERR);\r
+       if (!(fp->flag & FA_READ))                                              /* Check access mode */\r
+               LEAVE_FF(fp->fs, FR_DENIED);\r
+       remain = fp->fsize - fp->fptr;\r
+       if (btr > remain) btr = (UINT)remain;                   /* Truncate btr by remaining bytes */\r
+\r
+       for ( ;  btr;                                                                   /* Repeat until all data transferred */\r
+               rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {\r
+               if ((fp->fptr % SS(fp->fs)) == 0) {                     /* On the sector boundary? */\r
+                       if (fp->csect >= fp->fs->csize) {               /* On the cluster boundary? */\r
+                               clst = (fp->fptr == 0) ?                        /* On the top of the file? */\r
+                                       fp->org_clust : get_fat(fp->fs, fp->curr_clust);\r
+                               if (clst <= 1) ABORT(fp->fs, FR_INT_ERR);\r
+                               if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);\r
+                               fp->curr_clust = clst;                          /* Update current cluster */\r
+                               fp->csect = 0;                                          /* Reset sector offset in the cluster */\r
+                       }\r
+                       sect = clust2sect(fp->fs, fp->curr_clust);      /* Get current sector */\r
+                       if (!sect) ABORT(fp->fs, FR_INT_ERR);\r
+                       sect += fp->csect;\r
+                       cc = btr / SS(fp->fs);                                  /* When remaining bytes >= sector size, */\r
+                       if (cc) {                                                               /* Read maximum contiguous sectors directly */\r
+                               if (fp->csect + cc > fp->fs->csize)     /* Clip at cluster boundary */\r
+                                       cc = fp->fs->csize - fp->csect;\r
+                               if (disk_read(fp->fs->drive, rbuff, sect, (BYTE)cc) != RES_OK)\r
+                                       ABORT(fp->fs, FR_DISK_ERR);\r
+#if !_FS_READONLY && _FS_MINIMIZE <= 2\r
+#if _FS_TINY\r
+                               if (fp->fs->wflag && fp->fs->winsect - sect < cc)               /* Replace one of the read sectors with cached data if it contains a dirty sector */\r
+                                       mem_cpy(rbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), fp->fs->win, SS(fp->fs));\r
+#else\r
+                               if ((fp->flag & FA__DIRTY) && fp->dsect - sect < cc)    /* Replace one of the read sectors with cached data if it contains a dirty sector */\r
+                                       mem_cpy(rbuff + ((fp->dsect - sect) * SS(fp->fs)), fp->buf, SS(fp->fs));\r
+#endif\r
+#endif\r
+                               fp->csect += (BYTE)cc;                          /* Next sector address in the cluster */\r
+                               rcnt = SS(fp->fs) * cc;                         /* Number of bytes transferred */\r
+                               continue;\r
+                       }\r
+#if !_FS_TINY\r
+#if !_FS_READONLY\r
+                       if (fp->flag & FA__DIRTY) {                     /* Write sector I/O buffer if needed */\r
+                               if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)\r
+                                       ABORT(fp->fs, FR_DISK_ERR);\r
+                               fp->flag &= ~FA__DIRTY;\r
+                       }\r
+#endif\r
+                       if (fp->dsect != sect) {                        /* Fill sector buffer with file data */\r
+                               if (disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)\r
+                                       ABORT(fp->fs, FR_DISK_ERR);\r
+                       }\r
+#endif\r
+                       fp->dsect = sect;\r
+                       fp->csect++;                                                    /* Next sector address in the cluster */\r
+               }\r
+               rcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs));    /* Get partial sector data from sector buffer */\r
+               if (rcnt > btr) rcnt = btr;\r
+#if _FS_TINY\r
+               if (move_window(fp->fs, fp->dsect))                     /* Move sector window */\r
+                       ABORT(fp->fs, FR_DISK_ERR);\r
+               mem_cpy(rbuff, &fp->fs->win[fp->fptr % SS(fp->fs)], rcnt);      /* Pick partial sector */\r
+#else\r
+               mem_cpy(rbuff, &fp->buf[fp->fptr % SS(fp->fs)], rcnt);  /* Pick partial sector */\r
+#endif\r
+       }\r
+\r
+       LEAVE_FF(fp->fs, FR_OK);\r
+}\r
+\r
+\r
+\r
+\r
+#if !_FS_READONLY\r
+/*-----------------------------------------------------------------------*/\r
+/* Write File                                                            */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_write (\r
+       FIL *fp,                        /* Pointer to the file object */\r
+       const void *buff,       /* Pointer to the data to be written */\r
+       UINT btw,                       /* Number of bytes to write */\r
+       UINT *bw                        /* Pointer to number of bytes written */\r
+)\r
+{\r
+       FRESULT res;\r
+       DWORD clst, sect;\r
+       UINT wcnt, cc;\r
+       const BYTE *wbuff = buff;\r
+\r
+\r
+       *bw = 0;        /* Initialize bytes written */\r
+\r
+       res = validate(fp->fs, fp->id);                                 /* Check validity of the object */\r
+       if (res != FR_OK) LEAVE_FF(fp->fs, res);\r
+       if (fp->flag & FA__ERROR)                                               /* Check abort flag */\r
+               LEAVE_FF(fp->fs, FR_INT_ERR);\r
+       if (!(fp->flag & FA_WRITE))                                             /* Check access mode */\r
+               LEAVE_FF(fp->fs, FR_DENIED);\r
+       if (fp->fsize + btw < fp->fsize) btw = 0;               /* File size cannot reach 4GB */\r
+\r
+       for ( ;  btw;                                                                   /* Repeat until all data transferred */\r
+               wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {\r
+               if ((fp->fptr % SS(fp->fs)) == 0) {                     /* On the sector boundary? */\r
+                       if (fp->csect >= fp->fs->csize) {               /* On the cluster boundary? */\r
+                               if (fp->fptr == 0) {                            /* On the top of the file? */\r
+                                       clst = fp->org_clust;                   /* Follow from the origin */\r
+                                       if (clst == 0)                                  /* When there is no cluster chain, */\r
+                                               fp->org_clust = clst = create_chain(fp->fs, 0); /* Create a new cluster chain */\r
+                               } else {                                                        /* Middle or end of the file */\r
+                                       clst = create_chain(fp->fs, fp->curr_clust);                    /* Follow or streach cluster chain */\r
+                               }\r
+                               if (clst == 0) break;                           /* Could not allocate a new cluster (disk full) */\r
+                               if (clst == 1) ABORT(fp->fs, FR_INT_ERR);\r
+                               if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);\r
+                               fp->curr_clust = clst;                          /* Update current cluster */\r
+                               fp->csect = 0;                                          /* Reset sector address in the cluster */\r
+                       }\r
+#if _FS_TINY\r
+                       if (fp->fs->winsect == fp->dsect && move_window(fp->fs, 0))     /* Write back data buffer prior to following direct transfer */\r
+                               ABORT(fp->fs, FR_DISK_ERR);\r
+#else\r
+                       if (fp->flag & FA__DIRTY) {             /* Write back data buffer prior to following direct transfer */\r
+                               if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)\r
+                                       ABORT(fp->fs, FR_DISK_ERR);\r
+                               fp->flag &= ~FA__DIRTY;\r
+                       }\r
+#endif\r
+                       sect = clust2sect(fp->fs, fp->curr_clust);      /* Get current sector */\r
+                       if (!sect) ABORT(fp->fs, FR_INT_ERR);\r
+                       sect += fp->csect;\r
+                       cc = btw / SS(fp->fs);                                  /* When remaining bytes >= sector size, */\r
+                       if (cc) {                                                               /* Write maximum contiguous sectors directly */\r
+                               if (fp->csect + cc > fp->fs->csize)     /* Clip at cluster boundary */\r
+                                       cc = fp->fs->csize - fp->csect;\r
+                               if (disk_write(fp->fs->drive, wbuff, sect, (BYTE)cc) != RES_OK)\r
+                                       ABORT(fp->fs, FR_DISK_ERR);\r
+#if _FS_TINY\r
+                               if (fp->fs->winsect - sect < cc) {      /* Refill sector cache if it gets dirty by the direct write */\r
+                                       mem_cpy(fp->fs->win, wbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), SS(fp->fs));\r
+                                       fp->fs->wflag = 0;\r
+                               }\r
+#else\r
+                               if (fp->dsect - sect < cc) {            /* Refill sector cache if it gets dirty by the direct write */\r
+                                       mem_cpy(fp->buf, wbuff + ((fp->dsect - sect) * SS(fp->fs)), SS(fp->fs));\r
+                                       fp->flag &= ~FA__DIRTY;\r
+                               }\r
+#endif\r
+                               fp->csect += (BYTE)cc;                          /* Next sector address in the cluster */\r
+                               wcnt = SS(fp->fs) * cc;                         /* Number of bytes transferred */\r
+                               continue;\r
+                       }\r
+#if _FS_TINY\r
+                       if (fp->fptr >= fp->fsize) {                    /* Avoid silly buffer filling at growing edge */\r
+                               if (move_window(fp->fs, 0)) ABORT(fp->fs, FR_DISK_ERR);\r
+                               fp->fs->winsect = sect;\r
+                       }\r
+#else\r
+                       if (fp->dsect != sect) {                                /* Fill sector buffer with file data */\r
+                               if (fp->fptr < fp->fsize &&\r
+                                       disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)\r
+                                               ABORT(fp->fs, FR_DISK_ERR);\r
+                       }\r
+#endif\r
+                       fp->dsect = sect;\r
+                       fp->csect++;                                                    /* Next sector address in the cluster */\r
+               }\r
+               wcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs));    /* Put partial sector into file I/O buffer */\r
+               if (wcnt > btw) wcnt = btw;\r
+#if _FS_TINY\r
+               if (move_window(fp->fs, fp->dsect))                     /* Move sector window */\r
+                       ABORT(fp->fs, FR_DISK_ERR);\r
+               mem_cpy(&fp->fs->win[fp->fptr % SS(fp->fs)], wbuff, wcnt);      /* Fit partial sector */\r
+               fp->fs->wflag = 1;\r
+#else\r
+               mem_cpy(&fp->buf[fp->fptr % SS(fp->fs)], wbuff, wcnt);  /* Fit partial sector */\r
+               fp->flag |= FA__DIRTY;\r
+#endif\r
+       }\r
+\r
+       if (fp->fptr > fp->fsize) fp->fsize = fp->fptr; /* Update file size if needed */\r
+       fp->flag |= FA__WRITTEN;                                                /* Set file changed flag */\r
+\r
+       LEAVE_FF(fp->fs, FR_OK);\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Synchronize the File Object                                           */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_sync (\r
+       FIL *fp         /* Pointer to the file object */\r
+)\r
+{\r
+       FRESULT res;\r
+       DWORD tim;\r
+       BYTE *dir;\r
+\r
+\r
+       res = validate(fp->fs, fp->id);         /* Check validity of the object */\r
+       if (res == FR_OK) {\r
+               if (fp->flag & FA__WRITTEN) {   /* Has the file been written? */\r
+#if !_FS_TINY  /* Write-back dirty buffer */\r
+                       if (fp->flag & FA__DIRTY) {\r
+                               if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)\r
+                                       LEAVE_FF(fp->fs, FR_DISK_ERR);\r
+                               fp->flag &= ~FA__DIRTY;\r
+                       }\r
+#endif\r
+                       /* Update the directory entry */\r
+                       res = move_window(fp->fs, fp->dir_sect);\r
+                       if (res == FR_OK) {\r
+                               dir = fp->dir_ptr;\r
+                               dir[DIR_Attr] |= AM_ARC;                                        /* Set archive bit */\r
+                               ST_DWORD(dir+DIR_FileSize, fp->fsize);          /* Update file size */\r
+                               ST_WORD(dir+DIR_FstClusLO, fp->org_clust);      /* Update start cluster */\r
+                               ST_WORD(dir+DIR_FstClusHI, fp->org_clust >> 16);\r
+                               tim = get_fattime();                    /* Updated time */\r
+                               ST_DWORD(dir+DIR_WrtTime, tim);\r
+                               fp->flag &= ~FA__WRITTEN;\r
+                               fp->fs->wflag = 1;\r
+                               res = sync(fp->fs);\r
+                       }\r
+               }\r
+       }\r
+\r
+       LEAVE_FF(fp->fs, res);\r
+}\r
+\r
+#endif /* !_FS_READONLY */\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Close File                                                            */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_close (\r
+       FIL *fp         /* Pointer to the file object to be closed */\r
+)\r
+{\r
+       FRESULT res;\r
+\r
+\r
+#if _FS_READONLY\r
+       res = validate(fp->fs, fp->id);\r
+       if (res == FR_OK) fp->fs = NULL;\r
+       LEAVE_FF(fp->fs, res);\r
+#else\r
+       res = f_sync(fp);\r
+       if (res == FR_OK) fp->fs = NULL;\r
+       return res;\r
+#endif\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Change Current Drive/Directory                                        */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+#if _FS_RPATH\r
+\r
+FRESULT f_chdrive (\r
+       BYTE drv                /* Drive number */\r
+)\r
+{\r
+       if (drv >= _DRIVES) return FR_INVALID_DRIVE;\r
+\r
+       Drive = drv;\r
+\r
+       return FR_OK;\r
+}\r
+\r
+\r
+\r
+\r
+FRESULT f_chdir (\r
+       const XCHAR *path       /* Pointer to the directory path */\r
+)\r
+{\r
+       FRESULT res;\r
+       DIR dj;\r
+       NAMEBUF(sfn, lfn);\r
+       BYTE *dir;\r
+\r
+\r
+       res = chk_mounted(&path, &dj.fs, 0);\r
+       if (res == FR_OK) {\r
+               INITBUF(dj, sfn, lfn);\r
+               res = follow_path(&dj, path);           /* Follow the file path */\r
+               if (res == FR_OK) {                                     /* Follow completed */\r
+                       dir = dj.dir;                                   /* Pointer to the entry */\r
+                       if (!dir) {\r
+                               dj.fs->cdir = 0;                        /* No entry (root dir) */\r
+                       } else {\r
+                               if (dir[DIR_Attr] & AM_DIR)     /* Reached to the dir */\r
+                                       dj.fs->cdir = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);\r
+                               else\r
+                                       res = FR_NO_PATH;               /* Could not reach the dir (it is a file) */\r
+                       }\r
+               }\r
+               if (res == FR_NO_FILE) res = FR_NO_PATH;\r
+       }\r
+\r
+       LEAVE_FF(dj.fs, res);\r
+}\r
+\r
+#endif\r
+\r
+\r
+\r
+#if _FS_MINIMIZE <= 2\r
+/*-----------------------------------------------------------------------*/\r
+/* Seek File R/W Pointer                                                 */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_lseek (\r
+       FIL *fp,                /* Pointer to the file object */\r
+       DWORD ofs               /* File pointer from top of file */\r
+)\r
+{\r
+       FRESULT res;\r
+       DWORD clst, bcs, nsect, ifptr;\r
+\r
+\r
+       res = validate(fp->fs, fp->id);         /* Check validity of the object */\r
+       if (res != FR_OK) LEAVE_FF(fp->fs, res);\r
+       if (fp->flag & FA__ERROR)                       /* Check abort flag */\r
+               LEAVE_FF(fp->fs, FR_INT_ERR);\r
+       if (ofs > fp->fsize                                     /* In read-only mode, clip offset with the file size */\r
+#if !_FS_READONLY\r
+                && !(fp->flag & FA_WRITE)\r
+#endif\r
+               ) ofs = fp->fsize;\r
+\r
+       ifptr = fp->fptr;\r
+       fp->fptr = nsect = 0; fp->csect = 255;\r
+       if (ofs > 0) {\r
+               bcs = (DWORD)fp->fs->csize * SS(fp->fs);        /* Cluster size (byte) */\r
+               if (ifptr > 0 &&\r
+                       (ofs - 1) / bcs >= (ifptr - 1) / bcs) { /* When seek to same or following cluster, */\r
+                       fp->fptr = (ifptr - 1) & ~(bcs - 1);    /* start from the current cluster */\r
+                       ofs -= fp->fptr;\r
+                       clst = fp->curr_clust;\r
+               } else {                                                                        /* When seek to back cluster, */\r
+                       clst = fp->org_clust;                                   /* start from the first cluster */\r
+#if !_FS_READONLY\r
+                       if (clst == 0) {                                                /* If no cluster chain, create a new chain */\r
+                               clst = create_chain(fp->fs, 0);\r
+                               if (clst == 1) ABORT(fp->fs, FR_INT_ERR);\r
+                               if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);\r
+                               fp->org_clust = clst;\r
+                       }\r
+#endif\r
+                       fp->curr_clust = clst;\r
+               }\r
+               if (clst != 0) {\r
+                       while (ofs > bcs) {                                             /* Cluster following loop */\r
+#if !_FS_READONLY\r
+                               if (fp->flag & FA_WRITE) {                      /* Check if in write mode or not */\r
+                                       clst = create_chain(fp->fs, clst);      /* Force streached if in write mode */\r
+                                       if (clst == 0) {                                /* When disk gets full, clip file size */\r
+                                               ofs = bcs; break;\r
+                                       }\r
+                               } else\r
+#endif\r
+                                       clst = get_fat(fp->fs, clst);   /* Follow cluster chain if not in write mode */\r
+                               if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);\r
+                               if (clst <= 1 || clst >= fp->fs->max_clust) ABORT(fp->fs, FR_INT_ERR);\r
+                               fp->curr_clust = clst;\r
+                               fp->fptr += bcs;\r
+                               ofs -= bcs;\r
+                       }\r
+                       fp->fptr += ofs;\r
+                       fp->csect = (BYTE)(ofs / SS(fp->fs));   /* Sector offset in the cluster */\r
+                       if (ofs % SS(fp->fs)) {\r
+                               nsect = clust2sect(fp->fs, clst);       /* Current sector */\r
+                               if (!nsect) ABORT(fp->fs, FR_INT_ERR);\r
+                               nsect += fp->csect;\r
+                               fp->csect++;\r
+                       }\r
+               }\r
+       }\r
+       if (fp->fptr % SS(fp->fs) && nsect != fp->dsect) {\r
+#if !_FS_TINY\r
+#if !_FS_READONLY\r
+               if (fp->flag & FA__DIRTY) {                     /* Write-back dirty buffer if needed */\r
+                       if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)\r
+                               ABORT(fp->fs, FR_DISK_ERR);\r
+                       fp->flag &= ~FA__DIRTY;\r
+               }\r
+#endif\r
+               if (disk_read(fp->fs->drive, fp->buf, nsect, 1) != RES_OK)\r
+                       ABORT(fp->fs, FR_DISK_ERR);\r
+#endif\r
+               fp->dsect = nsect;\r
+       }\r
+#if !_FS_READONLY\r
+       if (fp->fptr > fp->fsize) {                     /* Set changed flag if the file size is extended */\r
+               fp->fsize = fp->fptr;\r
+               fp->flag |= FA__WRITTEN;\r
+       }\r
+#endif\r
+\r
+       LEAVE_FF(fp->fs, res);\r
+}\r
+\r
+\r
+\r
+\r
+#if _FS_MINIMIZE <= 1\r
+/*-----------------------------------------------------------------------*/\r
+/* Create a Directroy Object                                             */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_opendir (\r
+       DIR *dj,                        /* Pointer to directory object to create */\r
+       const XCHAR *path       /* Pointer to the directory path */\r
+)\r
+{\r
+       FRESULT res;\r
+       NAMEBUF(sfn, lfn);\r
+       BYTE *dir;\r
+\r
+\r
+       res = chk_mounted(&path, &dj->fs, 0);\r
+       if (res == FR_OK) {\r
+               INITBUF((*dj), sfn, lfn);\r
+               res = follow_path(dj, path);                    /* Follow the path to the directory */\r
+               if (res == FR_OK) {                                             /* Follow completed */\r
+                       dir = dj->dir;\r
+                       if (dir) {                                                      /* It is not the root dir */\r
+                               if (dir[DIR_Attr] & AM_DIR) {   /* The object is a directory */\r
+                                       dj->sclust = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);\r
+                               } else {                                                /* The object is not a directory */\r
+                                       res = FR_NO_PATH;\r
+                               }\r
+                       }\r
+                       if (res == FR_OK) {\r
+                               dj->id = dj->fs->id;\r
+                               res = dir_seek(dj, 0);                  /* Rewind dir */\r
+                       }\r
+               }\r
+               if (res == FR_NO_FILE) res = FR_NO_PATH;\r
+       }\r
+\r
+       LEAVE_FF(dj->fs, res);\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Read Directory Entry in Sequense                                      */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_readdir (\r
+       DIR *dj,                        /* Pointer to the open directory object */\r
+       FILINFO *fno            /* Pointer to file information to return */\r
+)\r
+{\r
+       FRESULT res;\r
+       NAMEBUF(sfn, lfn);\r
+\r
+\r
+       res = validate(dj->fs, dj->id);                 /* Check validity of the object */\r
+       if (res == FR_OK) {\r
+               INITBUF((*dj), sfn, lfn);\r
+               if (!fno) {\r
+                       res = dir_seek(dj, 0);\r
+               } else {\r
+                       res = dir_read(dj);\r
+                       if (res == FR_NO_FILE) {\r
+                               dj->sect = 0;\r
+                               res = FR_OK;\r
+                       }\r
+                       if (res == FR_OK) {                             /* A valid entry is found */\r
+                               get_fileinfo(dj, fno);          /* Get the object information */\r
+                               res = dir_next(dj, FALSE);      /* Increment index for next */\r
+                               if (res == FR_NO_FILE) {\r
+                                       dj->sect = 0;\r
+                                       res = FR_OK;\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       LEAVE_FF(dj->fs, res);\r
+}\r
+\r
+\r
+\r
+#if _FS_MINIMIZE == 0\r
+/*-----------------------------------------------------------------------*/\r
+/* Get File Status                                                       */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_stat (\r
+       const XCHAR *path,      /* Pointer to the file path */\r
+       FILINFO *fno            /* Pointer to file information to return */\r
+)\r
+{\r
+       FRESULT res;\r
+       DIR dj;\r
+       NAMEBUF(sfn, lfn);\r
+\r
+\r
+       res = chk_mounted(&path, &dj.fs, 0);\r
+       if (res == FR_OK) {\r
+               INITBUF(dj, sfn, lfn);\r
+               res = follow_path(&dj, path);   /* Follow the file path */\r
+               if (res == FR_OK) {                             /* Follwo completed */\r
+                       if (dj.dir)     /* Found an object */\r
+                               get_fileinfo(&dj, fno);\r
+                       else            /* It is root dir */\r
+                               res = FR_INVALID_NAME;\r
+               }\r
+       }\r
+\r
+       LEAVE_FF(dj.fs, res);\r
+}\r
+\r
+\r
+\r
+#if !_FS_READONLY\r
+/*-----------------------------------------------------------------------*/\r
+/* Get Number of Free Clusters                                           */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_getfree (\r
+       const XCHAR *path,      /* Pointer to the logical drive number (root dir) */\r
+       DWORD *nclst,           /* Pointer to the variable to return number of free clusters */\r
+       FATFS **fatfs           /* Pointer to pointer to corresponding file system object to return */\r
+)\r
+{\r
+       FRESULT res;\r
+       DWORD n, clst, sect, stat;\r
+       UINT i;\r
+       BYTE fat, *p;\r
+\r
+\r
+       /* Get drive number */\r
+       res = chk_mounted(&path, fatfs, 0);\r
+       if (res != FR_OK) LEAVE_FF(*fatfs, res);\r
+\r
+       /* If number of free cluster is valid, return it without cluster scan. */\r
+       if ((*fatfs)->free_clust <= (*fatfs)->max_clust - 2) {\r
+               *nclst = (*fatfs)->free_clust;\r
+               LEAVE_FF(*fatfs, FR_OK);\r
+       }\r
+\r
+       /* Get number of free clusters */\r
+       fat = (*fatfs)->fs_type;\r
+       n = 0;\r
+       if (fat == FS_FAT12) {\r
+               clst = 2;\r
+               do {\r
+                       stat = get_fat(*fatfs, clst);\r
+                       if (stat == 0xFFFFFFFF) LEAVE_FF(*fatfs, FR_DISK_ERR);\r
+                       if (stat == 1) LEAVE_FF(*fatfs, FR_INT_ERR);\r
+                       if (stat == 0) n++;\r
+               } while (++clst < (*fatfs)->max_clust);\r
+       } else {\r
+               clst = (*fatfs)->max_clust;\r
+               sect = (*fatfs)->fatbase;\r
+               i = 0; p = 0;\r
+               do {\r
+                       if (!i) {\r
+                               res = move_window(*fatfs, sect++);\r
+                               if (res != FR_OK)\r
+                                       LEAVE_FF(*fatfs, res);\r
+                               p = (*fatfs)->win;\r
+                               i = SS(*fatfs);\r
+                       }\r
+                       if (fat == FS_FAT16) {\r
+                               if (LD_WORD(p) == 0) n++;\r
+                               p += 2; i -= 2;\r
+                       } else {\r
+                               if ((LD_DWORD(p) & 0x0FFFFFFF) == 0) n++;\r
+                               p += 4; i -= 4;\r
+                       }\r
+               } while (--clst);\r
+       }\r
+       (*fatfs)->free_clust = n;\r
+       if (fat == FS_FAT32) (*fatfs)->fsi_flag = 1;\r
+       *nclst = n;\r
+\r
+       LEAVE_FF(*fatfs, FR_OK);\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Truncate File                                                         */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_truncate (\r
+       FIL *fp         /* Pointer to the file object */\r
+)\r
+{\r
+       FRESULT res;\r
+       DWORD ncl;\r
+\r
+\r
+       res = validate(fp->fs, fp->id);         /* Check validity of the object */\r
+       if (res != FR_OK) LEAVE_FF(fp->fs, res);\r
+       if (fp->flag & FA__ERROR)                       /* Check abort flag */\r
+               LEAVE_FF(fp->fs, FR_INT_ERR);\r
+       if (!(fp->flag & FA_WRITE))                     /* Check access mode */\r
+               LEAVE_FF(fp->fs, FR_DENIED);\r
+\r
+       if (fp->fsize > fp->fptr) {\r
+               fp->fsize = fp->fptr;   /* Set file size to current R/W point */\r
+               fp->flag |= FA__WRITTEN;\r
+               if (fp->fptr == 0) {    /* When set file size to zero, remove entire cluster chain */\r
+                       res = remove_chain(fp->fs, fp->org_clust);\r
+                       fp->org_clust = 0;\r
+               } else {                                /* When truncate a part of the file, remove remaining clusters */\r
+                       ncl = get_fat(fp->fs, fp->curr_clust);\r
+                       res = FR_OK;\r
+                       if (ncl == 0xFFFFFFFF) res = FR_DISK_ERR;\r
+                       if (ncl == 1) res = FR_INT_ERR;\r
+                       if (res == FR_OK && ncl < fp->fs->max_clust) {\r
+                               res = put_fat(fp->fs, fp->curr_clust, 0x0FFFFFFF);\r
+                               if (res == FR_OK) res = remove_chain(fp->fs, ncl);\r
+                       }\r
+               }\r
+       }\r
+       if (res != FR_OK) fp->flag |= FA__ERROR;\r
+\r
+       LEAVE_FF(fp->fs, res);\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Delete a File or Directory                                            */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_unlink (\r
+       const XCHAR *path               /* Pointer to the file or directory path */\r
+)\r
+{\r
+       FRESULT res;\r
+       DIR dj, sdj;\r
+       NAMEBUF(sfn, lfn);\r
+       BYTE *dir;\r
+       DWORD dclst;\r
+\r
+\r
+       res = chk_mounted(&path, &dj.fs, 1);\r
+       if (res != FR_OK) LEAVE_FF(dj.fs, res);\r
+\r
+       INITBUF(dj, sfn, lfn);\r
+       res = follow_path(&dj, path);                   /* Follow the file path */\r
+       if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))\r
+               res = FR_INVALID_NAME;\r
+       if (res != FR_OK) LEAVE_FF(dj.fs, res); /* Follow failed */\r
+\r
+       dir = dj.dir;\r
+       if (!dir)                                                               /* Is it the root directory? */\r
+               LEAVE_FF(dj.fs, FR_INVALID_NAME);\r
+       if (dir[DIR_Attr] & AM_RDO)                             /* Is it a R/O object? */\r
+               LEAVE_FF(dj.fs, FR_DENIED);\r
+       dclst = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);\r
+\r
+       if (dir[DIR_Attr] & AM_DIR) {                   /* It is a sub-directory */\r
+               if (dclst < 2) LEAVE_FF(dj.fs, FR_INT_ERR);\r
+               mem_cpy(&sdj, &dj, sizeof(DIR));        /* Check if the sub-dir is empty or not */\r
+               sdj.sclust = dclst;\r
+               res = dir_seek(&sdj, 2);\r
+               if (res != FR_OK) LEAVE_FF(dj.fs, res);\r
+               res = dir_read(&sdj);\r
+               if (res == FR_OK) res = FR_DENIED;      /* Not empty sub-dir */\r
+               if (res != FR_NO_FILE) LEAVE_FF(dj.fs, res);\r
+       }\r
+\r
+       res = dir_remove(&dj);                                  /* Remove directory entry */\r
+       if (res == FR_OK) {\r
+               if (dclst)\r
+                       res = remove_chain(dj.fs, dclst);       /* Remove the cluster chain */\r
+               if (res == FR_OK) res = sync(dj.fs);\r
+       }\r
+\r
+       LEAVE_FF(dj.fs, res);\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Create a Directory                                                    */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_mkdir (\r
+       const XCHAR *path               /* Pointer to the directory path */\r
+)\r
+{\r
+       FRESULT res;\r
+       DIR dj;\r
+       NAMEBUF(sfn, lfn);\r
+       BYTE *dir, n;\r
+       DWORD dsect, dclst, pclst, tim;\r
+\r
+\r
+       res = chk_mounted(&path, &dj.fs, 1);\r
+       if (res != FR_OK) LEAVE_FF(dj.fs, res);\r
+\r
+       INITBUF(dj, sfn, lfn);\r
+       res = follow_path(&dj, path);                   /* Follow the file path */\r
+       if (res == FR_OK) res = FR_EXIST;               /* Any file or directory is already existing */\r
+       if (_FS_RPATH && res == FR_NO_FILE && (dj.fn[NS] & NS_DOT))\r
+               res = FR_INVALID_NAME;\r
+       if (res != FR_NO_FILE)                                  /* Any error occured */\r
+               LEAVE_FF(dj.fs, res);\r
+\r
+       dclst = create_chain(dj.fs, 0);                 /* Allocate a new cluster for new directory table */\r
+       res = FR_OK;\r
+       if (dclst == 0) res = FR_DENIED;\r
+       if (dclst == 1) res = FR_INT_ERR;\r
+       if (dclst == 0xFFFFFFFF) res = FR_DISK_ERR;\r
+       if (res == FR_OK)\r
+               res = move_window(dj.fs, 0);\r
+       if (res != FR_OK) LEAVE_FF(dj.fs, res);\r
+       dsect = clust2sect(dj.fs, dclst);\r
+\r
+       dir = dj.fs->win;                                               /* Initialize the new directory table */\r
+       mem_set(dir, 0, SS(dj.fs));\r
+       mem_set(dir+DIR_Name, ' ', 8+3);                /* Create "." entry */\r
+       dir[DIR_Name] = '.';\r
+       dir[DIR_Attr] = AM_DIR;\r
+       tim = get_fattime();\r
+       ST_DWORD(dir+DIR_WrtTime, tim);\r
+       ST_WORD(dir+DIR_FstClusLO, dclst);\r
+       ST_WORD(dir+DIR_FstClusHI, dclst >> 16);\r
+       mem_cpy(dir+32, dir, 32);                       /* Create ".." entry */\r
+       dir[33] = '.';\r
+       pclst = dj.sclust;\r
+       if (dj.fs->fs_type == FS_FAT32 && pclst == dj.fs->dirbase)\r
+               pclst = 0;\r
+       ST_WORD(dir+32+DIR_FstClusLO, pclst);\r
+       ST_WORD(dir+32+DIR_FstClusHI, pclst >> 16);\r
+       for (n = 0; n < dj.fs->csize; n++) {    /* Write dot entries and clear left sectors */\r
+               dj.fs->winsect = dsect++;\r
+               dj.fs->wflag = 1;\r
+               res = move_window(dj.fs, 0);\r
+               if (res) LEAVE_FF(dj.fs, res);\r
+               mem_set(dir, 0, SS(dj.fs));\r
+       }\r
+\r
+       res = dir_register(&dj);\r
+       if (res != FR_OK) {\r
+               remove_chain(dj.fs, dclst);\r
+       } else {\r
+               dir = dj.dir;\r
+               dir[DIR_Attr] = AM_DIR;                                 /* Attribute */\r
+               ST_DWORD(dir+DIR_WrtTime, tim);                 /* Crated time */\r
+               ST_WORD(dir+DIR_FstClusLO, dclst);              /* Table start cluster */\r
+               ST_WORD(dir+DIR_FstClusHI, dclst >> 16);\r
+               dj.fs->wflag = 1;\r
+               res = sync(dj.fs);\r
+       }\r
+\r
+       LEAVE_FF(dj.fs, res);\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Change File Attribute                                                 */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_chmod (\r
+       const XCHAR *path,      /* Pointer to the file path */\r
+       BYTE value,                     /* Attribute bits */\r
+       BYTE mask                       /* Attribute mask to change */\r
+)\r
+{\r
+       FRESULT res;\r
+       DIR dj;\r
+       NAMEBUF(sfn, lfn);\r
+       BYTE *dir;\r
+\r
+\r
+       res = chk_mounted(&path, &dj.fs, 1);\r
+       if (res == FR_OK) {\r
+               INITBUF(dj, sfn, lfn);\r
+               res = follow_path(&dj, path);           /* Follow the file path */\r
+               if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))\r
+                       res = FR_INVALID_NAME;\r
+               if (res == FR_OK) {\r
+                       dir = dj.dir;\r
+                       if (!dir) {                                             /* Is it a root directory? */\r
+                               res = FR_INVALID_NAME;\r
+                       } else {                                                /* File or sub directory */\r
+                               mask &= AM_RDO|AM_HID|AM_SYS|AM_ARC;    /* Valid attribute mask */\r
+                               dir[DIR_Attr] = (value & mask) | (dir[DIR_Attr] & (BYTE)~mask); /* Apply attribute change */\r
+                               dj.fs->wflag = 1;\r
+                               res = sync(dj.fs);\r
+                       }\r
+               }\r
+       }\r
+\r
+       LEAVE_FF(dj.fs, res);\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Change Timestamp                                                      */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_utime (\r
+       const XCHAR *path,      /* Pointer to the file/directory name */\r
+       const FILINFO *fno      /* Pointer to the timestamp to be set */\r
+)\r
+{\r
+       FRESULT res;\r
+       DIR dj;\r
+       NAMEBUF(sfn, lfn);\r
+       BYTE *dir;\r
+\r
+\r
+       res = chk_mounted(&path, &dj.fs, 1);\r
+       if (res == FR_OK) {\r
+               INITBUF(dj, sfn, lfn);\r
+               res = follow_path(&dj, path);   /* Follow the file path */\r
+               if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT))\r
+                       res = FR_INVALID_NAME;\r
+               if (res == FR_OK) {\r
+                       dir = dj.dir;\r
+                       if (!dir) {                             /* Root directory */\r
+                               res = FR_INVALID_NAME;\r
+                       } else {                                /* File or sub-directory */\r
+                               ST_WORD(dir+DIR_WrtTime, fno->ftime);\r
+                               ST_WORD(dir+DIR_WrtDate, fno->fdate);\r
+                               dj.fs->wflag = 1;\r
+                               res = sync(dj.fs);\r
+                       }\r
+               }\r
+       }\r
+\r
+       LEAVE_FF(dj.fs, res);\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Rename File/Directory                                                 */\r
+/*-----------------------------------------------------------------------*/\r
+\r
+FRESULT f_rename (\r
+       const XCHAR *path_old,  /* Pointer to the old name */\r
+       const XCHAR *path_new   /* Pointer to the new name */\r
+)\r
+{\r
+       FRESULT res;\r
+       DIR dj_old, dj_new;\r
+       NAMEBUF(sfn, lfn);\r
+       BYTE buf[21], *dir;\r
+       DWORD dw;\r
+\r
+\r
+       INITBUF(dj_old, sfn, lfn);\r
+       res = chk_mounted(&path_old, &dj_old.fs, 1);\r
+       if (res == FR_OK) {\r
+               dj_new.fs = dj_old.fs;\r
+               res = follow_path(&dj_old, path_old);   /* Check old object */\r
+               if (_FS_RPATH && res == FR_OK && (dj_old.fn[NS] & NS_DOT))\r
+                       res = FR_INVALID_NAME;\r
+       }\r
+       if (res != FR_OK) LEAVE_FF(dj_old.fs, res);     /* The old object is not found */\r
+\r
+       if (!dj_old.dir) LEAVE_FF(dj_old.fs, FR_NO_FILE);       /* Is root dir? */\r
+       mem_cpy(buf, dj_old.dir+DIR_Attr, 21);          /* Save the object information */\r
+\r
+       mem_cpy(&dj_new, &dj_old, sizeof(DIR));\r
+       res = follow_path(&dj_new, path_new);           /* Check new object */\r
+       if (res == FR_OK) res = FR_EXIST;                       /* The new object name is already existing */\r
+       if (res == FR_NO_FILE) {                                        /* Is it a valid path and no name collision? */\r
+               res = dir_register(&dj_new);                    /* Register the new object */\r
+               if (res == FR_OK) {\r
+                       dir = dj_new.dir;                                       /* Copy object information into new entry */\r
+                       mem_cpy(dir+13, buf+2, 19);\r
+                       dir[DIR_Attr] = buf[0] | AM_ARC;\r
+                       dj_old.fs->wflag = 1;\r
+                       if (dir[DIR_Attr] & AM_DIR) {           /* Update .. entry in the directory if needed */\r
+                               dw = clust2sect(dj_new.fs, (DWORD)LD_WORD(dir+DIR_FstClusHI) | LD_WORD(dir+DIR_FstClusLO));\r
+                               if (!dw) {\r
+                                       res = FR_INT_ERR;\r
+                               } else {\r
+                                       res = move_window(dj_new.fs, dw);\r
+                                       dir = dj_new.fs->win+32;\r
+                                       if (res == FR_OK && dir[1] == '.') {\r
+                                               dw = (dj_new.fs->fs_type == FS_FAT32 && dj_new.sclust == dj_new.fs->dirbase) ? 0 : dj_new.sclust;\r
+                                               ST_WORD(dir+DIR_FstClusLO, dw);\r
+                                               ST_WORD(dir+DIR_FstClusHI, dw >> 16);\r
+                                               dj_new.fs->wflag = 1;\r
+                                       }\r
+                               }\r
+                       }\r
+                       if (res == FR_OK) {\r
+                               res = dir_remove(&dj_old);                      /* Remove old entry */\r
+                               if (res == FR_OK)\r
+                                       res = sync(dj_old.fs);\r
+                       }\r
+               }\r
+       }\r
+\r
+       LEAVE_FF(dj_old.fs, res);\r
+}\r
+\r
+#endif /* !_FS_READONLY */\r
+#endif /* _FS_MINIMIZE == 0 */\r
+#endif /* _FS_MINIMIZE <= 1 */\r
+#endif /* _FS_MINIMIZE <= 2 */\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Forward data to the stream directly (Available on only _FS_TINY cfg)  */\r
+/*-----------------------------------------------------------------------*/\r
+#if _USE_FORWARD && _FS_TINY\r
+\r
+FRESULT f_forward (\r
+       FIL *fp,                                                /* Pointer to the file object */\r
+       UINT (*func)(const BYTE*,UINT), /* Pointer to the streaming function */\r
+       UINT btr,                                               /* Number of bytes to forward */\r
+       UINT *bf                                                /* Pointer to number of bytes forwarded */\r
+)\r
+{\r
+       FRESULT res;\r
+       DWORD remain, clst, sect;\r
+       UINT rcnt;\r
+\r
+\r
+       *bf = 0;\r
+\r
+       res = validate(fp->fs, fp->id);                                 /* Check validity of the object */\r
+       if (res != FR_OK) LEAVE_FF(fp->fs, res);\r
+       if (fp->flag & FA__ERROR)                                               /* Check error flag */\r
+               LEAVE_FF(fp->fs, FR_INT_ERR);\r
+       if (!(fp->flag & FA_READ))                                              /* Check access mode */\r
+               LEAVE_FF(fp->fs, FR_DENIED);\r
+\r
+       remain = fp->fsize - fp->fptr;\r
+       if (btr > remain) btr = (UINT)remain;                   /* Truncate btr by remaining bytes */\r
+\r
+       for ( ;  btr && (*func)(NULL, 0);                               /* Repeat until all data transferred or stream becomes busy */\r
+               fp->fptr += rcnt, *bf += rcnt, btr -= rcnt) {\r
+               if ((fp->fptr % SS(fp->fs)) == 0) {                     /* On the sector boundary? */\r
+                       if (fp->csect >= fp->fs->csize) {               /* On the cluster boundary? */\r
+                               clst = (fp->fptr == 0) ?                        /* On the top of the file? */\r
+                                       fp->org_clust : get_fat(fp->fs, fp->curr_clust);\r
+                               if (clst <= 1) ABORT(fp->fs, FR_INT_ERR);\r
+                               if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);\r
+                               fp->curr_clust = clst;                          /* Update current cluster */\r
+                               fp->csect = 0;                                          /* Reset sector address in the cluster */\r
+                       }\r
+                       fp->csect++;                                                    /* Next sector address in the cluster */\r
+               }\r
+               sect = clust2sect(fp->fs, fp->curr_clust);      /* Get current data sector */\r
+               if (!sect) ABORT(fp->fs, FR_INT_ERR);\r
+               sect += fp->csect - 1;\r
+               if (move_window(fp->fs, sect))                          /* Move sector window */\r
+                       ABORT(fp->fs, FR_DISK_ERR);\r
+               fp->dsect = sect;\r
+               rcnt = SS(fp->fs) - (WORD)(fp->fptr % SS(fp->fs));      /* Forward data from sector window */\r
+               if (rcnt > btr) rcnt = btr;\r
+               rcnt = (*func)(&fp->fs->win[(WORD)fp->fptr % SS(fp->fs)], rcnt);\r
+               if (!rcnt) ABORT(fp->fs, FR_INT_ERR);\r
+       }\r
+\r
+       LEAVE_FF(fp->fs, FR_OK);\r
+}\r
+#endif /* _USE_FORWARD */\r
+\r
+\r
+\r
+#if _USE_MKFS && !_FS_READONLY\r
+/*-----------------------------------------------------------------------*/\r
+/* Create File System on the Drive                                       */\r
+/*-----------------------------------------------------------------------*/\r
+#define N_ROOTDIR      512                     /* Multiple of 32 and <= 2048 */\r
+#define N_FATS         1                       /* 1 or 2 */\r
+#define MAX_SECTOR     131072000UL     /* Maximum partition size */\r
+#define MIN_SECTOR     2000UL          /* Minimum partition size */\r
+\r
+\r
+FRESULT f_mkfs (\r
+       BYTE drv,                       /* Logical drive number */\r
+       BYTE partition,         /* Partitioning rule 0:FDISK, 1:SFD */\r
+       WORD allocsize          /* Allocation unit size [bytes] */\r
+)\r
+{\r
+       static const DWORD sstbl[] = { 2048000, 1024000, 512000, 256000, 128000, 64000, 32000, 16000, 8000, 4000,   0 };\r
+       static const WORD cstbl[] =  {   32768,   16384,   8192,   4096,   2048, 16384,  8192,  4096, 2048, 1024, 512 };\r
+       BYTE fmt, m, *tbl;\r
+       DWORD b_part, b_fat, b_dir, b_data;             /* Area offset (LBA) */\r
+       DWORD n_part, n_rsv, n_fat, n_dir;              /* Area size */\r
+       DWORD n_clst, d, n;\r
+       WORD as;\r
+       FATFS *fs;\r
+       DSTATUS stat;\r
+\r
+\r
+       /* Check validity of the parameters */\r
+       if (drv >= _DRIVES) return FR_INVALID_DRIVE;\r
+       if (partition >= 2) return FR_MKFS_ABORTED;\r
+\r
+       /* Check mounted drive and clear work area */\r
+       fs = FatFs[drv];\r
+       if (!fs) return FR_NOT_ENABLED;\r
+       fs->fs_type = 0;\r
+       drv = LD2PD(drv);\r
+\r
+       /* Get disk statics */\r
+       stat = disk_initialize(drv);\r
+       if (stat & STA_NOINIT) return FR_NOT_READY;\r
+       if (stat & STA_PROTECT) return FR_WRITE_PROTECTED;\r
+#if _MAX_SS != 512                                             /* Get disk sector size */\r
+       if (disk_ioctl(drv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK\r
+               || SS(fs) > _MAX_SS)\r
+               return FR_MKFS_ABORTED;\r
+#endif\r
+       if (disk_ioctl(drv, GET_SECTOR_COUNT, &n_part) != RES_OK || n_part < MIN_SECTOR)\r
+               return FR_MKFS_ABORTED;\r
+       if (n_part > MAX_SECTOR) n_part = MAX_SECTOR;\r
+       b_part = (!partition) ? 63 : 0;         /* Boot sector */\r
+       n_part -= b_part;\r
+       for (d = 512; d <= 32768U && d != allocsize; d <<= 1) ; /* Check validity of the allocation unit size */\r
+       if (d != allocsize) allocsize = 0;\r
+       if (!allocsize) {                                       /* Auto selection of cluster size */\r
+               d = n_part;\r
+               for (as = SS(fs); as > 512U; as >>= 1) d >>= 1;\r
+               for (n = 0; d < sstbl[n]; n++) ;\r
+               allocsize = cstbl[n];\r
+       }\r
+       if (allocsize < SS(fs)) allocsize = SS(fs);\r
+\r
+       allocsize /= SS(fs);            /* Number of sectors per cluster */\r
+\r
+       /* Pre-compute number of clusters and FAT type */\r
+       n_clst = n_part / allocsize;\r
+       fmt = FS_FAT12;\r
+       if (n_clst >= 0xFF5) fmt = FS_FAT16;\r
+       if (n_clst >= 0xFFF5) fmt = FS_FAT32;\r
+\r
+       /* Determine offset and size of FAT structure */\r
+       switch (fmt) {\r
+       case FS_FAT12:\r
+               n_fat = ((n_clst * 3 + 1) / 2 + 3 + SS(fs) - 1) / SS(fs);\r
+               n_rsv = 1 + partition;\r
+               n_dir = N_ROOTDIR * 32 / SS(fs);\r
+               break;\r
+       case FS_FAT16:\r
+               n_fat = ((n_clst * 2) + 4 + SS(fs) - 1) / SS(fs);\r
+               n_rsv = 1 + partition;\r
+               n_dir = N_ROOTDIR * 32 / SS(fs);\r
+               break;\r
+       default:\r
+               n_fat = ((n_clst * 4) + 8 + SS(fs) - 1) / SS(fs);\r
+               n_rsv = 33 - partition;\r
+               n_dir = 0;\r
+       }\r
+       b_fat = b_part + n_rsv;                 /* FATs start sector */\r
+       b_dir = b_fat + n_fat * N_FATS; /* Directory start sector */\r
+       b_data = b_dir + n_dir;                 /* Data start sector */\r
+\r
+       /* Align data start sector to erase block boundary (for flash memory media) */\r
+       if (disk_ioctl(drv, GET_BLOCK_SIZE, &n) != RES_OK) return FR_MKFS_ABORTED;\r
+       n = (b_data + n - 1) & ~(n - 1);\r
+       n_fat += (n - b_data) / N_FATS;\r
+       /* b_dir and b_data are no longer used below */\r
+\r
+       /* Determine number of cluster and final check of validity of the FAT type */\r
+       n_clst = (n_part - n_rsv - n_fat * N_FATS - n_dir) / allocsize;\r
+       if (   (fmt == FS_FAT16 && n_clst < 0xFF5)\r
+               || (fmt == FS_FAT32 && n_clst < 0xFFF5))\r
+               return FR_MKFS_ABORTED;\r
+\r
+       /* Create partition table if needed */\r
+       if (!partition) {\r
+               DWORD n_disk = b_part + n_part;\r
+\r
+               mem_set(fs->win, 0, SS(fs));\r
+               tbl = fs->win+MBR_Table;\r
+               ST_DWORD(tbl, 0x00010180);              /* Partition start in CHS */\r
+               if (n_disk < 63UL * 255 * 1024) {       /* Partition end in CHS */\r
+                       n_disk = n_disk / 63 / 255;\r
+                       tbl[7] = (BYTE)n_disk;\r
+                       tbl[6] = (BYTE)((n_disk >> 2) | 63);\r
+               } else {\r
+                       ST_WORD(&tbl[6], 0xFFFF);\r
+               }\r
+               tbl[5] = 254;\r
+               if (fmt != FS_FAT32)                    /* System ID */\r
+                       tbl[4] = (n_part < 0x10000) ? 0x04 : 0x06;\r
+               else\r
+                       tbl[4] = 0x0c;\r
+               ST_DWORD(tbl+8, 63);                    /* Partition start in LBA */\r
+               ST_DWORD(tbl+12, n_part);               /* Partition size in LBA */\r
+               ST_WORD(tbl+64, 0xAA55);                /* Signature */\r
+               if (disk_write(drv, fs->win, 0, 1) != RES_OK)\r
+                       return FR_DISK_ERR;\r
+               partition = 0xF8;\r
+       } else {\r
+               partition = 0xF0;\r
+       }\r
+\r
+       /* Create boot record */\r
+       tbl = fs->win;                                                          /* Clear buffer */\r
+       mem_set(tbl, 0, SS(fs));\r
+       ST_DWORD(tbl+BS_jmpBoot, 0x90FEEB);                     /* Boot code (jmp $, nop) */\r
+       ST_WORD(tbl+BPB_BytsPerSec, SS(fs));            /* Sector size */\r
+       tbl[BPB_SecPerClus] = (BYTE)allocsize;          /* Sectors per cluster */\r
+       ST_WORD(tbl+BPB_RsvdSecCnt, n_rsv);                     /* Reserved sectors */\r
+       tbl[BPB_NumFATs] = N_FATS;                                      /* Number of FATs */\r
+       ST_WORD(tbl+BPB_RootEntCnt, SS(fs) / 32 * n_dir); /* Number of rootdir entries */\r
+       if (n_part < 0x10000) {                                         /* Number of total sectors */\r
+               ST_WORD(tbl+BPB_TotSec16, n_part);\r
+       } else {\r
+               ST_DWORD(tbl+BPB_TotSec32, n_part);\r
+       }\r
+       tbl[BPB_Media] = partition;                                     /* Media descripter */\r
+       ST_WORD(tbl+BPB_SecPerTrk, 63);                         /* Number of sectors per track */\r
+       ST_WORD(tbl+BPB_NumHeads, 255);                         /* Number of heads */\r
+       ST_DWORD(tbl+BPB_HiddSec, b_part);                      /* Hidden sectors */\r
+       n = get_fattime();                                                      /* Use current time as a VSN */\r
+       if (fmt != FS_FAT32) {\r
+               ST_DWORD(tbl+BS_VolID, n);                              /* Volume serial number */\r
+               ST_WORD(tbl+BPB_FATSz16, n_fat);                /* Number of secters per FAT */\r
+               tbl[BS_DrvNum] = 0x80;                                  /* Drive number */\r
+               tbl[BS_BootSig] = 0x29;                                 /* Extended boot signature */\r
+               mem_cpy(tbl+BS_VolLab, "NO NAME    FAT     ", 19);      /* Volume lavel, FAT signature */\r
+       } else {\r
+               ST_DWORD(tbl+BS_VolID32, n);                    /* Volume serial number */\r
+               ST_DWORD(tbl+BPB_FATSz32, n_fat);               /* Number of secters per FAT */\r
+               ST_DWORD(tbl+BPB_RootClus, 2);                  /* Root directory cluster (2) */\r
+               ST_WORD(tbl+BPB_FSInfo, 1);                             /* FSInfo record offset (bs+1) */\r
+               ST_WORD(tbl+BPB_BkBootSec, 6);                  /* Backup boot record offset (bs+6) */\r
+               tbl[BS_DrvNum32] = 0x80;                                /* Drive number */\r
+               tbl[BS_BootSig32] = 0x29;                               /* Extended boot signature */\r
+               mem_cpy(tbl+BS_VolLab32, "NO NAME    FAT32   ", 19);    /* Volume lavel, FAT signature */\r
+       }\r
+       ST_WORD(tbl+BS_55AA, 0xAA55);                           /* Signature */\r
+       if (SS(fs) > 512U) {\r
+               ST_WORD(tbl+SS(fs)-2, 0xAA55);\r
+       }\r
+       if (disk_write(drv, tbl, b_part+0, 1) != RES_OK)\r
+               return FR_DISK_ERR;\r
+       if (fmt == FS_FAT32)\r
+               disk_write(drv, tbl, b_part+6, 1);\r
+\r
+       /* Initialize FAT area */\r
+       for (m = 0; m < N_FATS; m++) {\r
+               mem_set(tbl, 0, SS(fs));                /* 1st sector of the FAT  */\r
+               if (fmt != FS_FAT32) {\r
+                       n = (fmt == FS_FAT12) ? 0x00FFFF00 : 0xFFFFFF00;\r
+                       n |= partition;\r
+                       ST_DWORD(tbl, n);                               /* Reserve cluster #0-1 (FAT12/16) */\r
+               } else {\r
+                       ST_DWORD(tbl+0, 0xFFFFFFF8);    /* Reserve cluster #0-1 (FAT32) */\r
+                       ST_DWORD(tbl+4, 0xFFFFFFFF);\r
+                       ST_DWORD(tbl+8, 0x0FFFFFFF);    /* Reserve cluster #2 for root dir */\r
+               }\r
+               if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)\r
+                       return FR_DISK_ERR;\r
+               mem_set(tbl, 0, SS(fs));                /* Following FAT entries are filled by zero */\r
+               for (n = 1; n < n_fat; n++) {\r
+                       if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)\r
+                               return FR_DISK_ERR;\r
+               }\r
+       }\r
+\r
+       /* Initialize Root directory */\r
+       m = (BYTE)((fmt == FS_FAT32) ? allocsize : n_dir);\r
+       do {\r
+               if (disk_write(drv, tbl, b_fat++, 1) != RES_OK)\r
+                       return FR_DISK_ERR;\r
+       } while (--m);\r
+\r
+       /* Create FSInfo record if needed */\r
+       if (fmt == FS_FAT32) {\r
+               ST_WORD(tbl+BS_55AA, 0xAA55);\r
+               ST_DWORD(tbl+FSI_LeadSig, 0x41615252);\r
+               ST_DWORD(tbl+FSI_StrucSig, 0x61417272);\r
+               ST_DWORD(tbl+FSI_Free_Count, n_clst - 1);\r
+               ST_DWORD(tbl+FSI_Nxt_Free, 0xFFFFFFFF);\r
+               disk_write(drv, tbl, b_part+1, 1);\r
+               disk_write(drv, tbl, b_part+7, 1);\r
+       }\r
+\r
+       return (disk_ioctl(drv, CTRL_SYNC, (void*)NULL) == RES_OK) ? FR_OK : FR_DISK_ERR;\r
+}\r
+\r
+#endif /* _USE_MKFS && !_FS_READONLY */\r
+\r
+\r
+\r
+\r
+#if _USE_STRFUNC\r
+/*-----------------------------------------------------------------------*/\r
+/* Get a string from the file                                            */\r
+/*-----------------------------------------------------------------------*/\r
+char* f_gets (\r
+       char* buff,     /* Pointer to the string buffer to read */\r
+       int len,        /* Size of string buffer */\r
+       FIL* fil        /* Pointer to the file object */\r
+)\r
+{\r
+       int i = 0;\r
+       char *p = buff;\r
+       UINT rc;\r
+\r
+\r
+       while (i < len - 1) {                   /* Read bytes until buffer gets filled */\r
+               f_read(fil, p, 1, &rc);\r
+               if (rc != 1) break;                     /* Break when no data to read */\r
+#if _USE_STRFUNC >= 2\r
+               if (*p == '\r') continue;       /* Strip '\r' */\r
+#endif\r
+               i++;\r
+               if (*p++ == '\n') break;        /* Break when reached end of line */\r
+       }\r
+       *p = 0;\r
+       return i ? buff : NULL;                 /* When no data read (eof or error), return with error. */\r
+}\r
+\r
+\r
+\r
+#if !_FS_READONLY\r
+#include <stdarg.h>\r
+/*-----------------------------------------------------------------------*/\r
+/* Put a character to the file                                           */\r
+/*-----------------------------------------------------------------------*/\r
+int f_putc (\r
+       int chr,        /* A character to be output */\r
+       FIL* fil        /* Ponter to the file object */\r
+)\r
+{\r
+       UINT bw;\r
+       char c;\r
+\r
+\r
+#if _USE_STRFUNC >= 2\r
+       if (chr == '\n') f_putc ('\r', fil);    /* LF -> CRLF conversion */\r
+#endif\r
+       if (!fil) {     /* Special value may be used to switch the destination to any other device */\r
+       /*      put_console(chr);       */\r
+               return chr;\r
+       }\r
+       c = (char)chr;\r
+       f_write(fil, &c, 1, &bw);       /* Write a byte to the file */\r
+       return bw ? chr : EOF;          /* Return the result */\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Put a string to the file                                              */\r
+/*-----------------------------------------------------------------------*/\r
+int f_puts (\r
+       const char* str,        /* Pointer to the string to be output */\r
+       FIL* fil                        /* Pointer to the file object */\r
+)\r
+{\r
+       int n;\r
+\r
+\r
+       for (n = 0; *str; str++, n++) {\r
+               if (f_putc(*str, fil) == EOF) return EOF;\r
+       }\r
+       return n;\r
+}\r
+\r
+\r
+\r
+\r
+/*-----------------------------------------------------------------------*/\r
+/* Put a formatted string to the file                                    */\r
+/*-----------------------------------------------------------------------*/\r
+int f_printf (\r
+       FIL* fil,                       /* Pointer to the file object */\r
+       const char* str,        /* Pointer to the format string */\r
+       ...                                     /* Optional arguments... */\r
+)\r
+{\r
+       va_list arp;\r
+       UCHAR c, f, r;\r
+       ULONG val;\r
+       char s[16];\r
+       int i, w, res, cc;\r
+\r
+\r
+       va_start(arp, str);\r
+\r
+       for (cc = res = 0; cc != EOF; res += cc) {\r
+               c = *str++;\r
+               if (c == 0) break;                      /* End of string */\r
+               if (c != '%') {                         /* Non escape cahracter */\r
+                       cc = f_putc(c, fil);\r
+                       if (cc != EOF) cc = 1;\r
+                       continue;\r
+               }\r
+               w = f = 0;\r
+               c = *str++;\r
+               if (c == '0') {                         /* Flag: '0' padding */\r
+                       f = 1; c = *str++;\r
+               }\r
+               while (c >= '0' && c <= '9') {  /* Precision */\r
+                       w = w * 10 + (c - '0');\r
+                       c = *str++;\r
+               }\r
+               if (c == 'l') {                         /* Prefix: Size is long int */\r
+                       f |= 2; c = *str++;\r
+               }\r
+               if (c == 's') {                         /* Type is string */\r
+                       cc = f_puts(va_arg(arp, char*), fil);\r
+                       continue;\r
+               }\r
+               if (c == 'c') {                         /* Type is character */\r
+                       cc = f_putc(va_arg(arp, int), fil);\r
+                       if (cc != EOF) cc = 1;\r
+                       continue;\r
+               }\r
+               r = 0;\r
+               if (c == 'd') r = 10;           /* Type is signed decimal */\r
+               if (c == 'u') r = 10;           /* Type is unsigned decimal */\r
+               if (c == 'X') r = 16;           /* Type is unsigned hexdecimal */\r
+               if (r == 0) break;                      /* Unknown type */\r
+               if (f & 2) {                            /* Get the value */\r
+                       val = (ULONG)va_arg(arp, long);\r
+               } else {\r
+                       val = (c == 'd') ? (ULONG)(long)va_arg(arp, int) : (ULONG)va_arg(arp, unsigned int);\r
+               }\r
+               /* Put numeral string */\r
+               if (c == 'd') {\r
+                       if (val & 0x80000000) {\r
+                               val = 0 - val;\r
+                               f |= 4;\r
+                       }\r
+               }\r
+               i = sizeof(s) - 1; s[i] = 0;\r
+               do {\r
+                       c = (UCHAR)(val % r + '0');\r
+                       if (c > '9') c += 7;\r
+                       s[--i] = c;\r
+                       val /= r;\r
+               } while (i && val);\r
+               if (i && (f & 4)) s[--i] = '-';\r
+               w = sizeof(s) - 1 - w;\r
+               while (i && i > w) s[--i] = (f & 1) ? '0' : ' ';\r
+               cc = f_puts(&s[i], fil);\r
+       }\r
+\r
+       va_end(arp);\r
+       return (cc == EOF) ? cc : res;\r
+}\r
+\r
+#endif /* !_FS_READONLY */\r
+#endif /* _USE_STRFUNC */\r
diff --git a/Projects/Webserver/Lib/FATFs/ff.h b/Projects/Webserver/Lib/FATFs/ff.h
new file mode 100644 (file)
index 0000000..41e136e
--- /dev/null
@@ -0,0 +1,596 @@
+/*---------------------------------------------------------------------------/\r
+/  FatFs - FAT file system module include file  R0.07e       (C)ChaN, 2010\r
+/----------------------------------------------------------------------------/\r
+/ FatFs module is a generic FAT file system module for small embedded systems.\r
+/ This is a free software that opened for education, research and commercial\r
+/ developments under license policy of following trems.\r
+/\r
+/  Copyright (C) 2010, ChaN, all right reserved.\r
+/\r
+/ * The FatFs module is a free software and there is NO WARRANTY.\r
+/ * No restriction on use. You can use, modify and redistribute it for\r
+/   personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.\r
+/ * Redistributions of source code must retain the above copyright notice.\r
+/----------------------------------------------------------------------------*/\r
+\r
+#ifndef _FATFS\r
+#define _FATFS 0x007E\r
+\r
+#include "integer.h"   /* Basic integer types */\r
+#include "ffconf.h"            /* FatFs configuration options */\r
+\r
+#if _FATFS != _FFCONFIG\r
+#error Wrong configuration file (ffconf.h).\r
+#endif\r
+\r
+\r
+/* DBCS code ranges and SBCS extend char conversion table */\r
+\r
+#if _CODE_PAGE == 932  /* Japanese Shift-JIS */\r
+#define _DF1S  0x81    /* DBC 1st byte range 1 start */\r
+#define _DF1E  0x9F    /* DBC 1st byte range 1 end */\r
+#define _DF2S  0xE0    /* DBC 1st byte range 2 start */\r
+#define _DF2E  0xFC    /* DBC 1st byte range 2 end */\r
+#define _DS1S  0x40    /* DBC 2nd byte range 1 start */\r
+#define _DS1E  0x7E    /* DBC 2nd byte range 1 end */\r
+#define _DS2S  0x80    /* DBC 2nd byte range 2 start */\r
+#define _DS2E  0xFC    /* DBC 2nd byte range 2 end */\r
+\r
+#elif _CODE_PAGE == 936        /* Simplified Chinese GBK */\r
+#define _DF1S  0x81\r
+#define _DF1E  0xFE\r
+#define _DS1S  0x40\r
+#define _DS1E  0x7E\r
+#define _DS2S  0x80\r
+#define _DS2E  0xFE\r
+\r
+#elif _CODE_PAGE == 949        /* Korean */\r
+#define _DF1S  0x81\r
+#define _DF1E  0xFE\r
+#define _DS1S  0x41\r
+#define _DS1E  0x5A\r
+#define _DS2S  0x61\r
+#define _DS2E  0x7A\r
+#define _DS3S  0x81\r
+#define _DS3E  0xFE\r
+\r
+#elif _CODE_PAGE == 950        /* Traditional Chinese Big5 */\r
+#define _DF1S  0x81\r
+#define _DF1E  0xFE\r
+#define _DS1S  0x40\r
+#define _DS1E  0x7E\r
+#define _DS2S  0xA1\r
+#define _DS2E  0xFE\r
+\r
+#elif _CODE_PAGE == 437        /* U.S. (OEM) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F,0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \\r
+                               0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 720        /* Arabic (OEM) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x45,0x41,0x84,0x41,0x86,0x43,0x45,0x45,0x45,0x49,0x49,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x49,0x49,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \\r
+                               0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 737        /* Greek (OEM) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x96,0x97,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, \\r
+                               0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0xAA,0x92,0x93,0x94,0x95,0x96,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0x97,0xEA,0xEB,0xEC,0xE4,0xED,0xEE,0xE7,0xE8,0xF1,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 775        /* Baltic (OEM) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x9A,0x91,0xA0,0x8E,0x95,0x8F,0x80,0xAD,0xED,0x8A,0x8A,0xA1,0x8D,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0x95,0x96,0x97,0x97,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \\r
+                               0xA0,0xA1,0xE0,0xA3,0xA3,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xB5,0xB6,0xB7,0xB8,0xBD,0xBE,0xC6,0xC7,0xA5,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE3,0xE8,0xE8,0xEA,0xEA,0xEE,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 850        /* Multilingual Latin 1 (OEM) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \\r
+                               0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 852        /* Latin 2 (OEM) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F,0x90,0x91,0x91,0xE2,0x99,0x95,0x95,0x97,0x97,0x99,0x9A,0x9B,0x9B,0x9D,0x9E,0x9F, \\r
+                               0xB5,0xD6,0xE0,0xE9,0xA4,0xA4,0xA6,0xA6,0xA8,0xA8,0xAA,0x8D,0xAC,0xB8,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBD,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC6,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD2,0xD5,0xD6,0xD7,0xB7,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xE0,0xE1,0xE2,0xE3,0xE3,0xD5,0xE6,0xE6,0xE8,0xE9,0xE8,0xEB,0xED,0xED,0xDD,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 855        /* Cyrillic (OEM) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x81,0x81,0x83,0x83,0x85,0x85,0x87,0x87,0x89,0x89,0x8B,0x8B,0x8D,0x8D,0x8F,0x8F,0x91,0x91,0x93,0x93,0x95,0x95,0x97,0x97,0x99,0x99,0x9B,0x9B,0x9D,0x9D,0x9F,0x9F, \\r
+                               0xA1,0xA1,0xA3,0xA3,0xA5,0xA5,0xA7,0xA7,0xA9,0xA9,0xAB,0xAB,0xAD,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB6,0xB6,0xB8,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD3,0xD3,0xD5,0xD5,0xD7,0xD7,0xDD,0xD9,0xDA,0xDB,0xDC,0xDD,0xE0,0xDF, \\r
+                               0xE0,0xE2,0xE2,0xE4,0xE4,0xE6,0xE6,0xE8,0xE8,0xEA,0xEA,0xEC,0xEC,0xEE,0xEE,0xEF,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 857        /* Turkish (OEM) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0x98,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x98,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9E, \\r
+                               0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA6,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xDE,0x59,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 858        /* Multilingual Latin 1 + Euro (OEM) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \\r
+                               0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 862        /* Hebrew (OEM) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \\r
+                               0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 866        /* Russian (OEM) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \\r
+                               0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0x90,0x91,0x92,0x93,0x9d,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 874        /* Thai (OEM, Windows) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \\r
+                               0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 1250 /* Central Europe (Windows) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \\r
+                               0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}\r
+\r
+#elif _CODE_PAGE == 1251 /* Cyrillic (Windows) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x82,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \\r
+                               0xA0,0xA2,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF}\r
+\r
+#elif _CODE_PAGE == 1252 /* Latin 1 (Windows) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0xAd,0x9B,0x8C,0x9D,0xAE,0x9F, \\r
+                               0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}\r
+\r
+#elif _CODE_PAGE == 1253 /* Greek (Windows) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \\r
+                               0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xA2,0xB8,0xB9,0xBA, \\r
+                               0xE0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xFB,0xBC,0xFD,0xBF,0xFF}\r
+\r
+#elif _CODE_PAGE == 1254 /* Turkish (Windows) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x9E,0x9F, \\r
+                               0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}\r
+\r
+#elif _CODE_PAGE == 1255 /* Hebrew (Windows) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \\r
+                               0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 1256 /* Arabic (Windows) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x8C,0x9D,0x9E,0x9F, \\r
+                               0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0x41,0xE1,0x41,0xE3,0xE4,0xE5,0xE6,0x43,0x45,0x45,0x45,0x45,0xEC,0xED,0x49,0x49,0xF0,0xF1,0xF2,0xF3,0x4F,0xF5,0xF6,0xF7,0xF8,0x55,0xFA,0x55,0x55,0xFD,0xFE,0xFF}\r
+\r
+#elif _CODE_PAGE == 1257 /* Baltic (Windows) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \\r
+                               0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}\r
+\r
+#elif _CODE_PAGE == 1258 /* Vietnam (OEM, Windows) */\r
+#define _DF1S  0\r
+#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0xAC,0x9D,0x9E,0x9F, \\r
+                               0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \\r
+                               0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xEC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xFE,0x9F}\r
+\r
+#elif _CODE_PAGE == 1  /* ASCII (for only non-LFN cfg) */\r
+#define _DF1S  0\r
+\r
+#else\r
+#error Unknown code page\r
+\r
+#endif\r
+\r
+\r
+\r
+/* Character code support macros */\r
+\r
+#define IsUpper(c)     (((c)>='A')&&((c)<='Z'))\r
+#define IsLower(c)     (((c)>='a')&&((c)<='z'))\r
+\r
+#if _DF1S              /* DBCS configuration */\r
+\r
+#ifdef _DF2S   /* Two 1st byte areas */\r
+#define IsDBCS1(c)     (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E))\r
+#else                  /* One 1st byte area */\r
+#define IsDBCS1(c)     ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E)\r
+#endif\r
+\r
+#ifdef _DS3S   /* Three 2nd byte areas */\r
+#define IsDBCS2(c)     (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E))\r
+#else                  /* Two 2nd byte areas */\r
+#define IsDBCS2(c)     (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E))\r
+#endif\r
+\r
+#else                  /* SBCS configuration */\r
+\r
+#define IsDBCS1(c)     0\r
+#define IsDBCS2(c)     0\r
+\r
+#endif /* _DF1S */\r
+\r
+\r
+\r
+/* Definitions corresponds to multi partition */\r
+\r
+#if _MULTI_PARTITION           /* Multiple partition configuration */\r
+\r
+typedef struct _PARTITION {\r
+       BYTE pd;        /* Physical drive# */\r
+       BYTE pt;        /* Partition # (0-3) */\r
+} PARTITION;\r
+\r
+extern\r
+const PARTITION Drives[];                      /* Logical drive# to physical location conversion table */\r
+#define LD2PD(drv) (Drives[drv].pd)    /* Get physical drive# */\r
+#define LD2PT(drv) (Drives[drv].pt)    /* Get partition# */\r
+\r
+#else                                          /* Single partition configuration */\r
+\r
+#define LD2PD(drv) (drv)       /* Physical drive# is equal to the logical drive# */\r
+#define LD2PT(drv) 0           /* Always mounts the 1st partition */\r
+\r
+#endif\r
+\r
+\r
+\r
+/* Definitions corresponds to multiple sector size */\r
+\r
+#if _MAX_SS == 512             /* Single sector size */\r
+#define        SS(fs)  512U\r
+\r
+#elif _MAX_SS == 1024 || _MAX_SS == 2048 || _MAX_SS == 4096    /* Multiple sector size */\r
+#define        SS(fs)  ((fs)->s_size)\r
+\r
+#else\r
+#error Sector size must be 512, 1024, 2048 or 4096.\r
+\r
+#endif\r
+\r
+\r
+\r
+/* Type of file name on FatFs API */\r
+\r
+#if _LFN_UNICODE && _USE_LFN\r
+typedef WCHAR XCHAR;   /* Unicode */\r
+#else\r
+typedef char XCHAR;            /* SBCS, DBCS */\r
+#endif\r
+\r
+\r
+\r
+/* File system object structure */\r
+\r
+typedef struct _FATFS_ {\r
+       BYTE    fs_type;        /* FAT sub type */\r
+       BYTE    drive;          /* Physical drive number */\r
+       BYTE    csize;          /* Number of sectors per cluster */\r
+       BYTE    n_fats;         /* Number of FAT copies */\r
+       BYTE    wflag;          /* win[] dirty flag (1:must be written back) */\r
+       BYTE    fsi_flag;       /* fsinfo dirty flag (1:must be written back) */\r
+       WORD    id;                     /* File system mount ID */\r
+       WORD    n_rootdir;      /* Number of root directory entries (0 on FAT32) */\r
+#if _FS_REENTRANT\r
+       _SYNC_t sobj;           /* Identifier of sync object */\r
+#endif\r
+#if _MAX_SS != 512\r
+       WORD    s_size;         /* Sector size */\r
+#endif\r
+#if !_FS_READONLY\r
+       DWORD   last_clust;     /* Last allocated cluster */\r
+       DWORD   free_clust;     /* Number of free clusters */\r
+       DWORD   fsi_sector;     /* fsinfo sector */\r
+#endif\r
+#if _FS_RPATH\r
+       DWORD   cdir;           /* Current directory (0:root)*/\r
+#endif\r
+       DWORD   sects_fat;      /* Sectors per fat */\r
+       DWORD   max_clust;      /* Maximum cluster# + 1. Number of clusters is max_clust - 2 */\r
+       DWORD   fatbase;        /* FAT start sector */\r
+       DWORD   dirbase;        /* Root directory start sector (Cluster# on FAT32) */\r
+       DWORD   database;       /* Data start sector */\r
+       DWORD   winsect;        /* Current sector appearing in the win[] */\r
+       BYTE    win[_MAX_SS];/* Disk access window for Directory/FAT */\r
+} FATFS;\r
+\r
+\r
+\r
+/* Directory object structure */\r
+\r
+typedef struct _DIR_ {\r
+       FATFS*  fs;                     /* Pointer to the owner file system object */\r
+       WORD    id;                     /* Owner file system mount ID */\r
+       WORD    index;          /* Current read/write index number */\r
+       DWORD   sclust;         /* Table start cluster (0:Static table) */\r
+       DWORD   clust;          /* Current cluster */\r
+       DWORD   sect;           /* Current sector */\r
+       BYTE*   dir;            /* Pointer to the current SFN entry in the win[] */\r
+       BYTE*   fn;                     /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */\r
+#if _USE_LFN\r
+       WCHAR*  lfn;            /* Pointer to the LFN working buffer */\r
+       WORD    lfn_idx;        /* Last matched LFN index number (0xFFFF:No LFN) */\r
+#endif\r
+} DIR;\r
+\r
+\r
+\r
+/* File object structure */\r
+\r
+typedef struct _FIL_ {\r
+       FATFS*  fs;                     /* Pointer to the owner file system object */\r
+       WORD    id;                     /* Owner file system mount ID */\r
+       BYTE    flag;           /* File status flags */\r
+       BYTE    csect;          /* Sector address in the cluster */\r
+       DWORD   fptr;           /* File R/W pointer */\r
+       DWORD   fsize;          /* File size */\r
+       DWORD   org_clust;      /* File start cluster */\r
+       DWORD   curr_clust;     /* Current cluster */\r
+       DWORD   dsect;          /* Current data sector */\r
+#if !_FS_READONLY\r
+       DWORD   dir_sect;       /* Sector containing the directory entry */\r
+       BYTE*   dir_ptr;        /* Ponter to the directory entry in the window */\r
+#endif\r
+#if !_FS_TINY\r
+       BYTE    buf[_MAX_SS];/* File R/W buffer */\r
+#endif\r
+} FIL;\r
+\r
+\r
+\r
+/* File status structure */\r
+\r
+typedef struct _FILINFO_ {\r
+       DWORD   fsize;          /* File size */\r
+       WORD    fdate;          /* Last modified date */\r
+       WORD    ftime;          /* Last modified time */\r
+       BYTE    fattrib;        /* Attribute */\r
+       char    fname[13];      /* Short file name (8.3 format) */\r
+#if _USE_LFN\r
+       XCHAR*  lfname;         /* Pointer to the LFN buffer */\r
+       int     lfsize;         /* Size of LFN buffer [chrs] */\r
+#endif\r
+} FILINFO;\r
+\r
+\r
+\r
+/* File function return code (FRESULT) */\r
+\r
+typedef enum {\r
+       FR_OK = 0,                      /* 0 */\r
+       FR_DISK_ERR,            /* 1 */\r
+       FR_INT_ERR,                     /* 2 */\r
+       FR_NOT_READY,           /* 3 */\r
+       FR_NO_FILE,                     /* 4 */\r
+       FR_NO_PATH,                     /* 5 */\r
+       FR_INVALID_NAME,        /* 6 */\r
+       FR_DENIED,                      /* 7 */\r
+       FR_EXIST,                       /* 8 */\r
+       FR_INVALID_OBJECT,      /* 9 */\r
+       FR_WRITE_PROTECTED,     /* 10 */\r
+       FR_INVALID_DRIVE,       /* 11 */\r
+       FR_NOT_ENABLED,         /* 12 */\r
+       FR_NO_FILESYSTEM,       /* 13 */\r
+       FR_MKFS_ABORTED,        /* 14 */\r
+       FR_TIMEOUT                      /* 15 */\r
+} FRESULT;\r
+\r
+\r
+\r
+/*--------------------------------------------------------------*/\r
+/* FatFs module application interface                           */\r
+\r
+FRESULT f_mount (BYTE, FATFS*);                                                /* Mount/Unmount a logical drive */\r
+FRESULT f_open (FIL*, const XCHAR*, BYTE);                     /* Open or create a file */\r
+FRESULT f_read (FIL*, void*, UINT, UINT*);                     /* Read data from a file */\r
+FRESULT f_write (FIL*, const void*, UINT, UINT*);      /* Write data to a file */\r
+FRESULT f_lseek (FIL*, DWORD);                                         /* Move file pointer of a file object */\r
+FRESULT f_close (FIL*);                                                                /* Close an open file object */\r
+FRESULT f_opendir (DIR*, const XCHAR*);                                /* Open an existing directory */\r
+FRESULT f_readdir (DIR*, FILINFO*);                                    /* Read a directory item */\r
+FRESULT f_stat (const XCHAR*, FILINFO*);                       /* Get file status */\r
+FRESULT f_getfree (const XCHAR*, DWORD*, FATFS**);     /* Get number of free clusters on the drive */\r
+FRESULT f_truncate (FIL*);                                                     /* Truncate file */\r
+FRESULT f_sync (FIL*);                                                         /* Flush cached data of a writing file */\r
+FRESULT f_unlink (const XCHAR*);                                       /* Delete an existing file or directory */\r
+FRESULT        f_mkdir (const XCHAR*);                                         /* Create a new directory */\r
+FRESULT f_chmod (const XCHAR*, BYTE, BYTE);                    /* Change attriburte of the file/dir */\r
+FRESULT f_utime (const XCHAR*, const FILINFO*);                /* Change timestamp of the file/dir */\r
+FRESULT f_rename (const XCHAR*, const XCHAR*);         /* Rename/Move a file or directory */\r
+FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*);      /* Forward data to the stream */\r
+FRESULT f_mkfs (BYTE, BYTE, WORD);                                     /* Create a file system on the drive */\r
+FRESULT f_chdir (const XCHAR*);                                                /* Change current directory */\r
+FRESULT f_chdrive (BYTE);                                                      /* Change current drive */\r
+\r
+#if _USE_STRFUNC\r
+int f_putc (int, FIL*);                                                                /* Put a character to the file */\r
+int f_puts (const char*, FIL*);                                                /* Put a string to the file */\r
+int f_printf (FIL*, const char*, ...);                         /* Put a formatted string to the file */\r
+char* f_gets (char*, int, FIL*);                                       /* Get a string from the file */\r
+#define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)\r
+#define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)\r
+#ifndef EOF\r
+#define EOF -1\r
+#endif\r
+#endif\r
+\r
+\r
+\r
+/*--------------------------------------------------------------*/\r
+/* User defined functions                                       */\r
+\r
+/* Real time clock */\r
+#if !_FS_READONLY\r
+DWORD get_fattime (void);      /* 31-25: Year(0-127 org.1980), 24-21: Month(1-12), 20-16: Day(1-31) */\r
+                                                       /* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */\r
+#endif\r
+\r
+/* Unicode - OEM code conversion */\r
+#if _USE_LFN\r
+WCHAR ff_convert (WCHAR, UINT);\r
+WCHAR ff_wtoupper (WCHAR);\r
+#endif\r
+\r
+/* Sync functions */\r
+#if _FS_REENTRANT\r
+BOOL ff_cre_syncobj(BYTE, _SYNC_t*);\r
+BOOL ff_del_syncobj(_SYNC_t);\r
+BOOL ff_req_grant(_SYNC_t);\r
+void ff_rel_grant(_SYNC_t);\r
+#endif\r
+\r
+\r
+\r
+/*--------------------------------------------------------------*/\r
+/* Flags and offset address                                     */\r
+\r
+\r
+/* File access control and file status flags (FIL.flag) */\r
+\r
+#define        FA_READ                         0x01\r
+#define        FA_OPEN_EXISTING        0x00\r
+#if _FS_READONLY == 0\r
+#define        FA_WRITE                        0x02\r
+#define        FA_CREATE_NEW           0x04\r
+#define        FA_CREATE_ALWAYS        0x08\r
+#define        FA_OPEN_ALWAYS          0x10\r
+#define FA__WRITTEN                    0x20\r
+#define FA__DIRTY                      0x40\r
+#endif\r
+#define FA__ERROR                      0x80\r
+\r
+\r
+/* FAT sub type (FATFS.fs_type) */\r
+\r
+#define FS_FAT12       1\r
+#define FS_FAT16       2\r
+#define FS_FAT32       3\r
+\r
+\r
+/* File attribute bits for directory entry */\r
+\r
+#define        AM_RDO  0x01    /* Read only */\r
+#define        AM_HID  0x02    /* Hidden */\r
+#define        AM_SYS  0x04    /* System */\r
+#define        AM_VOL  0x08    /* Volume label */\r
+#define AM_LFN 0x0F    /* LFN entry */\r
+#define AM_DIR 0x10    /* Directory */\r
+#define AM_ARC 0x20    /* Archive */\r
+#define AM_MASK        0x3F    /* Mask of defined bits */\r
+\r
+\r
+/* FatFs refers the members in the FAT structures with byte offset instead\r
+/ of structure member because there are incompatibility of the packing option\r
+/ between various compilers. */\r
+\r
+#define BS_jmpBoot                     0\r
+#define BS_OEMName                     3\r
+#define BPB_BytsPerSec         11\r
+#define BPB_SecPerClus         13\r
+#define BPB_RsvdSecCnt         14\r
+#define BPB_NumFATs                    16\r
+#define BPB_RootEntCnt         17\r
+#define BPB_TotSec16           19\r
+#define BPB_Media                      21\r
+#define BPB_FATSz16                    22\r
+#define BPB_SecPerTrk          24\r
+#define BPB_NumHeads           26\r
+#define BPB_HiddSec                    28\r
+#define BPB_TotSec32           32\r
+#define BS_55AA                                510\r
+\r
+#define BS_DrvNum                      36\r
+#define BS_BootSig                     38\r
+#define BS_VolID                       39\r
+#define BS_VolLab                      43\r
+#define BS_FilSysType          54\r
+\r
+#define BPB_FATSz32                    36\r
+#define BPB_ExtFlags           40\r
+#define BPB_FSVer                      42\r
+#define BPB_RootClus           44\r
+#define BPB_FSInfo                     48\r
+#define BPB_BkBootSec          50\r
+#define BS_DrvNum32                    64\r
+#define BS_BootSig32           66\r
+#define BS_VolID32                     67\r
+#define BS_VolLab32                    71\r
+#define BS_FilSysType32                82\r
+\r
+#define        FSI_LeadSig                     0\r
+#define        FSI_StrucSig            484\r
+#define        FSI_Free_Count          488\r
+#define        FSI_Nxt_Free            492\r
+\r
+#define MBR_Table                      446\r
+\r
+#define        DIR_Name                        0\r
+#define        DIR_Attr                        11\r
+#define        DIR_NTres                       12\r
+#define        DIR_CrtTime                     14\r
+#define        DIR_CrtDate                     16\r
+#define        DIR_FstClusHI           20\r
+#define        DIR_WrtTime                     22\r
+#define        DIR_WrtDate                     24\r
+#define        DIR_FstClusLO           26\r
+#define        DIR_FileSize            28\r
+#define        LDIR_Ord                        0\r
+#define        LDIR_Attr                       11\r
+#define        LDIR_Type                       12\r
+#define        LDIR_Chksum                     13\r
+#define        LDIR_FstClusLO          26\r
+\r
+\r
+\r
+/*--------------------------------*/\r
+/* Multi-byte word access macros  */\r
+\r
+#if _WORD_ACCESS == 1  /* Enable word access to the FAT structure */\r
+#define        LD_WORD(ptr)            (WORD)(*(WORD*)(BYTE*)(ptr))\r
+#define        LD_DWORD(ptr)           (DWORD)(*(DWORD*)(BYTE*)(ptr))\r
+#define        ST_WORD(ptr,val)        *(WORD*)(BYTE*)(ptr)=(WORD)(val)\r
+#define        ST_DWORD(ptr,val)       *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)\r
+#else                                  /* Use byte-by-byte access to the FAT structure */\r
+#define        LD_WORD(ptr)            (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))\r
+#define        LD_DWORD(ptr)           (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))\r
+#define        ST_WORD(ptr,val)        *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)\r
+#define        ST_DWORD(ptr,val)       *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8); *(BYTE*)((ptr)+2)=(BYTE)((DWORD)(val)>>16); *(BYTE*)((ptr)+3)=(BYTE)((DWORD)(val)>>24)\r
+#endif\r
+\r
+\r
+#endif /* _FATFS */\r
diff --git a/Projects/Webserver/Lib/FATFs/ff.lst b/Projects/Webserver/Lib/FATFs/ff.lst
new file mode 100644 (file)
index 0000000..2a8f9fc
--- /dev/null
@@ -0,0 +1,3062 @@
+   1                           .file   "ff.c"\r
+   2                   __SREG__ = 0x3f\r
+   3                   __SP_H__ = 0x3e\r
+   4                   __SP_L__ = 0x3d\r
+   5                   __CCP__  = 0x34\r
+   6                   __tmp_reg__ = 0\r
+   7                   __zero_reg__ = 1\r
+  15                   .Ltext0:\r
+  16                           .section        .text.clust2sect,"ax",@progbits\r
+  17                   .global clust2sect\r
+  19                   clust2sect:\r
+  20                   .LFB60:\r
+  21                   .LSM0:\r
+  22                   .LVL0:\r
+  23 0000 EF92                 push r14\r
+  24 0002 FF92                 push r15\r
+  25 0004 0F93                 push r16\r
+  26 0006 1F93                 push r17\r
+  27 0008 CF93                 push r28\r
+  28 000a DF93                 push r29\r
+  29                   /* prologue: function */\r
+  30                   /* frame size = 0 */\r
+  31 000c EC01                 movw r28,r24\r
+  32 000e 7A01                 movw r14,r20\r
+  33 0010 8B01                 movw r16,r22\r
+  34                   .LSM1:\r
+  35 0012 8EEF                 ldi r24,lo8(-2)\r
+  36 0014 9FEF                 ldi r25,hi8(-2)\r
+  37 0016 AFEF                 ldi r26,hlo8(-2)\r
+  38 0018 BFEF                 ldi r27,hhi8(-2)\r
+  39                   .LVL1:\r
+  40 001a E80E                 add r14,r24\r
+  41 001c F91E                 adc r15,r25\r
+  42 001e 0A1F                 adc r16,r26\r
+  43 0020 1B1F                 adc r17,r27\r
+  44                   .LVL2:\r
+  45                   .LSM2:\r
+  46 0022 8E85                 ldd r24,Y+14\r
+  47 0024 9F85                 ldd r25,Y+15\r
+  48 0026 A889                 ldd r26,Y+16\r
+  49 0028 B989                 ldd r27,Y+17\r
+  50 002a 0297                 sbiw r24,2\r
+  51 002c A109                 sbc r26,__zero_reg__\r
+  52 002e B109                 sbc r27,__zero_reg__\r
+  53 0030 E816                 cp r14,r24\r
+  54 0032 F906                 cpc r15,r25\r
+  55 0034 0A07                 cpc r16,r26\r
+  56 0036 1B07                 cpc r17,r27\r
+  57 0038 00F0                 brlo .L2\r
+  58 003a 20E0                 ldi r18,lo8(0)\r
+  59 003c 30E0                 ldi r19,hi8(0)\r
+  60 003e 40E0                 ldi r20,hlo8(0)\r
+  61 0040 50E0                 ldi r21,hhi8(0)\r
+  62 0042 00C0                 rjmp .L3\r
+  63                   .L2:\r
+  64                   .LSM3:\r
+  65 0044 2A81                 ldd r18,Y+2\r
+  66 0046 30E0                 ldi r19,lo8(0)\r
+  67 0048 40E0                 ldi r20,lo8(0)\r
+  68 004a 50E0                 ldi r21,hi8(0)\r
+  69 004c C801                 movw r24,r16\r
+  70 004e B701                 movw r22,r14\r
+  71 0050 0E94 0000            call __mulsi3\r
+  72 0054 9B01                 movw r18,r22\r
+  73 0056 AC01                 movw r20,r24\r
+  74 0058 8A8D                 ldd r24,Y+26\r
+  75 005a 9B8D                 ldd r25,Y+27\r
+  76 005c AC8D                 ldd r26,Y+28\r
+  77 005e BD8D                 ldd r27,Y+29\r
+  78 0060 280F                 add r18,r24\r
+  79 0062 391F                 adc r19,r25\r
+  80 0064 4A1F                 adc r20,r26\r
+  81 0066 5B1F                 adc r21,r27\r
+  82                   .L3:\r
+  83                   .LSM4:\r
+  84 0068 B901                 movw r22,r18\r
+  85 006a CA01                 movw r24,r20\r
+  86                   /* epilogue start */\r
+  87 006c DF91                 pop r29\r
+  88 006e CF91                 pop r28\r
+  89                   .LVL3:\r
+  90 0070 1F91                 pop r17\r
+  91 0072 0F91                 pop r16\r
+  92 0074 FF90                 pop r15\r
+  93 0076 EF90                 pop r14\r
+  94                   .LVL4:\r
+  95 0078 0895                 ret\r
+  96                   .LFE60:\r
+  98                           .section        .text.f_mount,"ax",@progbits\r
+  99                   .global f_mount\r
+ 101                   f_mount:\r
+ 102                   .LFB69:\r
+ 103                   .LSM5:\r
+ 104                   .LVL5:\r
+ 105                   /* prologue: function */\r
+ 106                   /* frame size = 0 */\r
+ 107 0000 DB01                 movw r26,r22\r
+ 108                   .LSM6:\r
+ 109 0002 8823                 tst r24\r
+ 110 0004 01F0                 breq .L6\r
+ 111                   .LVL6:\r
+ 112 0006 8BE0                 ldi r24,lo8(11)\r
+ 113                   .LVL7:\r
+ 114 0008 0895                 ret\r
+ 115                   .LVL8:\r
+ 116                   .L6:\r
+ 117                   .LSM7:\r
+ 118 000a E091 0000            lds r30,FatFs\r
+ 119 000e F091 0000            lds r31,(FatFs)+1\r
+ 120                   .LVL9:\r
+ 121                   .LSM8:\r
+ 122 0012 3097                 sbiw r30,0\r
+ 123 0014 01F0                 breq .L8\r
+ 124                   .LSM9:\r
+ 125 0016 1082                 st Z,__zero_reg__\r
+ 126                   .L8:\r
+ 127                   .LSM10:\r
+ 128 0018 1097                 sbiw r26,0\r
+ 129 001a 01F0                 breq .L9\r
+ 130                   .LSM11:\r
+ 131 001c 1C92                 st X,__zero_reg__\r
+ 132                   .L9:\r
+ 133                   .LSM12:\r
+ 134 001e B093 0000            sts (FatFs)+1,r27\r
+ 135 0022 A093 0000            sts FatFs,r26\r
+ 136 0026 80E0                 ldi r24,lo8(0)\r
+ 137                   .LVL10:\r
+ 138                   .LSM13:\r
+ 139 0028 0895                 ret\r
+ 140                   .LFE69:\r
+ 142                           .section        .text.validate,"ax",@progbits\r
+ 144                   validate:\r
+ 145                   .LFB68:\r
+ 146                   .LSM14:\r
+ 147                   .LVL11:\r
+ 148                   /* prologue: function */\r
+ 149                   /* frame size = 0 */\r
+ 150 0000 FC01                 movw r30,r24\r
+ 151                   .LSM15:\r
+ 152 0002 0097                 sbiw r24,0\r
+ 153 0004 01F0                 breq .L12\r
+ 154 0006 8081                 ld r24,Z\r
+ 155                   .LVL12:\r
+ 156 0008 8823                 tst r24\r
+ 157 000a 01F0                 breq .L12\r
+ 158 000c 8681                 ldd r24,Z+6\r
+ 159 000e 9781                 ldd r25,Z+7\r
+ 160 0010 8617                 cp r24,r22\r
+ 161 0012 9707                 cpc r25,r23\r
+ 162 0014 01F4                 brne .L12\r
+ 163                   .LSM16:\r
+ 164 0016 8181                 ldd r24,Z+1\r
+ 165 0018 0E94 0000            call disk_status\r
+ 166                   .LVL13:\r
+ 167 001c 80FD                 sbrc r24,0\r
+ 168 001e 00C0                 rjmp .L13\r
+ 169 0020 80E0                 ldi r24,lo8(0)\r
+ 170 0022 0895                 ret\r
+ 171                   .L13:\r
+ 172 0024 83E0                 ldi r24,lo8(3)\r
+ 173 0026 0895                 ret\r
+ 174                   .LVL14:\r
+ 175                   .L12:\r
+ 176 0028 89E0                 ldi r24,lo8(9)\r
+ 177                   .LSM17:\r
+ 178 002a 0895                 ret\r
+ 179                   .LFE68:\r
+ 181                           .section        .text.f_close,"ax",@progbits\r
+ 182                   .global f_close\r
+ 184                   f_close:\r
+ 185                   .LFB72:\r
+ 186                   .LSM18:\r
+ 187                   .LVL15:\r
+ 188 0000 CF93                 push r28\r
+ 189 0002 DF93                 push r29\r
+ 190                   /* prologue: function */\r
+ 191                   /* frame size = 0 */\r
+ 192 0004 EC01                 movw r28,r24\r
+ 193                   .LSM19:\r
+ 194 0006 6A81                 ldd r22,Y+2\r
+ 195 0008 7B81                 ldd r23,Y+3\r
+ 196 000a 8881                 ld r24,Y\r
+ 197 000c 9981                 ldd r25,Y+1\r
+ 198                   .LVL16:\r
+ 199 000e 0E94 0000            call validate\r
+ 200                   .LSM20:\r
+ 201 0012 8823                 tst r24\r
+ 202                   .LVL17:\r
+ 203 0014 01F4                 brne .L17\r
+ 204 0016 1982                 std Y+1,__zero_reg__\r
+ 205 0018 1882                 st Y,__zero_reg__\r
+ 206                   .L17:\r
+ 207                   .LVL18:\r
+ 208                   /* epilogue start */\r
+ 209                   .LSM21:\r
+ 210 001a DF91                 pop r29\r
+ 211 001c CF91                 pop r28\r
+ 212                   .LVL19:\r
+ 213 001e 0895                 ret\r
+ 214                   .LFE72:\r
+ 216                           .section        .text.move_window,"ax",@progbits\r
+ 218                   move_window:\r
+ 219                   .LFB58:\r
+ 220                   .LSM22:\r
+ 221                   .LVL20:\r
+ 222 0000 CF92                 push r12\r
+ 223 0002 DF92                 push r13\r
+ 224 0004 EF92                 push r14\r
+ 225 0006 FF92                 push r15\r
+ 226 0008 0F93                 push r16\r
+ 227 000a CF93                 push r28\r
+ 228 000c DF93                 push r29\r
+ 229                   /* prologue: function */\r
+ 230                   /* frame size = 0 */\r
+ 231 000e EC01                 movw r28,r24\r
+ 232 0010 6A01                 movw r12,r20\r
+ 233 0012 7B01                 movw r14,r22\r
+ 234                   .LSM23:\r
+ 235 0014 8E8D                 ldd r24,Y+30\r
+ 236 0016 9F8D                 ldd r25,Y+31\r
+ 237 0018 A8A1                 ldd r26,Y+32\r
+ 238 001a B9A1                 ldd r27,Y+33\r
+ 239                   .LVL21:\r
+ 240 001c 8417                 cp r24,r20\r
+ 241 001e 9507                 cpc r25,r21\r
+ 242 0020 A607                 cpc r26,r22\r
+ 243 0022 B707                 cpc r27,r23\r
+ 244 0024 01F0                 breq .L20\r
+ 245                   .LSM24:\r
+ 246 0026 4115                 cp r20,__zero_reg__\r
+ 247 0028 5105                 cpc r21,__zero_reg__\r
+ 248 002a 6105                 cpc r22,__zero_reg__\r
+ 249 002c 7105                 cpc r23,__zero_reg__\r
+ 250 002e 01F0                 breq .L20\r
+ 251                   .LSM25:\r
+ 252 0030 BE01                 movw r22,r28\r
+ 253 0032 6E5D                 subi r22,lo8(-(34))\r
+ 254 0034 7F4F                 sbci r23,hi8(-(34))\r
+ 255 0036 8981                 ldd r24,Y+1\r
+ 256 0038 A701                 movw r20,r14\r
+ 257 003a 9601                 movw r18,r12\r
+ 258 003c 01E0                 ldi r16,lo8(1)\r
+ 259 003e 0E94 0000            call disk_read\r
+ 260                   .LVL22:\r
+ 261 0042 8823                 tst r24\r
+ 262 0044 01F0                 breq .L21\r
+ 263 0046 81E0                 ldi r24,lo8(1)\r
+ 264 0048 00C0                 rjmp .L22\r
+ 265                   .L21:\r
+ 266                   .LSM26:\r
+ 267 004a CE8E                 std Y+30,r12\r
+ 268 004c DF8E                 std Y+31,r13\r
+ 269 004e E8A2                 std Y+32,r14\r
+ 270 0050 F9A2                 std Y+33,r15\r
+ 271                   .LVL23:\r
+ 272                   .L20:\r
+ 273 0052 80E0                 ldi r24,lo8(0)\r
+ 274                   .L22:\r
+ 275                   /* epilogue start */\r
+ 276                   .LSM27:\r
+ 277 0054 DF91                 pop r29\r
+ 278 0056 CF91                 pop r28\r
+ 279                   .LVL24:\r
+ 280 0058 0F91                 pop r16\r
+ 281 005a FF90                 pop r15\r
+ 282 005c EF90                 pop r14\r
+ 283 005e DF90                 pop r13\r
+ 284 0060 CF90                 pop r12\r
+ 285                   .LVL25:\r
+ 286 0062 0895                 ret\r
+ 287                   .LFE58:\r
+ 289                           .section        .text.get_fat,"ax",@progbits\r
+ 290                   .global get_fat\r
+ 292                   get_fat:\r
+ 293                   .LFB59:\r
+ 294                   .LSM28:\r
+ 295                   .LVL26:\r
+ 296 0000 7F92                 push r7\r
+ 297 0002 8F92                 push r8\r
+ 298 0004 9F92                 push r9\r
+ 299 0006 AF92                 push r10\r
+ 300 0008 BF92                 push r11\r
+ 301 000a CF92                 push r12\r
+ 302 000c DF92                 push r13\r
+ 303 000e EF92                 push r14\r
+ 304 0010 FF92                 push r15\r
+ 305 0012 0F93                 push r16\r
+ 306 0014 1F93                 push r17\r
+ 307 0016 CF93                 push r28\r
+ 308 0018 DF93                 push r29\r
+ 309                   /* prologue: function */\r
+ 310                   /* frame size = 0 */\r
+ 311 001a 4C01                 movw r8,r24\r
+ 312 001c 7A01                 movw r14,r20\r
+ 313 001e 8B01                 movw r16,r22\r
+ 314                   .LSM29:\r
+ 315 0020 4230                 cpi r20,lo8(2)\r
+ 316 0022 5105                 cpc r21,__zero_reg__\r
+ 317 0024 6105                 cpc r22,__zero_reg__\r
+ 318 0026 7105                 cpc r23,__zero_reg__\r
+ 319                   .LVL27:\r
+ 320 0028 00F4                 brsh .+2\r
+ 321 002a 00C0                 rjmp .L25\r
+ 322 002c F401                 movw r30,r8\r
+ 323 002e 8685                 ldd r24,Z+14\r
+ 324 0030 9785                 ldd r25,Z+15\r
+ 325 0032 A089                 ldd r26,Z+16\r
+ 326 0034 B189                 ldd r27,Z+17\r
+ 327 0036 4817                 cp r20,r24\r
+ 328 0038 5907                 cpc r21,r25\r
+ 329 003a 6A07                 cpc r22,r26\r
+ 330 003c 7B07                 cpc r23,r27\r
+ 331 003e 00F0                 brlo .+2\r
+ 332 0040 00C0                 rjmp .L25\r
+ 333                   .LSM30:\r
+ 334 0042 A288                 ldd r10,Z+18\r
+ 335 0044 B388                 ldd r11,Z+19\r
+ 336 0046 C488                 ldd r12,Z+20\r
+ 337 0048 D588                 ldd r13,Z+21\r
+ 338                   .LVL28:\r
+ 339                   .LSM31:\r
+ 340 004a 8081                 ld r24,Z\r
+ 341 004c 8230                 cpi r24,lo8(2)\r
+ 342 004e 01F4                 brne .+2\r
+ 343 0050 00C0                 rjmp .L28\r
+ 344 0052 8330                 cpi r24,lo8(3)\r
+ 345 0054 01F4                 brne .+2\r
+ 346 0056 00C0                 rjmp .L29\r
+ 347 0058 8130                 cpi r24,lo8(1)\r
+ 348 005a 01F0                 breq .+2\r
+ 349 005c 00C0                 rjmp .L26\r
+ 350                   .LSM32:\r
+ 351 005e EA01                 movw r28,r20\r
+ 352                   .LVL29:\r
+ 353 0060 D695                 lsr r29\r
+ 354 0062 C795                 ror r28\r
+ 355                   .LVL30:\r
+ 356 0064 C40F                 add r28,r20\r
+ 357 0066 D51F                 adc r29,r21\r
+ 358                   .LSM33:\r
+ 359 0068 AE01                 movw r20,r28\r
+ 360                   .LVL31:\r
+ 361 006a 452F                 mov r20,r21\r
+ 362 006c 5527                 clr r21\r
+ 363 006e 4695                 lsr r20\r
+ 364 0070 60E0                 ldi r22,lo8(0)\r
+ 365 0072 70E0                 ldi r23,hi8(0)\r
+ 366 0074 4A0D                 add r20,r10\r
+ 367 0076 5B1D                 adc r21,r11\r
+ 368 0078 6C1D                 adc r22,r12\r
+ 369 007a 7D1D                 adc r23,r13\r
+ 370 007c C401                 movw r24,r8\r
+ 371 007e 0E94 0000            call move_window\r
+ 372 0082 8823                 tst r24\r
+ 373 0084 01F0                 breq .+2\r
+ 374 0086 00C0                 rjmp .L26\r
+ 375                   .LSM34:\r
+ 376 0088 FE01                 movw r30,r28\r
+ 377 008a F170                 andi r31,hi8(511)\r
+ 378 008c E80D                 add r30,r8\r
+ 379 008e F91D                 adc r31,r9\r
+ 380 0090 72A0                 ldd r7,Z+34\r
+ 381 0092 2196                 adiw r28,1\r
+ 382                   .LVL32:\r
+ 383                   .LSM35:\r
+ 384 0094 AE01                 movw r20,r28\r
+ 385 0096 452F                 mov r20,r21\r
+ 386 0098 5527                 clr r21\r
+ 387 009a 4695                 lsr r20\r
+ 388 009c 60E0                 ldi r22,lo8(0)\r
+ 389 009e 70E0                 ldi r23,hi8(0)\r
+ 390 00a0 4A0D                 add r20,r10\r
+ 391 00a2 5B1D                 adc r21,r11\r
+ 392 00a4 6C1D                 adc r22,r12\r
+ 393 00a6 7D1D                 adc r23,r13\r
+ 394 00a8 C401                 movw r24,r8\r
+ 395 00aa 0E94 0000            call move_window\r
+ 396 00ae 8823                 tst r24\r
+ 397 00b0 01F0                 breq .+2\r
+ 398 00b2 00C0                 rjmp .L26\r
+ 399                   .LSM36:\r
+ 400 00b4 672D                 mov r22,r7\r
+ 401                   .LVL33:\r
+ 402 00b6 70E0                 ldi r23,lo8(0)\r
+ 403                   .LVL34:\r
+ 404                   .LSM37:\r
+ 405 00b8 D170                 andi r29,hi8(511)\r
+ 406 00ba C80D                 add r28,r8\r
+ 407 00bc D91D                 adc r29,r9\r
+ 408 00be 9AA1                 ldd r25,Y+34\r
+ 409 00c0 80E0                 ldi r24,lo8(0)\r
+ 410 00c2 682B                 or r22,r24\r
+ 411 00c4 792B                 or r23,r25\r
+ 412                   .LVL35:\r
+ 413                   .LSM38:\r
+ 414 00c6 C701                 movw r24,r14\r
+ 415                   .LVL36:\r
+ 416 00c8 8170                 andi r24,lo8(1)\r
+ 417 00ca 9070                 andi r25,hi8(1)\r
+ 418 00cc 892B                 or r24,r25\r
+ 419 00ce 01F0                 breq .L30\r
+ 420 00d0 44E0                 ldi r20,4\r
+ 421 00d2 7695         1:      lsr r23\r
+ 422 00d4 6795                 ror r22\r
+ 423 00d6 4A95                 dec r20\r
+ 424 00d8 01F4                 brne 1b\r
+ 425 00da 9B01                 movw r18,r22\r
+ 426 00dc 00C0                 rjmp .L33\r
+ 427                   .L30:\r
+ 428 00de 9B01                 movw r18,r22\r
+ 429 00e0 40E0                 ldi r20,lo8(0)\r
+ 430 00e2 50E0                 ldi r21,hi8(0)\r
+ 431 00e4 3F70                 andi r19,hi8(4095)\r
+ 432 00e6 4070                 andi r20,hlo8(4095)\r
+ 433 00e8 5070                 andi r21,hhi8(4095)\r
+ 434 00ea 00C0                 rjmp .L31\r
+ 435                   .LVL37:\r
+ 436                   .L28:\r
+ 437                   .LSM39:\r
+ 438 00ec 452F                 mov r20,r21\r
+ 439 00ee 562F                 mov r21,r22\r
+ 440 00f0 672F                 mov r22,r23\r
+ 441 00f2 7727                 clr r23\r
+ 442                   .LVL38:\r
+ 443 00f4 4A0D                 add r20,r10\r
+ 444 00f6 5B1D                 adc r21,r11\r
+ 445 00f8 6C1D                 adc r22,r12\r
+ 446 00fa 7D1D                 adc r23,r13\r
+ 447 00fc C401                 movw r24,r8\r
+ 448 00fe 0E94 0000            call move_window\r
+ 449 0102 8823                 tst r24\r
+ 450 0104 01F4                 brne .L26\r
+ 451                   .LSM40:\r
+ 452 0106 F701                 movw r30,r14\r
+ 453                   .LVL39:\r
+ 454 0108 EE0F                 lsl r30\r
+ 455 010a FF1F                 rol r31\r
+ 456 010c F170                 andi r31,hi8(511)\r
+ 457 010e E80D                 add r30,r8\r
+ 458 0110 F91D                 adc r31,r9\r
+ 459 0112 82A1                 ldd r24,Z+34\r
+ 460 0114 93A1                 ldd r25,Z+35\r
+ 461 0116 9C01                 movw r18,r24\r
+ 462                   .LVL40:\r
+ 463                   .L33:\r
+ 464 0118 40E0                 ldi r20,lo8(0)\r
+ 465 011a 50E0                 ldi r21,hi8(0)\r
+ 466 011c 00C0                 rjmp .L31\r
+ 467                   .LVL41:\r
+ 468                   .L29:\r
+ 469                   .LSM41:\r
+ 470 011e 97E0                 ldi r25,7\r
+ 471 0120 7695         1:      lsr r23\r
+ 472 0122 6795                 ror r22\r
+ 473 0124 5795                 ror r21\r
+ 474 0126 4795                 ror r20\r
+ 475 0128 9A95                 dec r25\r
+ 476 012a 01F4                 brne 1b\r
+ 477                   .LVL42:\r
+ 478 012c 4A0D                 add r20,r10\r
+ 479 012e 5B1D                 adc r21,r11\r
+ 480 0130 6C1D                 adc r22,r12\r
+ 481 0132 7D1D                 adc r23,r13\r
+ 482 0134 C401                 movw r24,r8\r
+ 483 0136 0E94 0000            call move_window\r
+ 484 013a 8823                 tst r24\r
+ 485 013c 01F4                 brne .L26\r
+ 486                   .LSM42:\r
+ 487 013e F701                 movw r30,r14\r
+ 488                   .LVL43:\r
+ 489 0140 EE0F                 lsl r30\r
+ 490 0142 FF1F                 rol r31\r
+ 491 0144 EE0F                 lsl r30\r
+ 492 0146 FF1F                 rol r31\r
+ 493 0148 F170                 andi r31,hi8(511)\r
+ 494 014a E80D                 add r30,r8\r
+ 495 014c F91D                 adc r31,r9\r
+ 496 014e 22A1                 ldd r18,Z+34\r
+ 497 0150 33A1                 ldd r19,Z+35\r
+ 498 0152 44A1                 ldd r20,Z+36\r
+ 499 0154 55A1                 ldd r21,Z+37\r
+ 500 0156 5F70                 andi r21,hhi8(268435455)\r
+ 501 0158 00C0                 rjmp .L31\r
+ 502                   .LVL44:\r
+ 503                   .L25:\r
+ 504 015a 21E0                 ldi r18,lo8(1)\r
+ 505 015c 30E0                 ldi r19,hi8(1)\r
+ 506 015e 40E0                 ldi r20,hlo8(1)\r
+ 507 0160 50E0                 ldi r21,hhi8(1)\r
+ 508 0162 00C0                 rjmp .L31\r
+ 509                   .LVL45:\r
+ 510                   .L26:\r
+ 511 0164 2FEF                 ldi r18,lo8(-1)\r
+ 512 0166 3FEF                 ldi r19,hi8(-1)\r
+ 513 0168 4FEF                 ldi r20,hlo8(-1)\r
+ 514 016a 5FEF                 ldi r21,hhi8(-1)\r
+ 515                   .LVL46:\r
+ 516                   .L31:\r
+ 517                   .LSM43:\r
+ 518 016c B901                 movw r22,r18\r
+ 519                   .LVL47:\r
+ 520 016e CA01                 movw r24,r20\r
+ 521                   /* epilogue start */\r
+ 522 0170 DF91                 pop r29\r
+ 523 0172 CF91                 pop r28\r
+ 524                   .LVL48:\r
+ 525 0174 1F91                 pop r17\r
+ 526 0176 0F91                 pop r16\r
+ 527 0178 FF90                 pop r15\r
+ 528 017a EF90                 pop r14\r
+ 529                   .LVL49:\r
+ 530 017c DF90                 pop r13\r
+ 531 017e CF90                 pop r12\r
+ 532 0180 BF90                 pop r11\r
+ 533 0182 AF90                 pop r10\r
+ 534                   .LVL50:\r
+ 535 0184 9F90                 pop r9\r
+ 536 0186 8F90                 pop r8\r
+ 537                   .LVL51:\r
+ 538 0188 7F90                 pop r7\r
+ 539 018a 0895                 ret\r
+ 540                   .LFE59:\r
+ 542                           .section        .text.f_lseek,"ax",@progbits\r
+ 543                   .global f_lseek\r
+ 545                   f_lseek:\r
+ 546                   .LFB73:\r
+ 547                   .LSM44:\r
+ 548                   .LVL52:\r
+ 549 0000 2F92                 push r2\r
+ 550 0002 3F92                 push r3\r
+ 551 0004 4F92                 push r4\r
+ 552 0006 5F92                 push r5\r
+ 553 0008 6F92                 push r6\r
+ 554 000a 7F92                 push r7\r
+ 555 000c 8F92                 push r8\r
+ 556 000e 9F92                 push r9\r
+ 557 0010 AF92                 push r10\r
+ 558 0012 BF92                 push r11\r
+ 559 0014 CF92                 push r12\r
+ 560 0016 DF92                 push r13\r
+ 561 0018 EF92                 push r14\r
+ 562 001a FF92                 push r15\r
+ 563 001c 0F93                 push r16\r
+ 564 001e 1F93                 push r17\r
+ 565 0020 DF93                 push r29\r
+ 566 0022 CF93                 push r28\r
+ 567 0024 00D0                 rcall .\r
+ 568 0026 0F92                 push __tmp_reg__\r
+ 569 0028 CDB7                 in r28,__SP_L__\r
+ 570 002a DEB7                 in r29,__SP_H__\r
+ 571                   /* prologue: function */\r
+ 572                   /* frame size = 3 */\r
+ 573 002c 9B83                 std Y+3,r25\r
+ 574 002e 8A83                 std Y+2,r24\r
+ 575 0030 E42E                 mov r14,r20\r
+ 576 0032 D52E                 mov r13,r21\r
+ 577                   .LVL53:\r
+ 578 0034 C62E                 mov r12,r22\r
+ 579                   .LVL54:\r
+ 580 0036 B72E                 mov r11,r23\r
+ 581                   .LVL55:\r
+ 582                   .LSM45:\r
+ 583 0038 DC01                 movw r26,r24\r
+ 584 003a 1296                 adiw r26,2\r
+ 585 003c 6D91                 ld r22,X+\r
+ 586 003e 7C91                 ld r23,X\r
+ 587 0040 1397                 sbiw r26,2+1\r
+ 588                   .LVL56:\r
+ 589 0042 8D91                 ld r24,X+\r
+ 590 0044 9C91                 ld r25,X\r
+ 591                   .LVL57:\r
+ 592 0046 0E94 0000            call validate\r
+ 593                   .LVL58:\r
+ 594 004a 8983                 std Y+1,r24\r
+ 595                   .LVL59:\r
+ 596                   .LSM46:\r
+ 597 004c 8823                 tst r24\r
+ 598 004e 01F0                 breq .+2\r
+ 599 0050 00C0                 rjmp .L35\r
+ 600                   .LSM47:\r
+ 601 0052 EA81                 ldd r30,Y+2\r
+ 602 0054 FB81                 ldd r31,Y+3\r
+ 603 0056 8481                 ldd r24,Z+4\r
+ 604 0058 87FD                 sbrc r24,7\r
+ 605 005a 00C0                 rjmp .L51\r
+ 606                   .L36:\r
+ 607 005c AA81                 ldd r26,Y+2\r
+ 608 005e BB81                 ldd r27,Y+3\r
+ 609 0060 1A96                 adiw r26,10\r
+ 610 0062 6D90                 ld r6,X+\r
+ 611 0064 7D90                 ld r7,X+\r
+ 612 0066 8D90                 ld r8,X+\r
+ 613 0068 9C90                 ld r9,X\r
+ 614 006a 1D97                 sbiw r26,10+3\r
+ 615 006c 2E2D                 mov r18,r14\r
+ 616 006e 3D2D                 mov r19,r13\r
+ 617 0070 4C2D                 mov r20,r12\r
+ 618 0072 5B2D                 mov r21,r11\r
+ 619 0074 C901                 movw r24,r18\r
+ 620 0076 DA01                 movw r26,r20\r
+ 621 0078 5C01                 movw r10,r24\r
+ 622 007a 6D01                 movw r12,r26\r
+ 623 007c 6A14                 cp r6,r10\r
+ 624 007e 7B04                 cpc r7,r11\r
+ 625 0080 8C04                 cpc r8,r12\r
+ 626 0082 9D04                 cpc r9,r13\r
+ 627 0084 00F4                 brsh .L37\r
+ 628                   .LVL60:\r
+ 629 0086 6401                 movw r12,r8\r
+ 630 0088 5301                 movw r10,r6\r
+ 631                   .LVL61:\r
+ 632                   .L37:\r
+ 633                   .LSM48:\r
+ 634 008a EA81                 ldd r30,Y+2\r
+ 635 008c FB81                 ldd r31,Y+3\r
+ 636 008e 2681                 ldd r18,Z+6\r
+ 637 0090 3781                 ldd r19,Z+7\r
+ 638 0092 4085                 ldd r20,Z+8\r
+ 639 0094 5185                 ldd r21,Z+9\r
+ 640                   .LVL62:\r
+ 641                   .LSM49:\r
+ 642 0096 1682                 std Z+6,__zero_reg__\r
+ 643 0098 1782                 std Z+7,__zero_reg__\r
+ 644 009a 1086                 std Z+8,__zero_reg__\r
+ 645 009c 1186                 std Z+9,__zero_reg__\r
+ 646 009e 8FEF                 ldi r24,lo8(-1)\r
+ 647 00a0 8583                 std Z+5,r24\r
+ 648                   .LSM50:\r
+ 649 00a2 A114                 cp r10,__zero_reg__\r
+ 650 00a4 B104                 cpc r11,__zero_reg__\r
+ 651 00a6 C104                 cpc r12,__zero_reg__\r
+ 652 00a8 D104                 cpc r13,__zero_reg__\r
+ 653 00aa 01F4                 brne .+2\r
+ 654 00ac 00C0                 rjmp .L38\r
+ 655                   .LSM51:\r
+ 656 00ae 0190                 ld __tmp_reg__,Z+\r
+ 657 00b0 F081                 ld r31,Z\r
+ 658 00b2 E02D                 mov r30,__tmp_reg__\r
+ 659 00b4 8281                 ldd r24,Z+2\r
+ 660 00b6 682E                 mov r6,r24\r
+ 661                   .LVL63:\r
+ 662 00b8 7724                 clr r7\r
+ 663                   .LVL64:\r
+ 664 00ba 8824                 clr r8\r
+ 665 00bc 9924                 clr r9\r
+ 666                   .LVL65:\r
+ 667 00be 09E0                 ldi r16,9\r
+ 668 00c0 660C         1:      lsl r6\r
+ 669 00c2 771C                 rol r7\r
+ 670 00c4 881C                 rol r8\r
+ 671 00c6 991C                 rol r9\r
+ 672 00c8 0A95                 dec r16\r
+ 673 00ca 01F4                 brne 1b\r
+ 674                   .LVL66:\r
+ 675                   .LSM52:\r
+ 676 00cc 2115                 cp r18,__zero_reg__\r
+ 677 00ce 3105                 cpc r19,__zero_reg__\r
+ 678 00d0 4105                 cpc r20,__zero_reg__\r
+ 679 00d2 5105                 cpc r21,__zero_reg__\r
+ 680 00d4 01F0                 breq .L39\r
+ 681 00d6 1901                 movw r2,r18\r
+ 682 00d8 2A01                 movw r4,r20\r
+ 683 00da 0894                 sec\r
+ 684 00dc 2108                 sbc r2,__zero_reg__\r
+ 685 00de 3108                 sbc r3,__zero_reg__\r
+ 686 00e0 4108                 sbc r4,__zero_reg__\r
+ 687 00e2 5108                 sbc r5,__zero_reg__\r
+ 688 00e4 C601                 movw r24,r12\r
+ 689 00e6 B501                 movw r22,r10\r
+ 690 00e8 6150                 subi r22,lo8(-(-1))\r
+ 691 00ea 7040                 sbci r23,hi8(-(-1))\r
+ 692 00ec 8040                 sbci r24,hlo8(-(-1))\r
+ 693 00ee 9040                 sbci r25,hhi8(-(-1))\r
+ 694 00f0 A401                 movw r20,r8\r
+ 695 00f2 9301                 movw r18,r6\r
+ 696                   .LVL67:\r
+ 697 00f4 0E94 0000            call __udivmodsi4\r
+ 698 00f8 7901                 movw r14,r18\r
+ 699 00fa 8A01                 movw r16,r20\r
+ 700 00fc C201                 movw r24,r4\r
+ 701 00fe B101                 movw r22,r2\r
+ 702 0100 A401                 movw r20,r8\r
+ 703 0102 9301                 movw r18,r6\r
+ 704 0104 0E94 0000            call __udivmodsi4\r
+ 705 0108 E216                 cp r14,r18\r
+ 706 010a F306                 cpc r15,r19\r
+ 707 010c 0407                 cpc r16,r20\r
+ 708 010e 1507                 cpc r17,r21\r
+ 709 0110 00F0                 brlo .L39\r
+ 710                   .LSM53:\r
+ 711 0112 8827                 clr r24\r
+ 712 0114 9927                 clr r25\r
+ 713 0116 DC01                 movw r26,r24\r
+ 714 0118 8619                 sub r24,r6\r
+ 715 011a 9709                 sbc r25,r7\r
+ 716 011c A809                 sbc r26,r8\r
+ 717 011e B909                 sbc r27,r9\r
+ 718 0120 8221                 and r24,r2\r
+ 719 0122 9321                 and r25,r3\r
+ 720 0124 A421                 and r26,r4\r
+ 721 0126 B521                 and r27,r5\r
+ 722 0128 EA81                 ldd r30,Y+2\r
+ 723 012a FB81                 ldd r31,Y+3\r
+ 724 012c 8683                 std Z+6,r24\r
+ 725 012e 9783                 std Z+7,r25\r
+ 726 0130 A087                 std Z+8,r26\r
+ 727 0132 B187                 std Z+9,r27\r
+ 728                   .LSM54:\r
+ 729 0134 A81A                 sub r10,r24\r
+ 730 0136 B90A                 sbc r11,r25\r
+ 731 0138 CA0A                 sbc r12,r26\r
+ 732 013a DB0A                 sbc r13,r27\r
+ 733                   .LSM55:\r
+ 734 013c 4289                 ldd r20,Z+18\r
+ 735 013e 5389                 ldd r21,Z+19\r
+ 736 0140 6489                 ldd r22,Z+20\r
+ 737 0142 7589                 ldd r23,Z+21\r
+ 738                   .LVL68:\r
+ 739 0144 00C0                 rjmp .L40\r
+ 740                   .LVL69:\r
+ 741                   .L39:\r
+ 742                   .LSM56:\r
+ 743 0146 AA81                 ldd r26,Y+2\r
+ 744 0148 BB81                 ldd r27,Y+3\r
+ 745 014a 1E96                 adiw r26,14\r
+ 746 014c 4D91                 ld r20,X+\r
+ 747 014e 5D91                 ld r21,X+\r
+ 748 0150 6D91                 ld r22,X+\r
+ 749 0152 7C91                 ld r23,X\r
+ 750 0154 5197                 sbiw r26,14+3\r
+ 751                   .LVL70:\r
+ 752                   .LSM57:\r
+ 753 0156 FD01                 movw r30,r26\r
+ 754 0158 428B                 std Z+18,r20\r
+ 755 015a 538B                 std Z+19,r21\r
+ 756 015c 648B                 std Z+20,r22\r
+ 757 015e 758B                 std Z+21,r23\r
+ 758                   .L40:\r
+ 759                   .LSM58:\r
+ 760 0160 4115                 cp r20,__zero_reg__\r
+ 761 0162 5105                 cpc r21,__zero_reg__\r
+ 762 0164 6105                 cpc r22,__zero_reg__\r
+ 763 0166 7105                 cpc r23,__zero_reg__\r
+ 764 0168 01F0                 breq .+2\r
+ 765 016a 00C0                 rjmp .L49\r
+ 766 016c 00C0                 rjmp .L38\r
+ 767                   .L45:\r
+ 768                   .LSM59:\r
+ 769 016e AA81                 ldd r26,Y+2\r
+ 770 0170 BB81                 ldd r27,Y+3\r
+ 771 0172 8D91                 ld r24,X+\r
+ 772 0174 9C91                 ld r25,X\r
+ 773 0176 0E94 0000            call get_fat\r
+ 774                   .LVL71:\r
+ 775 017a AB01                 movw r20,r22\r
+ 776 017c BC01                 movw r22,r24\r
+ 777                   .LVL72:\r
+ 778                   .LSM60:\r
+ 779 017e 4F3F                 cpi r20,lo8(-1)\r
+ 780 0180 BFEF                 ldi r27,hi8(-1)\r
+ 781 0182 5B07                 cpc r21,r27\r
+ 782 0184 BFEF                 ldi r27,hlo8(-1)\r
+ 783 0186 6B07                 cpc r22,r27\r
+ 784 0188 BFEF                 ldi r27,hhi8(-1)\r
+ 785 018a 7B07                 cpc r23,r27\r
+ 786 018c 01F4                 brne .L42\r
+ 787 018e EA81                 ldd r30,Y+2\r
+ 788 0190 FB81                 ldd r31,Y+3\r
+ 789 0192 8481                 ldd r24,Z+4\r
+ 790 0194 8068                 ori r24,lo8(-128)\r
+ 791 0196 8483                 std Z+4,r24\r
+ 792 0198 F1E0                 ldi r31,lo8(1)\r
+ 793                   .L50:\r
+ 794 019a F983                 std Y+1,r31\r
+ 795                   .LVL73:\r
+ 796 019c 00C0                 rjmp .L35\r
+ 797                   .L42:\r
+ 798                   .LSM61:\r
+ 799 019e 4230                 cpi r20,lo8(2)\r
+ 800 01a0 5105                 cpc r21,__zero_reg__\r
+ 801 01a2 6105                 cpc r22,__zero_reg__\r
+ 802 01a4 7105                 cpc r23,__zero_reg__\r
+ 803 01a6 00F0                 brlo .L43\r
+ 804 01a8 AA81                 ldd r26,Y+2\r
+ 805 01aa BB81                 ldd r27,Y+3\r
+ 806 01ac ED91                 ld r30,X+\r
+ 807 01ae FC91                 ld r31,X\r
+ 808 01b0 8685                 ldd r24,Z+14\r
+ 809 01b2 9785                 ldd r25,Z+15\r
+ 810 01b4 A089                 ldd r26,Z+16\r
+ 811 01b6 B189                 ldd r27,Z+17\r
+ 812 01b8 4817                 cp r20,r24\r
+ 813 01ba 5907                 cpc r21,r25\r
+ 814 01bc 6A07                 cpc r22,r26\r
+ 815 01be 7B07                 cpc r23,r27\r
+ 816 01c0 00F0                 brlo .L44\r
+ 817                   .L43:\r
+ 818 01c2 EA81                 ldd r30,Y+2\r
+ 819 01c4 FB81                 ldd r31,Y+3\r
+ 820 01c6 8481                 ldd r24,Z+4\r
+ 821 01c8 8068                 ori r24,lo8(-128)\r
+ 822 01ca 8483                 std Z+4,r24\r
+ 823                   .LVL74:\r
+ 824                   .L51:\r
+ 825 01cc F2E0                 ldi r31,lo8(2)\r
+ 826 01ce 00C0                 rjmp .L50\r
+ 827                   .LVL75:\r
+ 828                   .L44:\r
+ 829                   .LSM62:\r
+ 830 01d0 AA81                 ldd r26,Y+2\r
+ 831 01d2 BB81                 ldd r27,Y+3\r
+ 832 01d4 5296                 adiw r26,18\r
+ 833 01d6 4D93                 st X+,r20\r
+ 834 01d8 5D93                 st X+,r21\r
+ 835 01da 6D93                 st X+,r22\r
+ 836 01dc 7C93                 st X,r23\r
+ 837 01de 5597                 sbiw r26,18+3\r
+ 838                   .LSM63:\r
+ 839 01e0 FD01                 movw r30,r26\r
+ 840 01e2 8681                 ldd r24,Z+6\r
+ 841 01e4 9781                 ldd r25,Z+7\r
+ 842 01e6 A085                 ldd r26,Z+8\r
+ 843 01e8 B185                 ldd r27,Z+9\r
+ 844 01ea 860D                 add r24,r6\r
+ 845 01ec 971D                 adc r25,r7\r
+ 846 01ee A81D                 adc r26,r8\r
+ 847 01f0 B91D                 adc r27,r9\r
+ 848 01f2 8683                 std Z+6,r24\r
+ 849 01f4 9783                 std Z+7,r25\r
+ 850 01f6 A087                 std Z+8,r26\r
+ 851 01f8 B187                 std Z+9,r27\r
+ 852                   .LSM64:\r
+ 853 01fa A618                 sub r10,r6\r
+ 854 01fc B708                 sbc r11,r7\r
+ 855 01fe C808                 sbc r12,r8\r
+ 856 0200 D908                 sbc r13,r9\r
+ 857                   .LVL76:\r
+ 858                   .L49:\r
+ 859                   .LSM65:\r
+ 860 0202 6A14                 cp r6,r10\r
+ 861 0204 7B04                 cpc r7,r11\r
+ 862 0206 8C04                 cpc r8,r12\r
+ 863 0208 9D04                 cpc r9,r13\r
+ 864 020a 00F4                 brsh .+2\r
+ 865 020c 00C0                 rjmp .L45\r
+ 866                   .LVL77:\r
+ 867                   .LSM66:\r
+ 868 020e EA81                 ldd r30,Y+2\r
+ 869 0210 FB81                 ldd r31,Y+3\r
+ 870 0212 8681                 ldd r24,Z+6\r
+ 871 0214 9781                 ldd r25,Z+7\r
+ 872 0216 A085                 ldd r26,Z+8\r
+ 873 0218 B185                 ldd r27,Z+9\r
+ 874 021a 8A0D                 add r24,r10\r
+ 875 021c 9B1D                 adc r25,r11\r
+ 876 021e AC1D                 adc r26,r12\r
+ 877 0220 BD1D                 adc r27,r13\r
+ 878 0222 8683                 std Z+6,r24\r
+ 879 0224 9783                 std Z+7,r25\r
+ 880 0226 A087                 std Z+8,r26\r
+ 881 0228 B187                 std Z+9,r27\r
+ 882                   .LSM67:\r
+ 883 022a D601                 movw r26,r12\r
+ 884 022c C501                 movw r24,r10\r
+ 885 022e 19E0                 ldi r17,9\r
+ 886 0230 B695         1:      lsr r27\r
+ 887 0232 A795                 ror r26\r
+ 888 0234 9795                 ror r25\r
+ 889 0236 8795                 ror r24\r
+ 890 0238 1A95                 dec r17\r
+ 891 023a 01F4                 brne 1b\r
+ 892 023c E82E                 mov r14,r24\r
+ 893 023e 8583                 std Z+5,r24\r
+ 894                   .LSM68:\r
+ 895 0240 8FEF                 ldi r24,lo8(511)\r
+ 896 0242 91E0                 ldi r25,hi8(511)\r
+ 897 0244 A0E0                 ldi r26,hlo8(511)\r
+ 898 0246 B0E0                 ldi r27,hhi8(511)\r
+ 899 0248 A822                 and r10,r24\r
+ 900 024a B922                 and r11,r25\r
+ 901 024c CA22                 and r12,r26\r
+ 902 024e DB22                 and r13,r27\r
+ 903 0250 A114                 cp r10,__zero_reg__\r
+ 904 0252 B104                 cpc r11,__zero_reg__\r
+ 905 0254 C104                 cpc r12,__zero_reg__\r
+ 906 0256 D104                 cpc r13,__zero_reg__\r
+ 907 0258 01F0                 breq .L38\r
+ 908                   .LSM69:\r
+ 909 025a 8081                 ld r24,Z\r
+ 910 025c 9181                 ldd r25,Z+1\r
+ 911 025e 0E94 0000            call clust2sect\r
+ 912                   .LVL78:\r
+ 913                   .LSM70:\r
+ 914 0262 6115                 cp r22,__zero_reg__\r
+ 915 0264 7105                 cpc r23,__zero_reg__\r
+ 916 0266 8105                 cpc r24,__zero_reg__\r
+ 917 0268 9105                 cpc r25,__zero_reg__\r
+ 918                   .LVL79:\r
+ 919 026a 01F4                 brne .L46\r
+ 920 026c AA81                 ldd r26,Y+2\r
+ 921 026e BB81                 ldd r27,Y+3\r
+ 922 0270 1496                 adiw r26,4\r
+ 923 0272 8C91                 ld r24,X\r
+ 924 0274 1497                 sbiw r26,4\r
+ 925 0276 8068                 ori r24,lo8(-128)\r
+ 926 0278 1496                 adiw r26,4\r
+ 927 027a 8C93                 st X,r24\r
+ 928 027c B2E0                 ldi r27,lo8(2)\r
+ 929 027e B983                 std Y+1,r27\r
+ 930                   .LVL80:\r
+ 931 0280 00C0                 rjmp .L35\r
+ 932                   .L46:\r
+ 933                   .LSM71:\r
+ 934 0282 9B01                 movw r18,r22\r
+ 935 0284 AC01                 movw r20,r24\r
+ 936 0286 2E0D                 add r18,r14\r
+ 937 0288 311D                 adc r19,__zero_reg__\r
+ 938 028a 411D                 adc r20,__zero_reg__\r
+ 939 028c 511D                 adc r21,__zero_reg__\r
+ 940                   .LVL81:\r
+ 941                   .LSM72:\r
+ 942 028e E394                 inc r14\r
+ 943 0290 EA81                 ldd r30,Y+2\r
+ 944 0292 FB81                 ldd r31,Y+3\r
+ 945 0294 E582                 std Z+5,r14\r
+ 946 0296 00C0                 rjmp .L47\r
+ 947                   .LVL82:\r
+ 948                   .L38:\r
+ 949 0298 20E0                 ldi r18,lo8(0)\r
+ 950 029a 30E0                 ldi r19,hi8(0)\r
+ 951 029c 40E0                 ldi r20,hlo8(0)\r
+ 952 029e 50E0                 ldi r21,hhi8(0)\r
+ 953                   .LVL83:\r
+ 954                   .L47:\r
+ 955                   .LSM73:\r
+ 956 02a0 EA81                 ldd r30,Y+2\r
+ 957 02a2 FB81                 ldd r31,Y+3\r
+ 958 02a4 8681                 ldd r24,Z+6\r
+ 959 02a6 9781                 ldd r25,Z+7\r
+ 960 02a8 A085                 ldd r26,Z+8\r
+ 961 02aa B185                 ldd r27,Z+9\r
+ 962 02ac 9170                 andi r25,hi8(511)\r
+ 963 02ae A070                 andi r26,hlo8(511)\r
+ 964 02b0 B070                 andi r27,hhi8(511)\r
+ 965 02b2 0097                 sbiw r24,0\r
+ 966 02b4 A105                 cpc r26,__zero_reg__\r
+ 967 02b6 B105                 cpc r27,__zero_reg__\r
+ 968 02b8 01F0                 breq .L35\r
+ 969 02ba 8689                 ldd r24,Z+22\r
+ 970 02bc 9789                 ldd r25,Z+23\r
+ 971 02be A08D                 ldd r26,Z+24\r
+ 972 02c0 B18D                 ldd r27,Z+25\r
+ 973 02c2 2817                 cp r18,r24\r
+ 974 02c4 3907                 cpc r19,r25\r
+ 975 02c6 4A07                 cpc r20,r26\r
+ 976 02c8 5B07                 cpc r21,r27\r
+ 977 02ca 01F0                 breq .L35\r
+ 978                   .LSM74:\r
+ 979 02cc 268B                 std Z+22,r18\r
+ 980 02ce 378B                 std Z+23,r19\r
+ 981 02d0 408F                 std Z+24,r20\r
+ 982 02d2 518F                 std Z+25,r21\r
+ 983                   .LVL84:\r
+ 984                   .L35:\r
+ 985                   .LSM75:\r
+ 986 02d4 8981                 ldd r24,Y+1\r
+ 987                   /* epilogue start */\r
+ 988 02d6 0F90                 pop __tmp_reg__\r
+ 989 02d8 0F90                 pop __tmp_reg__\r
+ 990 02da 0F90                 pop __tmp_reg__\r
+ 991 02dc CF91                 pop r28\r
+ 992 02de DF91                 pop r29\r
+ 993 02e0 1F91                 pop r17\r
+ 994 02e2 0F91                 pop r16\r
+ 995 02e4 FF90                 pop r15\r
+ 996 02e6 EF90                 pop r14\r
+ 997 02e8 DF90                 pop r13\r
+ 998                   .LVL85:\r
+ 999 02ea CF90                 pop r12\r
+ 1000                  .LVL86:\r
+ 1001 02ec BF90                pop r11\r
+ 1002                  .LVL87:\r
+ 1003 02ee AF90                pop r10\r
+ 1004                  .LVL88:\r
+ 1005 02f0 9F90                pop r9\r
+ 1006 02f2 8F90                pop r8\r
+ 1007                  .LVL89:\r
+ 1008 02f4 7F90                pop r7\r
+ 1009                  .LVL90:\r
+ 1010 02f6 6F90                pop r6\r
+ 1011                  .LVL91:\r
+ 1012 02f8 5F90                pop r5\r
+ 1013 02fa 4F90                pop r4\r
+ 1014 02fc 3F90                pop r3\r
+ 1015 02fe 2F90                pop r2\r
+ 1016 0300 0895                ret\r
+ 1017                  .LFE73:\r
+ 1019                          .section        .text.dir_seek,"ax",@progbits\r
+ 1021                  dir_seek:\r
+ 1022                  .LFB61:\r
+ 1023                  .LSM76:\r
+ 1024                  .LVL92:\r
+ 1025 0000 EF92                push r14\r
+ 1026 0002 FF92                push r15\r
+ 1027 0004 0F93                push r16\r
+ 1028 0006 1F93                push r17\r
+ 1029 0008 CF93                push r28\r
+ 1030 000a DF93                push r29\r
+ 1031                  /* prologue: function */\r
+ 1032                  /* frame size = 0 */\r
+ 1033 000c 8C01                movw r16,r24\r
+ 1034 000e EB01                movw r28,r22\r
+ 1035                  .LSM77:\r
+ 1036 0010 DC01                movw r26,r24\r
+ 1037 0012 1596                adiw r26,4+1\r
+ 1038 0014 7C93                st X,r23\r
+ 1039 0016 6E93                st -X,r22\r
+ 1040 0018 1497                sbiw r26,4\r
+ 1041                  .LSM78:\r
+ 1042 001a 1696                adiw r26,6\r
+ 1043 001c 4D91                ld r20,X+\r
+ 1044 001e 5D91                ld r21,X+\r
+ 1045 0020 6D91                ld r22,X+\r
+ 1046 0022 7C91                ld r23,X\r
+ 1047 0024 1997                sbiw r26,6+3\r
+ 1048                  .LVL93:\r
+ 1049                  .LSM79:\r
+ 1050 0026 4130                cpi r20,lo8(1)\r
+ 1051 0028 5105                cpc r21,__zero_reg__\r
+ 1052 002a 6105                cpc r22,__zero_reg__\r
+ 1053 002c 7105                cpc r23,__zero_reg__\r
+ 1054 002e 01F4                brne .+2\r
+ 1055 0030 00C0                rjmp .L53\r
+ 1056 0032 ED91                ld r30,X+\r
+ 1057 0034 FC91                ld r31,X\r
+ 1058 0036 8685                ldd r24,Z+14\r
+ 1059 0038 9785                ldd r25,Z+15\r
+ 1060 003a A089                ldd r26,Z+16\r
+ 1061 003c B189                ldd r27,Z+17\r
+ 1062                  .LVL94:\r
+ 1063 003e 4817                cp r20,r24\r
+ 1064 0040 5907                cpc r21,r25\r
+ 1065 0042 6A07                cpc r22,r26\r
+ 1066 0044 7B07                cpc r23,r27\r
+ 1067 0046 00F0                brlo .+2\r
+ 1068 0048 00C0                rjmp .L53\r
+ 1069                  .LSM80:\r
+ 1070 004a 4115                cp r20,__zero_reg__\r
+ 1071 004c 5105                cpc r21,__zero_reg__\r
+ 1072 004e 6105                cpc r22,__zero_reg__\r
+ 1073 0050 7105                cpc r23,__zero_reg__\r
+ 1074 0052 01F4                brne .L54\r
+ 1075 0054 8081                ld r24,Z\r
+ 1076 0056 8330                cpi r24,lo8(3)\r
+ 1077 0058 01F4                brne .L55\r
+ 1078                  .LSM81:\r
+ 1079 005a 4689                ldd r20,Z+22\r
+ 1080 005c 5789                ldd r21,Z+23\r
+ 1081 005e 608D                ldd r22,Z+24\r
+ 1082 0060 718D                ldd r23,Z+25\r
+ 1083                  .LSM82:\r
+ 1084 0062 4115                cp r20,__zero_reg__\r
+ 1085 0064 5105                cpc r21,__zero_reg__\r
+ 1086 0066 6105                cpc r22,__zero_reg__\r
+ 1087 0068 7105                cpc r23,__zero_reg__\r
+ 1088 006a 01F4                brne .L54\r
+ 1089                  .L55:\r
+ 1090                  .LSM83:\r
+ 1091 006c F801                movw r30,r16\r
+ 1092 006e 1286                std Z+10,__zero_reg__\r
+ 1093 0070 1386                std Z+11,__zero_reg__\r
+ 1094 0072 1486                std Z+12,__zero_reg__\r
+ 1095 0074 1586                std Z+13,__zero_reg__\r
+ 1096                  .LSM84:\r
+ 1097 0076 0190                ld __tmp_reg__,Z+\r
+ 1098 0078 F081                ld r31,Z\r
+ 1099 007a E02D                mov r30,__tmp_reg__\r
+ 1100 007c 8085                ldd r24,Z+8\r
+ 1101 007e 9185                ldd r25,Z+9\r
+ 1102 0080 C817                cp r28,r24\r
+ 1103 0082 D907                cpc r29,r25\r
+ 1104 0084 00F0                brlo .+2\r
+ 1105 0086 00C0                rjmp .L53\r
+ 1106                  .LVL95:\r
+ 1107                  .LSM85:\r
+ 1108 0088 CE01                movw r24,r28\r
+ 1109 008a A4E0                ldi r26,4\r
+ 1110 008c 9695        1:      lsr r25\r
+ 1111 008e 8795                ror r24\r
+ 1112 0090 AA95                dec r26\r
+ 1113 0092 01F4                brne 1b\r
+ 1114 0094 A0E0                ldi r26,lo8(0)\r
+ 1115 0096 B0E0                ldi r27,hi8(0)\r
+ 1116 0098 2689                ldd r18,Z+22\r
+ 1117 009a 3789                ldd r19,Z+23\r
+ 1118 009c 408D                ldd r20,Z+24\r
+ 1119 009e 518D                ldd r21,Z+25\r
+ 1120 00a0 820F                add r24,r18\r
+ 1121 00a2 931F                adc r25,r19\r
+ 1122 00a4 A41F                adc r26,r20\r
+ 1123 00a6 B51F                adc r27,r21\r
+ 1124 00a8 F801                movw r30,r16\r
+ 1125 00aa 8687                std Z+14,r24\r
+ 1126 00ac 9787                std Z+15,r25\r
+ 1127 00ae A08B                std Z+16,r26\r
+ 1128 00b0 B18B                std Z+17,r27\r
+ 1129 00b2 00C0                rjmp .L56\r
+ 1130                  .LVL96:\r
+ 1131                  .L54:\r
+ 1132                  .LSM86:\r
+ 1133 00b4 8281                ldd r24,Z+2\r
+ 1134 00b6 E82E                mov r14,r24\r
+ 1135                  .LVL97:\r
+ 1136 00b8 FF24                clr r15\r
+ 1137                  .LVL98:\r
+ 1138 00ba E4E0                ldi r30,4\r
+ 1139 00bc EE0C        1:      lsl r14\r
+ 1140 00be FF1C                rol r15\r
+ 1141 00c0 EA95                dec r30\r
+ 1142 00c2 01F4                brne 1b\r
+ 1143                  .LVL99:\r
+ 1144 00c4 00C0                rjmp .L57\r
+ 1145                  .LVL100:\r
+ 1146                  .L60:\r
+ 1147                  .LSM87:\r
+ 1148 00c6 0E94 0000           call get_fat\r
+ 1149                  .LVL101:\r
+ 1150 00ca AB01                movw r20,r22\r
+ 1151 00cc BC01                movw r22,r24\r
+ 1152                  .LVL102:\r
+ 1153                  .LSM88:\r
+ 1154 00ce 4F3F                cpi r20,lo8(-1)\r
+ 1155 00d0 FFEF                ldi r31,hi8(-1)\r
+ 1156 00d2 5F07                cpc r21,r31\r
+ 1157 00d4 FFEF                ldi r31,hlo8(-1)\r
+ 1158 00d6 6F07                cpc r22,r31\r
+ 1159 00d8 FFEF                ldi r31,hhi8(-1)\r
+ 1160 00da 7F07                cpc r23,r31\r
+ 1161 00dc 01F4                brne .L58\r
+ 1162 00de 81E0                ldi r24,lo8(1)\r
+ 1163 00e0 00C0                rjmp .L59\r
+ 1164                  .L58:\r
+ 1165                  .LSM89:\r
+ 1166 00e2 4230                cpi r20,lo8(2)\r
+ 1167 00e4 5105                cpc r21,__zero_reg__\r
+ 1168 00e6 6105                cpc r22,__zero_reg__\r
+ 1169 00e8 7105                cpc r23,__zero_reg__\r
+ 1170 00ea 00F4                brsh .+2\r
+ 1171 00ec 00C0                rjmp .L53\r
+ 1172 00ee D801                movw r26,r16\r
+ 1173 00f0 ED91                ld r30,X+\r
+ 1174 00f2 FC91                ld r31,X\r
+ 1175 00f4 8685                ldd r24,Z+14\r
+ 1176 00f6 9785                ldd r25,Z+15\r
+ 1177 00f8 A089                ldd r26,Z+16\r
+ 1178 00fa B189                ldd r27,Z+17\r
+ 1179 00fc 4817                cp r20,r24\r
+ 1180 00fe 5907                cpc r21,r25\r
+ 1181 0100 6A07                cpc r22,r26\r
+ 1182 0102 7B07                cpc r23,r27\r
+ 1183 0104 00F4                brsh .L53\r
+ 1184                  .LSM90:\r
+ 1185 0106 CE19                sub r28,r14\r
+ 1186 0108 DF09                sbc r29,r15\r
+ 1187                  .LVL103:\r
+ 1188                  .L57:\r
+ 1189 010a F801                movw r30,r16\r
+ 1190 010c 8081                ld r24,Z\r
+ 1191 010e 9181                ldd r25,Z+1\r
+ 1192                  .LSM91:\r
+ 1193 0110 CE15                cp r28,r14\r
+ 1194 0112 DF05                cpc r29,r15\r
+ 1195 0114 00F4                brsh .L60\r
+ 1196                  .LSM92:\r
+ 1197 0116 D801                movw r26,r16\r
+ 1198 0118 1A96                adiw r26,10\r
+ 1199 011a 4D93                st X+,r20\r
+ 1200 011c 5D93                st X+,r21\r
+ 1201 011e 6D93                st X+,r22\r
+ 1202 0120 7C93                st X,r23\r
+ 1203 0122 1D97                sbiw r26,10+3\r
+ 1204                  .LSM93:\r
+ 1205 0124 0E94 0000           call clust2sect\r
+ 1206                  .LVL104:\r
+ 1207 0128 9E01                movw r18,r28\r
+ 1208 012a 44E0                ldi r20,4\r
+ 1209 012c 3695        1:      lsr r19\r
+ 1210 012e 2795                ror r18\r
+ 1211 0130 4A95                dec r20\r
+ 1212 0132 01F4                brne 1b\r
+ 1213 0134 40E0                ldi r20,lo8(0)\r
+ 1214 0136 50E0                ldi r21,hi8(0)\r
+ 1215 0138 260F                add r18,r22\r
+ 1216 013a 371F                adc r19,r23\r
+ 1217 013c 481F                adc r20,r24\r
+ 1218 013e 591F                adc r21,r25\r
+ 1219 0140 F801                movw r30,r16\r
+ 1220 0142 2687                std Z+14,r18\r
+ 1221 0144 3787                std Z+15,r19\r
+ 1222 0146 408B                std Z+16,r20\r
+ 1223 0148 518B                std Z+17,r21\r
+ 1224                  .LVL105:\r
+ 1225                  .L56:\r
+ 1226                  .LSM94:\r
+ 1227 014a CF70                andi r28,lo8(15)\r
+ 1228 014c D070                andi r29,hi8(15)\r
+ 1229 014e 85E0                ldi r24,5\r
+ 1230 0150 CC0F        1:      lsl r28\r
+ 1231 0152 DD1F                rol r29\r
+ 1232 0154 8A95                dec r24\r
+ 1233 0156 01F4                brne 1b\r
+ 1234 0158 A296                adiw r28,34\r
+ 1235 015a D801                movw r26,r16\r
+ 1236 015c 8D91                ld r24,X+\r
+ 1237 015e 9C91                ld r25,X\r
+ 1238 0160 1197                sbiw r26,1\r
+ 1239 0162 8C0F                add r24,r28\r
+ 1240 0164 9D1F                adc r25,r29\r
+ 1241 0166 5396                adiw r26,18+1\r
+ 1242 0168 9C93                st X,r25\r
+ 1243 016a 8E93                st -X,r24\r
+ 1244 016c 5297                sbiw r26,18\r
+ 1245 016e 80E0                ldi r24,lo8(0)\r
+ 1246 0170 00C0                rjmp .L59\r
+ 1247                  .LVL106:\r
+ 1248                  .L53:\r
+ 1249                  .LSM95:\r
+ 1250 0172 82E0                ldi r24,lo8(2)\r
+ 1251                  .L59:\r
+ 1252                  /* epilogue start */\r
+ 1253                  .LSM96:\r
+ 1254 0174 DF91                pop r29\r
+ 1255 0176 CF91                pop r28\r
+ 1256                  .LVL107:\r
+ 1257 0178 1F91                pop r17\r
+ 1258 017a 0F91                pop r16\r
+ 1259                  .LVL108:\r
+ 1260 017c FF90                pop r15\r
+ 1261                  .LVL109:\r
+ 1262 017e EF90                pop r14\r
+ 1263                  .LVL110:\r
+ 1264 0180 0895                ret\r
+ 1265                  .LFE61:\r
+ 1267                          .section        .text.f_read,"ax",@progbits\r
+ 1268                  .global f_read\r
+ 1270                  f_read:\r
+ 1271                  .LFB71:\r
+ 1272                  .LSM97:\r
+ 1273                  .LVL111:\r
+ 1274 0000 2F92                push r2\r
+ 1275 0002 3F92                push r3\r
+ 1276 0004 4F92                push r4\r
+ 1277 0006 5F92                push r5\r
+ 1278 0008 7F92                push r7\r
+ 1279 000a 8F92                push r8\r
+ 1280 000c 9F92                push r9\r
+ 1281 000e AF92                push r10\r
+ 1282 0010 BF92                push r11\r
+ 1283 0012 CF92                push r12\r
+ 1284 0014 DF92                push r13\r
+ 1285 0016 EF92                push r14\r
+ 1286 0018 FF92                push r15\r
+ 1287 001a 0F93                push r16\r
+ 1288 001c 1F93                push r17\r
+ 1289 001e CF93                push r28\r
+ 1290 0020 DF93                push r29\r
+ 1291                  /* prologue: function */\r
+ 1292                  /* frame size = 0 */\r
+ 1293 0022 EC01                movw r28,r24\r
+ 1294 0024 162F                mov r17,r22\r
+ 1295 0026 072F                mov r16,r23\r
+ 1296                  .LVL112:\r
+ 1297 0028 4A01                movw r8,r20\r
+ 1298 002a 1901                movw r2,r18\r
+ 1299                  .LSM98:\r
+ 1300 002c D901                movw r26,r18\r
+ 1301 002e 1D92                st X+,__zero_reg__\r
+ 1302 0030 1C92                st X,__zero_reg__\r
+ 1303                  .LSM99:\r
+ 1304 0032 6A81                ldd r22,Y+2\r
+ 1305 0034 7B81                ldd r23,Y+3\r
+ 1306                  .LVL113:\r
+ 1307 0036 8881                ld r24,Y\r
+ 1308 0038 9981                ldd r25,Y+1\r
+ 1309                  .LVL114:\r
+ 1310 003a 0E94 0000           call validate\r
+ 1311                  .LVL115:\r
+ 1312 003e 782E                mov r7,r24\r
+ 1313                  .LVL116:\r
+ 1314                  .LSM100:\r
+ 1315 0040 8823                tst r24\r
+ 1316 0042 01F0                breq .+2\r
+ 1317 0044 00C0                rjmp .L63\r
+ 1318                  .LVL117:\r
+ 1319                  .LSM101:\r
+ 1320 0046 8C81                ldd r24,Y+4\r
+ 1321                  .LVL118:\r
+ 1322 0048 87FD                sbrc r24,7\r
+ 1323 004a 00C0                rjmp .L85\r
+ 1324                  .L64:\r
+ 1325                  .LSM102:\r
+ 1326 004c 80FD                sbrc r24,0\r
+ 1327 004e 00C0                rjmp .L65\r
+ 1328 0050 27E0                ldi r18,lo8(7)\r
+ 1329 0052 722E                mov r7,r18\r
+ 1330 0054 00C0                rjmp .L63\r
+ 1331                  .L65:\r
+ 1332                  .LSM103:\r
+ 1333 0056 2A85                ldd r18,Y+10\r
+ 1334 0058 3B85                ldd r19,Y+11\r
+ 1335 005a 4C85                ldd r20,Y+12\r
+ 1336 005c 5D85                ldd r21,Y+13\r
+ 1337                  .LVL119:\r
+ 1338 005e 8E81                ldd r24,Y+6\r
+ 1339 0060 9F81                ldd r25,Y+7\r
+ 1340 0062 A885                ldd r26,Y+8\r
+ 1341 0064 B985                ldd r27,Y+9\r
+ 1342 0066 281B                sub r18,r24\r
+ 1343 0068 390B                sbc r19,r25\r
+ 1344 006a 4A0B                sbc r20,r26\r
+ 1345 006c 5B0B                sbc r21,r27\r
+ 1346                  .LSM104:\r
+ 1347 006e C401                movw r24,r8\r
+ 1348 0070 A0E0                ldi r26,lo8(0)\r
+ 1349 0072 B0E0                ldi r27,hi8(0)\r
+ 1350                  .LVL120:\r
+ 1351 0074 2817                cp r18,r24\r
+ 1352 0076 3907                cpc r19,r25\r
+ 1353 0078 4A07                cpc r20,r26\r
+ 1354 007a 5B07                cpc r21,r27\r
+ 1355 007c 00F4                brsh .L66\r
+ 1356                  .LVL121:\r
+ 1357 007e 4901                movw r8,r18\r
+ 1358                  .LVL122:\r
+ 1359                  .L66:\r
+ 1360                  .LSM105:\r
+ 1361 0080 812F                mov r24,r17\r
+ 1362                  .LVL123:\r
+ 1363 0082 902F                mov r25,r16\r
+ 1364                  .LVL124:\r
+ 1365 0084 9C01                movw r18,r24\r
+ 1366                  .LVL125:\r
+ 1367 0086 2901                movw r4,r18\r
+ 1368                  .LVL126:\r
+ 1369 0088 00C0                rjmp .L67\r
+ 1370                  .LVL127:\r
+ 1371                  .L83:\r
+ 1372                  .LSM106:\r
+ 1373 008a 2E81                ldd r18,Y+6\r
+ 1374 008c 3F81                ldd r19,Y+7\r
+ 1375 008e 4885                ldd r20,Y+8\r
+ 1376 0090 5985                ldd r21,Y+9\r
+ 1377 0092 DA01                movw r26,r20\r
+ 1378 0094 C901                movw r24,r18\r
+ 1379 0096 9170                andi r25,hi8(511)\r
+ 1380 0098 A070                andi r26,hlo8(511)\r
+ 1381 009a B070                andi r27,hhi8(511)\r
+ 1382 009c 0097                sbiw r24,0\r
+ 1383 009e A105                cpc r26,__zero_reg__\r
+ 1384 00a0 B105                cpc r27,__zero_reg__\r
+ 1385 00a2 01F0                breq .+2\r
+ 1386 00a4 00C0                rjmp .L68\r
+ 1387                  .LSM107:\r
+ 1388 00a6 E881                ld r30,Y\r
+ 1389 00a8 F981                ldd r31,Y+1\r
+ 1390                  .LVL128:\r
+ 1391 00aa 9D81                ldd r25,Y+5\r
+ 1392                  .LVL129:\r
+ 1393 00ac 8281                ldd r24,Z+2\r
+ 1394 00ae 9817                cp r25,r24\r
+ 1395 00b0 00F0                brlo .L69\r
+ 1396                  .LSM108:\r
+ 1397 00b2 2115                cp r18,__zero_reg__\r
+ 1398 00b4 3105                cpc r19,__zero_reg__\r
+ 1399 00b6 4105                cpc r20,__zero_reg__\r
+ 1400 00b8 5105                cpc r21,__zero_reg__\r
+ 1401 00ba 01F4                brne .L70\r
+ 1402 00bc 6E85                ldd r22,Y+14\r
+ 1403 00be 7F85                ldd r23,Y+15\r
+ 1404 00c0 8889                ldd r24,Y+16\r
+ 1405 00c2 9989                ldd r25,Y+17\r
+ 1406                  .LVL130:\r
+ 1407 00c4 00C0                rjmp .L71\r
+ 1408                  .LVL131:\r
+ 1409                  .L70:\r
+ 1410 00c6 4A89                ldd r20,Y+18\r
+ 1411 00c8 5B89                ldd r21,Y+19\r
+ 1412 00ca 6C89                ldd r22,Y+20\r
+ 1413 00cc 7D89                ldd r23,Y+21\r
+ 1414 00ce CF01                movw r24,r30\r
+ 1415 00d0 0E94 0000           call get_fat\r
+ 1416                  .LVL132:\r
+ 1417                  .L71:\r
+ 1418                  .LSM109:\r
+ 1419 00d4 6230                cpi r22,lo8(2)\r
+ 1420 00d6 7105                cpc r23,__zero_reg__\r
+ 1421 00d8 8105                cpc r24,__zero_reg__\r
+ 1422 00da 9105                cpc r25,__zero_reg__\r
+ 1423 00dc 00F4                brsh .L72\r
+ 1424                  .LVL133:\r
+ 1425                  .L87:\r
+ 1426 00de 8C81                ldd r24,Y+4\r
+ 1427 00e0 8068                ori r24,lo8(-128)\r
+ 1428 00e2 8C83                std Y+4,r24\r
+ 1429                  .L85:\r
+ 1430 00e4 92E0                ldi r25,lo8(2)\r
+ 1431 00e6 792E                mov r7,r25\r
+ 1432 00e8 00C0                rjmp .L63\r
+ 1433                  .LVL134:\r
+ 1434                  .L72:\r
+ 1435                  .LSM110:\r
+ 1436 00ea 6F3F                cpi r22,lo8(-1)\r
+ 1437 00ec BFEF                ldi r27,hi8(-1)\r
+ 1438 00ee 7B07                cpc r23,r27\r
+ 1439 00f0 BFEF                ldi r27,hlo8(-1)\r
+ 1440 00f2 8B07                cpc r24,r27\r
+ 1441 00f4 BFEF                ldi r27,hhi8(-1)\r
+ 1442 00f6 9B07                cpc r25,r27\r
+ 1443 00f8 01F4                brne .+2\r
+ 1444 00fa 00C0                rjmp .L86\r
+ 1445                  .L73:\r
+ 1446                  .LSM111:\r
+ 1447 00fc 6A8B                std Y+18,r22\r
+ 1448 00fe 7B8B                std Y+19,r23\r
+ 1449 0100 8C8B                std Y+20,r24\r
+ 1450 0102 9D8B                std Y+21,r25\r
+ 1451                  .LSM112:\r
+ 1452 0104 1D82                std Y+5,__zero_reg__\r
+ 1453                  .LVL135:\r
+ 1454                  .L69:\r
+ 1455                  .LSM113:\r
+ 1456 0106 0881                ld r16,Y\r
+ 1457 0108 1981                ldd r17,Y+1\r
+ 1458                  .LVL136:\r
+ 1459 010a 4A89                ldd r20,Y+18\r
+ 1460 010c 5B89                ldd r21,Y+19\r
+ 1461 010e 6C89                ldd r22,Y+20\r
+ 1462 0110 7D89                ldd r23,Y+21\r
+ 1463 0112 C801                movw r24,r16\r
+ 1464 0114 0E94 0000           call clust2sect\r
+ 1465                  .LVL137:\r
+ 1466                  .LSM114:\r
+ 1467 0118 6115                cp r22,__zero_reg__\r
+ 1468 011a 7105                cpc r23,__zero_reg__\r
+ 1469 011c 8105                cpc r24,__zero_reg__\r
+ 1470 011e 9105                cpc r25,__zero_reg__\r
+ 1471 0120 01F0                breq .L87\r
+ 1472                  .LVL138:\r
+ 1473                  .L74:\r
+ 1474                  .LSM115:\r
+ 1475 0122 ED81                ldd r30,Y+5\r
+ 1476 0124 5B01                movw r10,r22\r
+ 1477 0126 6C01                movw r12,r24\r
+ 1478 0128 AE0E                add r10,r30\r
+ 1479 012a B11C                adc r11,__zero_reg__\r
+ 1480 012c C11C                adc r12,__zero_reg__\r
+ 1481 012e D11C                adc r13,__zero_reg__\r
+ 1482                  .LVL139:\r
+ 1483                  .LSM116:\r
+ 1484 0130 7401                movw r14,r8\r
+ 1485 0132 EF2C                mov r14,r15\r
+ 1486 0134 FF24                clr r15\r
+ 1487 0136 E694                lsr r14\r
+ 1488                  .LSM117:\r
+ 1489 0138 E114                cp r14,__zero_reg__\r
+ 1490 013a F104                cpc r15,__zero_reg__\r
+ 1491 013c 01F0                breq .L75\r
+ 1492                  .LSM118:\r
+ 1493 013e D801                movw r26,r16\r
+ 1494 0140 1296                adiw r26,2\r
+ 1495 0142 2C91                ld r18,X\r
+ 1496 0144 F0E0                ldi r31,lo8(0)\r
+ 1497 0146 C701                movw r24,r14\r
+ 1498 0148 8E0F                add r24,r30\r
+ 1499 014a 9F1F                adc r25,r31\r
+ 1500 014c 622F                mov r22,r18\r
+ 1501 014e 70E0                ldi r23,lo8(0)\r
+ 1502 0150 6817                cp r22,r24\r
+ 1503 0152 7907                cpc r23,r25\r
+ 1504 0154 00F4                brsh .L76\r
+ 1505                  .LSM119:\r
+ 1506 0156 7B01                movw r14,r22\r
+ 1507 0158 EE1A                sub r14,r30\r
+ 1508 015a FF0A                sbc r15,r31\r
+ 1509                  .L76:\r
+ 1510                  .LSM120:\r
+ 1511 015c F801                movw r30,r16\r
+ 1512 015e 8181                ldd r24,Z+1\r
+ 1513 0160 B201                movw r22,r4\r
+ 1514 0162 A601                movw r20,r12\r
+ 1515 0164 9501                movw r18,r10\r
+ 1516 0166 0E2D                mov r16,r14\r
+ 1517 0168 0E94 0000           call disk_read\r
+ 1518 016c 8823                tst r24\r
+ 1519 016e 01F4                brne .L86\r
+ 1520                  .L77:\r
+ 1521                  .LSM121:\r
+ 1522 0170 8D81                ldd r24,Y+5\r
+ 1523 0172 8E0D                add r24,r14\r
+ 1524 0174 8D83                std Y+5,r24\r
+ 1525                  .LSM122:\r
+ 1526 0176 B701                movw r22,r14\r
+ 1527                  .LVL140:\r
+ 1528 0178 762F                mov r23,r22\r
+ 1529 017a 6627                clr r22\r
+ 1530 017c 770F                lsl r23\r
+ 1531 017e 00C0                rjmp .L78\r
+ 1532                  .LVL141:\r
+ 1533                  .L75:\r
+ 1534                  .LSM123:\r
+ 1535 0180 AE8A                std Y+22,r10\r
+ 1536 0182 BF8A                std Y+23,r11\r
+ 1537 0184 C88E                std Y+24,r12\r
+ 1538 0186 D98E                std Y+25,r13\r
+ 1539                  .LSM124:\r
+ 1540 0188 EF5F                subi r30,lo8(-(1))\r
+ 1541 018a ED83                std Y+5,r30\r
+ 1542                  .LVL142:\r
+ 1543                  .L68:\r
+ 1544                  .LSM125:\r
+ 1545 018c EE80                ldd r14,Y+6\r
+ 1546 018e FF80                ldd r15,Y+7\r
+ 1547 0190 0885                ldd r16,Y+8\r
+ 1548 0192 1985                ldd r17,Y+9\r
+ 1549                  .LVL143:\r
+ 1550                  .LSM126:\r
+ 1551 0194 4E89                ldd r20,Y+22\r
+ 1552 0196 5F89                ldd r21,Y+23\r
+ 1553 0198 688D                ldd r22,Y+24\r
+ 1554 019a 798D                ldd r23,Y+25\r
+ 1555 019c 8881                ld r24,Y\r
+ 1556 019e 9981                ldd r25,Y+1\r
+ 1557 01a0 0E94 0000           call move_window\r
+ 1558                  .LVL144:\r
+ 1559 01a4 8823                tst r24\r
+ 1560 01a6 01F0                breq .L79\r
+ 1561                  .LVL145:\r
+ 1562                  .L86:\r
+ 1563                  .LSM127:\r
+ 1564 01a8 8C81                ldd r24,Y+4\r
+ 1565 01aa 8068                ori r24,lo8(-128)\r
+ 1566 01ac 8C83                std Y+4,r24\r
+ 1567 01ae 7724                clr r7\r
+ 1568 01b0 7394                inc r7\r
+ 1569 01b2 00C0                rjmp .L63\r
+ 1570                  .LVL146:\r
+ 1571                  .L79:\r
+ 1572                  .LSM128:\r
+ 1573 01b4 C701                movw r24,r14\r
+ 1574 01b6 9170                andi r25,hi8(511)\r
+ 1575 01b8 20E0                ldi r18,lo8(512)\r
+ 1576 01ba 32E0                ldi r19,hi8(512)\r
+ 1577 01bc 281B                sub r18,r24\r
+ 1578 01be 390B                sbc r19,r25\r
+ 1579 01c0 B401                movw r22,r8\r
+ 1580                  .LVL147:\r
+ 1581 01c2 2815                cp r18,r8\r
+ 1582 01c4 3905                cpc r19,r9\r
+ 1583 01c6 00F4                brsh .L80\r
+ 1584                  .LVL148:\r
+ 1585 01c8 B901                movw r22,r18\r
+ 1586                  .L80:\r
+ 1587                  .LSM129:\r
+ 1588 01ca 9B01                movw r18,r22\r
+ 1589                  .LVL149:\r
+ 1590                  .LBB4:\r
+ 1591                  .LBB5:\r
+ 1592                  .LSM130:\r
+ 1593 01cc 8E81                ldd r24,Y+6\r
+ 1594 01ce 9F81                ldd r25,Y+7\r
+ 1595 01d0 9170                andi r25,hi8(511)\r
+ 1596 01d2 8296                adiw r24,34\r
+ 1597 01d4 E881                ld r30,Y\r
+ 1598 01d6 F981                ldd r31,Y+1\r
+ 1599                  .LVL150:\r
+ 1600 01d8 E80F                add r30,r24\r
+ 1601 01da F91F                adc r31,r25\r
+ 1602 01dc D201                movw r26,r4\r
+ 1603 01de 00C0                rjmp .L81\r
+ 1604                  .LVL151:\r
+ 1605                  .L82:\r
+ 1606                  .LSM131:\r
+ 1607 01e0 8191                ld r24,Z+\r
+ 1608 01e2 8D93                st X+,r24\r
+ 1609                  .L81:\r
+ 1610 01e4 2150                subi r18,lo8(-(-1))\r
+ 1611 01e6 3040                sbci r19,hi8(-(-1))\r
+ 1612 01e8 8FEF                ldi r24,hi8(-1)\r
+ 1613 01ea 2F3F                cpi r18,lo8(-1)\r
+ 1614 01ec 3807                cpc r19,r24\r
+ 1615 01ee 01F4                brne .L82\r
+ 1616                  .LVL152:\r
+ 1617                  .L78:\r
+ 1618                  .LBE5:\r
+ 1619                  .LBE4:\r
+ 1620                  .LSM132:\r
+ 1621 01f0 460E                add r4,r22\r
+ 1622 01f2 571E                adc r5,r23\r
+ 1623 01f4 CB01                movw r24,r22\r
+ 1624 01f6 A0E0                ldi r26,lo8(0)\r
+ 1625 01f8 B0E0                ldi r27,hi8(0)\r
+ 1626                  .LVL153:\r
+ 1627 01fa 2E81                ldd r18,Y+6\r
+ 1628 01fc 3F81                ldd r19,Y+7\r
+ 1629 01fe 4885                ldd r20,Y+8\r
+ 1630 0200 5985                ldd r21,Y+9\r
+ 1631                  .LVL154:\r
+ 1632 0202 280F                add r18,r24\r
+ 1633 0204 391F                adc r19,r25\r
+ 1634 0206 4A1F                adc r20,r26\r
+ 1635 0208 5B1F                adc r21,r27\r
+ 1636 020a 2E83                std Y+6,r18\r
+ 1637 020c 3F83                std Y+7,r19\r
+ 1638 020e 4887                std Y+8,r20\r
+ 1639 0210 5987                std Y+9,r21\r
+ 1640 0212 D101                movw r26,r2\r
+ 1641                  .LVL155:\r
+ 1642 0214 8D91                ld r24,X+\r
+ 1643 0216 9C91                ld r25,X\r
+ 1644 0218 1197                sbiw r26,1\r
+ 1645 021a 860F                add r24,r22\r
+ 1646 021c 971F                adc r25,r23\r
+ 1647 021e 8D93                st X+,r24\r
+ 1648 0220 9C93                st X,r25\r
+ 1649 0222 861A                sub r8,r22\r
+ 1650 0224 970A                sbc r9,r23\r
+ 1651                  .LVL156:\r
+ 1652                  .L67:\r
+ 1653                  .LSM133:\r
+ 1654 0226 8114                cp r8,__zero_reg__\r
+ 1655 0228 9104                cpc r9,__zero_reg__\r
+ 1656 022a 01F0                breq .+2\r
+ 1657 022c 00C0                rjmp .L83\r
+ 1658                  .LVL157:\r
+ 1659                  .L63:\r
+ 1660                  .LSM134:\r
+ 1661 022e 872D                mov r24,r7\r
+ 1662                  /* epilogue start */\r
+ 1663 0230 DF91                pop r29\r
+ 1664 0232 CF91                pop r28\r
+ 1665                  .LVL158:\r
+ 1666 0234 1F91                pop r17\r
+ 1667                  .LVL159:\r
+ 1668 0236 0F91                pop r16\r
+ 1669                  .LVL160:\r
+ 1670 0238 FF90                pop r15\r
+ 1671 023a EF90                pop r14\r
+ 1672                  .LVL161:\r
+ 1673 023c DF90                pop r13\r
+ 1674 023e CF90                pop r12\r
+ 1675 0240 BF90                pop r11\r
+ 1676 0242 AF90                pop r10\r
+ 1677                  .LVL162:\r
+ 1678 0244 9F90                pop r9\r
+ 1679 0246 8F90                pop r8\r
+ 1680                  .LVL163:\r
+ 1681 0248 7F90                pop r7\r
+ 1682                  .LVL164:\r
+ 1683 024a 5F90                pop r5\r
+ 1684 024c 4F90                pop r4\r
+ 1685                  .LVL165:\r
+ 1686 024e 3F90                pop r3\r
+ 1687 0250 2F90                pop r2\r
+ 1688                  .LVL166:\r
+ 1689 0252 0895                ret\r
+ 1690                  .LFE71:\r
+ 1692                          .section        .text.check_fs,"ax",@progbits\r
+ 1694                  check_fs:\r
+ 1695                  .LFB66:\r
+ 1696                  .LSM135:\r
+ 1697                  .LVL167:\r
+ 1698 0000 0F93                push r16\r
+ 1699 0002 CF93                push r28\r
+ 1700 0004 DF93                push r29\r
+ 1701                  /* prologue: function */\r
+ 1702                  /* frame size = 0 */\r
+ 1703 0006 EC01                movw r28,r24\r
+ 1704 0008 9A01                movw r18,r20\r
+ 1705 000a AB01                movw r20,r22\r
+ 1706                  .LSM136:\r
+ 1707 000c BC01                movw r22,r24\r
+ 1708 000e 6E5D                subi r22,lo8(-(34))\r
+ 1709 0010 7F4F                sbci r23,hi8(-(34))\r
+ 1710 0012 8981                ldd r24,Y+1\r
+ 1711                  .LVL168:\r
+ 1712 0014 01E0                ldi r16,lo8(1)\r
+ 1713 0016 0E94 0000           call disk_read\r
+ 1714                  .LVL169:\r
+ 1715 001a 8823                tst r24\r
+ 1716 001c 01F0                breq .L89\r
+ 1717 001e 23E0                ldi r18,lo8(3)\r
+ 1718 0020 00C0                rjmp .L90\r
+ 1719                  .L89:\r
+ 1720                  .LSM137:\r
+ 1721 0022 C05E                subi r28,lo8(-(544))\r
+ 1722 0024 DD4F                sbci r29,hi8(-(544))\r
+ 1723 0026 8881                ld r24,Y\r
+ 1724 0028 9981                ldd r25,Y+1\r
+ 1725 002a C052                subi r28,lo8(-(-544))\r
+ 1726 002c D240                sbci r29,hi8(-(-544))\r
+ 1727 002e 8555                subi r24,lo8(-21931)\r
+ 1728 0030 9A4A                sbci r25,hi8(-21931)\r
+ 1729 0032 01F0                breq .L91\r
+ 1730 0034 22E0                ldi r18,lo8(2)\r
+ 1731 0036 00C0                rjmp .L90\r
+ 1732                  .L91:\r
+ 1733                  .LSM138:\r
+ 1734 0038 C85A                subi r28,lo8(-(88))\r
+ 1735 003a DF4F                sbci r29,hi8(-(88))\r
+ 1736 003c 8881                ld r24,Y\r
+ 1737 003e 9981                ldd r25,Y+1\r
+ 1738 0040 AA81                ldd r26,Y+2\r
+ 1739 0042 BB81                ldd r27,Y+3\r
+ 1740 0044 C855                subi r28,lo8(-(-88))\r
+ 1741 0046 D040                sbci r29,hi8(-(-88))\r
+ 1742 0048 B070                andi r27,hhi8(16777215)\r
+ 1743 004a 8654                subi r24,lo8(5521734)\r
+ 1744 004c 9144                sbci r25,hi8(5521734)\r
+ 1745 004e A445                sbci r26,hlo8(5521734)\r
+ 1746 0050 B040                sbci r27,hhi8(5521734)\r
+ 1747 0052 01F4                brne .L92\r
+ 1748 0054 20E0                ldi r18,lo8(0)\r
+ 1749 0056 00C0                rjmp .L90\r
+ 1750                  .L92:\r
+ 1751 0058 20E0                ldi r18,lo8(0)\r
+ 1752 005a CC58                subi r28,lo8(-(116))\r
+ 1753 005c DF4F                sbci r29,hi8(-(116))\r
+ 1754 005e 8881                ld r24,Y\r
+ 1755 0060 9981                ldd r25,Y+1\r
+ 1756 0062 AA81                ldd r26,Y+2\r
+ 1757 0064 BB81                ldd r27,Y+3\r
+ 1758 0066 B070                andi r27,hhi8(16777215)\r
+ 1759 0068 8654                subi r24,lo8(5521734)\r
+ 1760 006a 9144                sbci r25,hi8(5521734)\r
+ 1761 006c A445                sbci r26,hlo8(5521734)\r
+ 1762 006e B040                sbci r27,hhi8(5521734)\r
+ 1763 0070 01F0                breq .L90\r
+ 1764 0072 21E0                ldi r18,lo8(1)\r
+ 1765                  .L90:\r
+ 1766                  .LSM139:\r
+ 1767 0074 822F                mov r24,r18\r
+ 1768                  /* epilogue start */\r
+ 1769 0076 DF91                pop r29\r
+ 1770 0078 CF91                pop r28\r
+ 1771                  .LVL170:\r
+ 1772 007a 0F91                pop r16\r
+ 1773 007c 0895                ret\r
+ 1774                  .LFE66:\r
+ 1776                          .section        .text.chk_mounted,"ax",@progbits\r
+ 1777                  .global chk_mounted\r
+ 1779                  chk_mounted:\r
+ 1780                  .LFB67:\r
+ 1781                  .LSM140:\r
+ 1782                  .LVL171:\r
+ 1783 0000 AF92                push r10\r
+ 1784 0002 BF92                push r11\r
+ 1785 0004 CF92                push r12\r
+ 1786 0006 DF92                push r13\r
+ 1787 0008 EF92                push r14\r
+ 1788 000a FF92                push r15\r
+ 1789 000c 0F93                push r16\r
+ 1790 000e 1F93                push r17\r
+ 1791 0010 CF93                push r28\r
+ 1792 0012 DF93                push r29\r
+ 1793                  /* prologue: function */\r
+ 1794                  /* frame size = 0 */\r
+ 1795 0014 DC01                movw r26,r24\r
+ 1796 0016 AB01                movw r20,r22\r
+ 1797                  .LVL172:\r
+ 1798                  .LSM141:\r
+ 1799 0018 ED91                ld r30,X+\r
+ 1800 001a FC91                ld r31,X\r
+ 1801 001c 1197                sbiw r26,1\r
+ 1802                  .LVL173:\r
+ 1803                  .LSM142:\r
+ 1804 001e 8081                ld r24,Z\r
+ 1805                  .LVL174:\r
+ 1806 0020 282F                mov r18,r24\r
+ 1807                  .LVL175:\r
+ 1808 0022 30E0                ldi r19,lo8(0)\r
+ 1809                  .LVL176:\r
+ 1810 0024 2053                subi r18,lo8(-(-48))\r
+ 1811 0026 3040                sbci r19,hi8(-(-48))\r
+ 1812                  .LVL177:\r
+ 1813                  .LSM143:\r
+ 1814 0028 2A30                cpi r18,10\r
+ 1815 002a 3105                cpc r19,__zero_reg__\r
+ 1816 002c 00F4                brsh .L96\r
+ 1817                  .LVL178:\r
+ 1818 002e 8181                ldd r24,Z+1\r
+ 1819 0030 8A33                cpi r24,lo8(58)\r
+ 1820 0032 01F4                brne .L96\r
+ 1821                  .LSM144:\r
+ 1822 0034 3296                adiw r30,2\r
+ 1823 0036 ED93                st X+,r30\r
+ 1824 0038 FC93                st X,r31\r
+ 1825                  .LSM145:\r
+ 1826 003a 232B                or r18,r19\r
+ 1827 003c 01F0                breq .L96\r
+ 1828 003e 8BE0                ldi r24,lo8(11)\r
+ 1829 0040 00C0                rjmp .L97\r
+ 1830                  .L96:\r
+ 1831                  .LSM146:\r
+ 1832 0042 C091 0000           lds r28,FatFs\r
+ 1833 0046 D091 0000           lds r29,(FatFs)+1\r
+ 1834                  .LVL179:\r
+ 1835 004a FA01                movw r30,r20\r
+ 1836                  .LVL180:\r
+ 1837 004c D183                std Z+1,r29\r
+ 1838 004e C083                st Z,r28\r
+ 1839                  .LSM147:\r
+ 1840 0050 2097                sbiw r28,0\r
+ 1841 0052 01F4                brne .L98\r
+ 1842 0054 8CE0                ldi r24,lo8(12)\r
+ 1843 0056 00C0                rjmp .L97\r
+ 1844                  .L98:\r
+ 1845                  .LSM148:\r
+ 1846 0058 8881                ld r24,Y\r
+ 1847 005a 8823                tst r24\r
+ 1848 005c 01F0                breq .L99\r
+ 1849                  .LSM149:\r
+ 1850 005e 8981                ldd r24,Y+1\r
+ 1851 0060 0E94 0000           call disk_status\r
+ 1852                  .LVL181:\r
+ 1853                  .LSM150:\r
+ 1854 0064 80FF                sbrs r24,0\r
+ 1855 0066 00C0                rjmp .L112\r
+ 1856                  .LVL182:\r
+ 1857                  .L99:\r
+ 1858                  .LSM151:\r
+ 1859 0068 1882                st Y,__zero_reg__\r
+ 1860                  .LSM152:\r
+ 1861 006a 1982                std Y+1,__zero_reg__\r
+ 1862                  .LSM153:\r
+ 1863 006c 80E0                ldi r24,lo8(0)\r
+ 1864 006e 0E94 0000           call disk_initialize\r
+ 1865                  .LVL183:\r
+ 1866                  .LSM154:\r
+ 1867 0072 80FF                sbrs r24,0\r
+ 1868 0074 00C0                rjmp .L100\r
+ 1869 0076 83E0                ldi r24,lo8(3)\r
+ 1870 0078 00C0                rjmp .L97\r
+ 1871                  .L100:\r
+ 1872                  .LSM155:\r
+ 1873 007a CE01                movw r24,r28\r
+ 1874 007c 40E0                ldi r20,lo8(0)\r
+ 1875 007e 50E0                ldi r21,hi8(0)\r
+ 1876 0080 60E0                ldi r22,hlo8(0)\r
+ 1877 0082 70E0                ldi r23,hhi8(0)\r
+ 1878 0084 0E94 0000           call check_fs\r
+ 1879                  .LSM156:\r
+ 1880 0088 8130                cpi r24,lo8(1)\r
+ 1881                  .LVL184:\r
+ 1882 008a 01F0                breq .L101\r
+ 1883 008c EE24                clr r14\r
+ 1884 008e FF24                clr r15\r
+ 1885 0090 8701                movw r16,r14\r
+ 1886                  .LVL185:\r
+ 1887 0092 00C0                rjmp .L102\r
+ 1888                  .LVL186:\r
+ 1889                  .L101:\r
+ 1890                  .LSM157:\r
+ 1891 0094 FE01                movw r30,r28\r
+ 1892                  .LVL187:\r
+ 1893 0096 E052                subi r30,lo8(-(480))\r
+ 1894 0098 FE4F                sbci r31,hi8(-(480))\r
+ 1895                  .LSM158:\r
+ 1896 009a 8481                ldd r24,Z+4\r
+ 1897                  .LVL188:\r
+ 1898 009c 8823                tst r24\r
+ 1899 009e 01F4                brne .+2\r
+ 1900 00a0 00C0                rjmp .L103\r
+ 1901                  .LSM159:\r
+ 1902 00a2 E084                ldd r14,Z+8\r
+ 1903 00a4 F184                ldd r15,Z+9\r
+ 1904 00a6 0285                ldd r16,Z+10\r
+ 1905 00a8 1385                ldd r17,Z+11\r
+ 1906                  .LVL189:\r
+ 1907                  .LSM160:\r
+ 1908 00aa CE01                movw r24,r28\r
+ 1909 00ac B801                movw r22,r16\r
+ 1910 00ae A701                movw r20,r14\r
+ 1911 00b0 0E94 0000           call check_fs\r
+ 1912                  .LVL190:\r
+ 1913                  .L102:\r
+ 1914                  .LSM161:\r
+ 1915 00b4 8330                cpi r24,lo8(3)\r
+ 1916 00b6 01F4                brne .L104\r
+ 1917 00b8 81E0                ldi r24,lo8(1)\r
+ 1918                  .LVL191:\r
+ 1919 00ba 00C0                rjmp .L97\r
+ 1920                  .LVL192:\r
+ 1921                  .L104:\r
+ 1922                  .LSM162:\r
+ 1923 00bc 8823                tst r24\r
+ 1924 00be 01F0                breq .+2\r
+ 1925 00c0 00C0                rjmp .L103\r
+ 1926 00c2 8DA5                ldd r24,Y+45\r
+ 1927 00c4 9EA5                ldd r25,Y+46\r
+ 1928                  .LVL193:\r
+ 1929 00c6 8050                subi r24,lo8(512)\r
+ 1930 00c8 9240                sbci r25,hi8(512)\r
+ 1931 00ca 01F0                breq .+2\r
+ 1932 00cc 00C0                rjmp .L103\r
+ 1933                  .LSM163:\r
+ 1934 00ce 88AD                ldd r24,Y+56\r
+ 1935 00d0 99AD                ldd r25,Y+57\r
+ 1936 00d2 BC01                movw r22,r24\r
+ 1937                  .LVL194:\r
+ 1938 00d4 80E0                ldi r24,lo8(0)\r
+ 1939 00d6 90E0                ldi r25,hi8(0)\r
+ 1940                  .LVL195:\r
+ 1941                  .LSM164:\r
+ 1942 00d8 6115                cp r22,__zero_reg__\r
+ 1943 00da 7105                cpc r23,__zero_reg__\r
+ 1944 00dc 8105                cpc r24,__zero_reg__\r
+ 1945 00de 9105                cpc r25,__zero_reg__\r
+ 1946 00e0 01F4                brne .L105\r
+ 1947 00e2 CA5B                subi r28,lo8(-(70))\r
+ 1948 00e4 DF4F                sbci r29,hi8(-(70))\r
+ 1949 00e6 6881                ld r22,Y\r
+ 1950 00e8 7981                ldd r23,Y+1\r
+ 1951 00ea 8A81                ldd r24,Y+2\r
+ 1952 00ec 9B81                ldd r25,Y+3\r
+ 1953                  .LVL196:\r
+ 1954 00ee C654                subi r28,lo8(-(-70))\r
+ 1955 00f0 D040                sbci r29,hi8(-(-70))\r
+ 1956                  .L105:\r
+ 1957                  .LSM165:\r
+ 1958 00f2 6A87                std Y+10,r22\r
+ 1959 00f4 7B87                std Y+11,r23\r
+ 1960 00f6 8C87                std Y+12,r24\r
+ 1961 00f8 9D87                std Y+13,r25\r
+ 1962                  .LSM166:\r
+ 1963 00fa 2AA9                ldd r18,Y+50\r
+ 1964 00fc 2B83                std Y+3,r18\r
+ 1965                  .LSM167:\r
+ 1966 00fe 30E0                ldi r19,lo8(0)\r
+ 1967 0100 40E0                ldi r20,lo8(0)\r
+ 1968 0102 50E0                ldi r21,hi8(0)\r
+ 1969 0104 0E94 0000           call __mulsi3\r
+ 1970                  .LVL197:\r
+ 1971 0108 5B01                movw r10,r22\r
+ 1972 010a 6C01                movw r12,r24\r
+ 1973                  .LVL198:\r
+ 1974                  .LSM168:\r
+ 1975 010c 88A9                ldd r24,Y+48\r
+ 1976 010e 99A9                ldd r25,Y+49\r
+ 1977                  .LVL199:\r
+ 1978 0110 A0E0                ldi r26,lo8(0)\r
+ 1979 0112 B0E0                ldi r27,hi8(0)\r
+ 1980 0114 E80E                add r14,r24\r
+ 1981 0116 F91E                adc r15,r25\r
+ 1982 0118 0A1F                adc r16,r26\r
+ 1983 011a 1B1F                adc r17,r27\r
+ 1984 011c EA8A                std Y+18,r14\r
+ 1985 011e FB8A                std Y+19,r15\r
+ 1986 0120 0C8B                std Y+20,r16\r
+ 1987 0122 1D8B                std Y+21,r17\r
+ 1988                  .LSM169:\r
+ 1989 0124 8FA5                ldd r24,Y+47\r
+ 1990 0126 8A83                std Y+2,r24\r
+ 1991                  .LSM170:\r
+ 1992 0128 2BA9                ldd r18,Y+51\r
+ 1993 012a 3CA9                ldd r19,Y+52\r
+ 1994 012c 3987                std Y+9,r19\r
+ 1995 012e 2887                std Y+8,r18\r
+ 1996                  .LSM171:\r
+ 1997 0130 8DA9                ldd r24,Y+53\r
+ 1998 0132 9EA9                ldd r25,Y+54\r
+ 1999 0134 7C01                movw r14,r24\r
+ 2000                  .LVL200:\r
+ 2001 0136 00E0                ldi r16,lo8(0)\r
+ 2002 0138 10E0                ldi r17,hi8(0)\r
+ 2003                  .LVL201:\r
+ 2004                  .LSM172:\r
+ 2005 013a E114                cp r14,__zero_reg__\r
+ 2006 013c F104                cpc r15,__zero_reg__\r
+ 2007 013e 0105                cpc r16,__zero_reg__\r
+ 2008 0140 1105                cpc r17,__zero_reg__\r
+ 2009 0142 01F4                brne .L106\r
+ 2010 0144 CE5B                subi r28,lo8(-(66))\r
+ 2011 0146 DF4F                sbci r29,hi8(-(66))\r
+ 2012 0148 E880                ld r14,Y\r
+ 2013 014a F980                ldd r15,Y+1\r
+ 2014 014c 0A81                ldd r16,Y+2\r
+ 2015 014e 1B81                ldd r17,Y+3\r
+ 2016                  .LVL202:\r
+ 2017 0150 C254                subi r28,lo8(-(-66))\r
+ 2018 0152 D040                sbci r29,hi8(-(-66))\r
+ 2019                  .L106:\r
+ 2020                  .LSM173:\r
+ 2021 0154 88A9                ldd r24,Y+48\r
+ 2022 0156 99A9                ldd r25,Y+49\r
+ 2023 0158 A0E0                ldi r26,lo8(0)\r
+ 2024 015a B0E0                ldi r27,hi8(0)\r
+ 2025 015c E81A                sub r14,r24\r
+ 2026 015e F90A                sbc r15,r25\r
+ 2027 0160 0A0B                sbc r16,r26\r
+ 2028 0162 1B0B                sbc r17,r27\r
+ 2029                  .LVL203:\r
+ 2030 0164 EA18                sub r14,r10\r
+ 2031 0166 FB08                sbc r15,r11\r
+ 2032 0168 0C09                sbc r16,r12\r
+ 2033 016a 1D09                sbc r17,r13\r
+ 2034 016c 44E0                ldi r20,4\r
+ 2035 016e 3695        1:      lsr r19\r
+ 2036 0170 2795                ror r18\r
+ 2037 0172 4A95                dec r20\r
+ 2038 0174 01F4                brne 1b\r
+ 2039 0176 C901                movw r24,r18\r
+ 2040 0178 A0E0                ldi r26,lo8(0)\r
+ 2041 017a B0E0                ldi r27,hi8(0)\r
+ 2042 017c E81A                sub r14,r24\r
+ 2043 017e F90A                sbc r15,r25\r
+ 2044 0180 0A0B                sbc r16,r26\r
+ 2045 0182 1B0B                sbc r17,r27\r
+ 2046 0184 2A81                ldd r18,Y+2\r
+ 2047 0186 30E0                ldi r19,lo8(0)\r
+ 2048 0188 40E0                ldi r20,lo8(0)\r
+ 2049 018a 50E0                ldi r21,hi8(0)\r
+ 2050 018c C801                movw r24,r16\r
+ 2051 018e B701                movw r22,r14\r
+ 2052 0190 0E94 0000           call __udivmodsi4\r
+ 2053 0194 2E5F                subi r18,lo8(-(2))\r
+ 2054 0196 3F4F                sbci r19,hi8(-(2))\r
+ 2055 0198 4F4F                sbci r20,hlo8(-(2))\r
+ 2056 019a 5F4F                sbci r21,hhi8(-(2))\r
+ 2057                  .LVL204:\r
+ 2058 019c 2E87                std Y+14,r18\r
+ 2059 019e 3F87                std Y+15,r19\r
+ 2060 01a0 488B                std Y+16,r20\r
+ 2061 01a2 598B                std Y+17,r21\r
+ 2062                  .LSM174:\r
+ 2063 01a4 273F                cpi r18,lo8(4087)\r
+ 2064 01a6 8FE0                ldi r24,hi8(4087)\r
+ 2065 01a8 3807                cpc r19,r24\r
+ 2066 01aa 80E0                ldi r24,hlo8(4087)\r
+ 2067 01ac 4807                cpc r20,r24\r
+ 2068 01ae 80E0                ldi r24,hhi8(4087)\r
+ 2069 01b0 5807                cpc r21,r24\r
+ 2070 01b2 00F4                brsh .L107\r
+ 2071 01b4 61E0                ldi r22,lo8(1)\r
+ 2072                  .LVL205:\r
+ 2073 01b6 00C0                rjmp .L108\r
+ 2074                  .LVL206:\r
+ 2075                  .L107:\r
+ 2076                  .LSM175:\r
+ 2077 01b8 275F                subi r18,lo8(65527)\r
+ 2078 01ba 3F4F                sbci r19,hi8(65527)\r
+ 2079 01bc 4040                sbci r20,hlo8(65527)\r
+ 2080 01be 5040                sbci r21,hhi8(65527)\r
+ 2081 01c0 00F0                brlo .+2\r
+ 2082 01c2 00C0                rjmp .L109\r
+ 2083 01c4 62E0                ldi r22,lo8(2)\r
+ 2084                  .LVL207:\r
+ 2085                  .L108:\r
+ 2086                  .LSM176:\r
+ 2087 01c6 8A89                ldd r24,Y+18\r
+ 2088 01c8 9B89                ldd r25,Y+19\r
+ 2089 01ca AC89                ldd r26,Y+20\r
+ 2090 01cc BD89                ldd r27,Y+21\r
+ 2091 01ce 8A0D                add r24,r10\r
+ 2092 01d0 9B1D                adc r25,r11\r
+ 2093 01d2 AC1D                adc r26,r12\r
+ 2094 01d4 BD1D                adc r27,r13\r
+ 2095 01d6 8E8B                std Y+22,r24\r
+ 2096 01d8 9F8B                std Y+23,r25\r
+ 2097 01da A88F                std Y+24,r26\r
+ 2098 01dc B98F                std Y+25,r27\r
+ 2099                  .L110:\r
+ 2100                  .LSM177:\r
+ 2101 01de 8885                ldd r24,Y+8\r
+ 2102 01e0 9985                ldd r25,Y+9\r
+ 2103 01e2 34E0                ldi r19,4\r
+ 2104 01e4 9695        1:      lsr r25\r
+ 2105 01e6 8795                ror r24\r
+ 2106 01e8 3A95                dec r19\r
+ 2107 01ea 01F4                brne 1b\r
+ 2108 01ec A0E0                ldi r26,lo8(0)\r
+ 2109 01ee B0E0                ldi r27,hi8(0)\r
+ 2110 01f0 2A89                ldd r18,Y+18\r
+ 2111 01f2 3B89                ldd r19,Y+19\r
+ 2112 01f4 4C89                ldd r20,Y+20\r
+ 2113 01f6 5D89                ldd r21,Y+21\r
+ 2114                  .LVL208:\r
+ 2115 01f8 820F                add r24,r18\r
+ 2116 01fa 931F                adc r25,r19\r
+ 2117 01fc A41F                adc r26,r20\r
+ 2118 01fe B51F                adc r27,r21\r
+ 2119 0200 8A0D                add r24,r10\r
+ 2120 0202 9B1D                adc r25,r11\r
+ 2121 0204 AC1D                adc r26,r12\r
+ 2122 0206 BD1D                adc r27,r13\r
+ 2123 0208 8A8F                std Y+26,r24\r
+ 2124 020a 9B8F                std Y+27,r25\r
+ 2125 020c AC8F                std Y+28,r26\r
+ 2126 020e BD8F                std Y+29,r27\r
+ 2127                  .LSM178:\r
+ 2128 0210 6883                st Y,r22\r
+ 2129                  .LSM179:\r
+ 2130 0212 1E8E                std Y+30,__zero_reg__\r
+ 2131 0214 1F8E                std Y+31,__zero_reg__\r
+ 2132 0216 18A2                std Y+32,__zero_reg__\r
+ 2133 0218 19A2                std Y+33,__zero_reg__\r
+ 2134                  .LSM180:\r
+ 2135 021a 8091 0000           lds r24,Fsid\r
+ 2136 021e 9091 0000           lds r25,(Fsid)+1\r
+ 2137 0222 0196                adiw r24,1\r
+ 2138 0224 9093 0000           sts (Fsid)+1,r25\r
+ 2139 0228 8093 0000           sts Fsid,r24\r
+ 2140 022c 9F83                std Y+7,r25\r
+ 2141 022e 8E83                std Y+6,r24\r
+ 2142                  .L112:\r
+ 2143 0230 80E0                ldi r24,lo8(0)\r
+ 2144 0232 00C0                rjmp .L97\r
+ 2145                  .LVL209:\r
+ 2146                  .L103:\r
+ 2147                  .LSM181:\r
+ 2148 0234 8DE0                ldi r24,lo8(13)\r
+ 2149                  .LVL210:\r
+ 2150                  .L97:\r
+ 2151                  /* epilogue start */\r
+ 2152                  .LSM182:\r
+ 2153 0236 DF91                pop r29\r
+ 2154 0238 CF91                pop r28\r
+ 2155                  .LVL211:\r
+ 2156 023a 1F91                pop r17\r
+ 2157 023c 0F91                pop r16\r
+ 2158                  .LVL212:\r
+ 2159 023e FF90                pop r15\r
+ 2160 0240 EF90                pop r14\r
+ 2161                  .LVL213:\r
+ 2162 0242 DF90                pop r13\r
+ 2163 0244 CF90                pop r12\r
+ 2164 0246 BF90                pop r11\r
+ 2165 0248 AF90                pop r10\r
+ 2166                  .LVL214:\r
+ 2167 024a 0895                ret\r
+ 2168                  .LVL215:\r
+ 2169                  .L109:\r
+ 2170                  .LSM183:\r
+ 2171 024c C25B                subi r28,lo8(-(78))\r
+ 2172 024e DF4F                sbci r29,hi8(-(78))\r
+ 2173 0250 8881                ld r24,Y\r
+ 2174 0252 9981                ldd r25,Y+1\r
+ 2175 0254 AA81                ldd r26,Y+2\r
+ 2176 0256 BB81                ldd r27,Y+3\r
+ 2177 0258 CE54                subi r28,lo8(-(-78))\r
+ 2178 025a D040                sbci r29,hi8(-(-78))\r
+ 2179 025c 8E8B                std Y+22,r24\r
+ 2180 025e 9F8B                std Y+23,r25\r
+ 2181 0260 A88F                std Y+24,r26\r
+ 2182 0262 B98F                std Y+25,r27\r
+ 2183 0264 63E0                ldi r22,lo8(3)\r
+ 2184                  .LVL216:\r
+ 2185 0266 00C0                rjmp .L110\r
+ 2186                  .LFE67:\r
+ 2188                          .data\r
+ 2189                  .LC0:\r
+ 2190 0000 2022 2A2B           .string " \"*+,[=]|\177"\r
+ 2190      2C5B 3D5D \r
+ 2190      7C7F 00\r
+ 2191                          .section        .text.f_open,"ax",@progbits\r
+ 2192                  .global f_open\r
+ 2194                  f_open:\r
+ 2195                  .LFB70:\r
+ 2196                  .LSM184:\r
+ 2197                  .LVL217:\r
+ 2198 0000 3F92                push r3\r
+ 2199 0002 4F92                push r4\r
+ 2200 0004 5F92                push r5\r
+ 2201 0006 6F92                push r6\r
+ 2202 0008 7F92                push r7\r
+ 2203 000a 8F92                push r8\r
+ 2204 000c 9F92                push r9\r
+ 2205 000e AF92                push r10\r
+ 2206 0010 BF92                push r11\r
+ 2207 0012 CF92                push r12\r
+ 2208 0014 DF92                push r13\r
+ 2209 0016 EF92                push r14\r
+ 2210 0018 FF92                push r15\r
+ 2211 001a 0F93                push r16\r
+ 2212 001c 1F93                push r17\r
+ 2213 001e DF93                push r29\r
+ 2214 0020 CF93                push r28\r
+ 2215 0022 CDB7                in r28,__SP_L__\r
+ 2216 0024 DEB7                in r29,__SP_H__\r
+ 2217 0026 A497                sbiw r28,36\r
+ 2218 0028 0FB6                in __tmp_reg__,__SREG__\r
+ 2219 002a F894                cli\r
+ 2220 002c DEBF                out __SP_H__,r29\r
+ 2221 002e 0FBE                out __SREG__,__tmp_reg__\r
+ 2222 0030 CDBF                out __SP_L__,r28\r
+ 2223                  /* prologue: function */\r
+ 2224                  /* frame size = 36 */\r
+ 2225 0032 4C01                movw r8,r24\r
+ 2226 0034 7CA3                std Y+36,r23\r
+ 2227 0036 6BA3                std Y+35,r22\r
+ 2228 0038 742E                mov r7,r20\r
+ 2229                  .LSM185:\r
+ 2230 003a DC01                movw r26,r24\r
+ 2231 003c 1D92                st X+,__zero_reg__\r
+ 2232 003e 1C92                st X,__zero_reg__\r
+ 2233                  .LSM186:\r
+ 2234 0040 CE01                movw r24,r28\r
+ 2235                  .LVL218:\r
+ 2236 0042 8396                adiw r24,35\r
+ 2237 0044 BE01                movw r22,r28\r
+ 2238                  .LVL219:\r
+ 2239 0046 635F                subi r22,lo8(-(13))\r
+ 2240 0048 7F4F                sbci r23,hi8(-(13))\r
+ 2241 004a 40E0                ldi r20,lo8(0)\r
+ 2242                  .LVL220:\r
+ 2243 004c 0E94 0000           call chk_mounted\r
+ 2244                  .LSM187:\r
+ 2245 0050 8823                tst r24\r
+ 2246                  .LVL221:\r
+ 2247 0052 01F0                breq .+2\r
+ 2248 0054 00C0                rjmp .L115\r
+ 2249                  .LSM188:\r
+ 2250 0056 CE01                movw r24,r28\r
+ 2251                  .LVL222:\r
+ 2252 0058 0196                adiw r24,1\r
+ 2253 005a 9AA3                std Y+34,r25\r
+ 2254 005c 89A3                std Y+33,r24\r
+ 2255                  .LSM189:\r
+ 2256 005e CBA0                ldd r12,Y+35\r
+ 2257 0060 DCA0                ldd r13,Y+36\r
+ 2258                  .LVL223:\r
+ 2259 0062 00C0                rjmp .L116\r
+ 2260                  .L117:\r
+ 2261                  .LBB20:\r
+ 2262                  .LBB21:\r
+ 2263                  .LSM190:\r
+ 2264 0064 0894                sec\r
+ 2265 0066 C11C                adc r12,__zero_reg__\r
+ 2266 0068 D11C                adc r13,__zero_reg__\r
+ 2267                  .L116:\r
+ 2268 006a F601                movw r30,r12\r
+ 2269 006c 8081                ld r24,Z\r
+ 2270 006e 8032                cpi r24,lo8(32)\r
+ 2271 0070 01F0                breq .L117\r
+ 2272                  .LSM191:\r
+ 2273 0072 8F32                cpi r24,lo8(47)\r
+ 2274 0074 01F0                breq .L118\r
+ 2275 0076 8C35                cpi r24,lo8(92)\r
+ 2276 0078 01F4                brne .L119\r
+ 2277                  .L118:\r
+ 2278                  .LSM192:\r
+ 2279 007a 0894                sec\r
+ 2280 007c C11C                adc r12,__zero_reg__\r
+ 2281 007e D11C                adc r13,__zero_reg__\r
+ 2282                  .L119:\r
+ 2283                  .LSM193:\r
+ 2284 0080 1B8A                std Y+19,__zero_reg__\r
+ 2285 0082 1C8A                std Y+20,__zero_reg__\r
+ 2286 0084 1D8A                std Y+21,__zero_reg__\r
+ 2287 0086 1E8A                std Y+22,__zero_reg__\r
+ 2288                  .LSM194:\r
+ 2289 0088 D601                movw r26,r12\r
+ 2290 008a 8C91                ld r24,X\r
+ 2291 008c 8032                cpi r24,lo8(32)\r
+ 2292 008e 00F4                brsh .L120\r
+ 2293                  .LBE21:\r
+ 2294                  .LSM195:\r
+ 2295 0090 CE01                movw r24,r28\r
+ 2296 0092 0D96                adiw r24,13\r
+ 2297 0094 60E0                ldi r22,lo8(0)\r
+ 2298 0096 70E0                ldi r23,hi8(0)\r
+ 2299 0098 0E94 0000           call dir_seek\r
+ 2300                  .LBE20:\r
+ 2301                  .LSM196:\r
+ 2302 009c 8823                tst r24\r
+ 2303                  .LVL224:\r
+ 2304 009e 01F4                brne .+2\r
+ 2305 00a0 00C0                rjmp .L160\r
+ 2306 00a2 00C0                rjmp .L115\r
+ 2307                  .LVL225:\r
+ 2308                  .L120:\r
+ 2309                  .LBB45:\r
+ 2310                  .LBB44:\r
+ 2311                  .LBB22:\r
+ 2312                  .LBB24:\r
+ 2313                  .LBB28:\r
+ 2314                  .LBB29:\r
+ 2315                  .LSM197:\r
+ 2316 00a4 F0E2                ldi r31,lo8(32)\r
+ 2317 00a6 6F2E                mov r6,r31\r
+ 2318                  .LBE29:\r
+ 2319                  .LBE28:\r
+ 2320                  .LSM198:\r
+ 2321 00a8 E5E0                ldi r30,lo8(5)\r
+ 2322 00aa 3E2E                mov r3,r30\r
+ 2323                  .LBE24:\r
+ 2324                  .LBE22:\r
+ 2325                  .LBB32:\r
+ 2326                  .LSM199:\r
+ 2327 00ac 7DE0                ldi r23,lo8(13)\r
+ 2328 00ae 472E                mov r4,r23\r
+ 2329 00b0 512C                mov r5,__zero_reg__\r
+ 2330 00b2 4C0E                add r4,r28\r
+ 2331 00b4 5D1E                adc r5,r29\r
+ 2332                  .LVL226:\r
+ 2333                  .L163:\r
+ 2334                  .LBE32:\r
+ 2335                  .LBB41:\r
+ 2336                  .LBB23:\r
+ 2337                  .LSM200:\r
+ 2338 00b6 A9A1                ldd r26,Y+33\r
+ 2339 00b8 BAA1                ldd r27,Y+34\r
+ 2340                  .LVL227:\r
+ 2341 00ba FD01                movw r30,r26\r
+ 2342                  .LVL228:\r
+ 2343 00bc 8BE0                ldi r24,lo8(11)\r
+ 2344 00be 90E0                ldi r25,hi8(11)\r
+ 2345                  .LVL229:\r
+ 2346 00c0 00C0                rjmp .L122\r
+ 2347                  .LVL230:\r
+ 2348                  .L123:\r
+ 2349                  .LBB27:\r
+ 2350                  .LBB30:\r
+ 2351                  .LSM201:\r
+ 2352 00c2 6192                st Z+,r6\r
+ 2353                  .L122:\r
+ 2354 00c4 0197                sbiw r24,1\r
+ 2355 00c6 2FEF                ldi r18,hi8(-1)\r
+ 2356 00c8 8F3F                cpi r24,lo8(-1)\r
+ 2357 00ca 9207                cpc r25,r18\r
+ 2358 00cc 01F4                brne .L123\r
+ 2359 00ce 40E0                ldi r20,lo8(0)\r
+ 2360 00d0 50E0                ldi r21,hi8(0)\r
+ 2361                  .LVL231:\r
+ 2362 00d2 AA24                clr r10\r
+ 2363 00d4 BB24                clr r11\r
+ 2364 00d6 68E0                ldi r22,lo8(8)\r
+ 2365 00d8 E62E                mov r14,r22\r
+ 2366 00da F12C                mov r15,__zero_reg__\r
+ 2367 00dc 10E0                ldi r17,lo8(0)\r
+ 2368                  .LVL232:\r
+ 2369                  .L161:\r
+ 2370                  .LBE30:\r
+ 2371                  .LBE27:\r
+ 2372                  .LSM202:\r
+ 2373 00de F601                movw r30,r12\r
+ 2374 00e0 EA0D                add r30,r10\r
+ 2375 00e2 FB1D                adc r31,r11\r
+ 2376 00e4 2081                ld r18,Z\r
+ 2377 00e6 0894                sec\r
+ 2378 00e8 A11C                adc r10,__zero_reg__\r
+ 2379 00ea B11C                adc r11,__zero_reg__\r
+ 2380                  .LSM203:\r
+ 2381 00ec 2132                cpi r18,lo8(33)\r
+ 2382 00ee 00F4                brsh .+2\r
+ 2383 00f0 00C0                rjmp .L124\r
+ 2384 00f2 2F32                cpi r18,lo8(47)\r
+ 2385 00f4 01F4                brne .+2\r
+ 2386 00f6 00C0                rjmp .L125\r
+ 2387 00f8 2C35                cpi r18,lo8(92)\r
+ 2388 00fa 01F4                brne .+2\r
+ 2389 00fc 00C0                rjmp .L125\r
+ 2390                  .LSM204:\r
+ 2391 00fe 2E32                cpi r18,lo8(46)\r
+ 2392 0100 01F0                breq .L126\r
+ 2393 0102 4E15                cp r20,r14\r
+ 2394 0104 5F05                cpc r21,r15\r
+ 2395 0106 04F0                brlt .L127\r
+ 2396                  .L126:\r
+ 2397                  .LSM205:\r
+ 2398 0108 88E0                ldi r24,lo8(8)\r
+ 2399 010a E816                cp r14,r24\r
+ 2400 010c F104                cpc r15,__zero_reg__\r
+ 2401                  .LVL233:\r
+ 2402 010e 01F0                breq .+2\r
+ 2403 0110 00C0                rjmp .L128\r
+ 2404 0112 2E32                cpi r18,lo8(46)\r
+ 2405 0114 01F0                breq .+2\r
+ 2406 0116 00C0                rjmp .L128\r
+ 2407                  .LSM206:\r
+ 2408 0118 110F                lsl r17\r
+ 2409 011a 110F                lsl r17\r
+ 2410 011c 48E0                ldi r20,lo8(8)\r
+ 2411 011e 50E0                ldi r21,hi8(8)\r
+ 2412 0120 3BE0                ldi r19,lo8(11)\r
+ 2413 0122 E32E                mov r14,r19\r
+ 2414 0124 F12C                mov r15,__zero_reg__\r
+ 2415                  .LVL234:\r
+ 2416 0126 00C0                rjmp .L161\r
+ 2417                  .LVL235:\r
+ 2418                  .L127:\r
+ 2419                  .LSM207:\r
+ 2420 0128 27FD                sbrc r18,7\r
+ 2421                  .LSM208:\r
+ 2422 012a 1360                ori r17,lo8(3)\r
+ 2423                  .L130:\r
+ 2424                  .LSM209:\r
+ 2425 012c 822F                mov r24,r18\r
+ 2426                  .LVL236:\r
+ 2427 012e 8158                subi r24,lo8(-(127))\r
+ 2428 0130 8F31                cpi r24,lo8(31)\r
+ 2429 0132 00F0                brlo .L131\r
+ 2430 0134 8F55                subi r24,lo8(-(-95))\r
+ 2431 0136 8D31                cpi r24,lo8(29)\r
+ 2432 0138 00F4                brsh .L132\r
+ 2433                  .L131:\r
+ 2434                  .LSM210:\r
+ 2435 013a F601                movw r30,r12\r
+ 2436 013c EA0D                add r30,r10\r
+ 2437 013e FB1D                adc r31,r11\r
+ 2438 0140 3081                ld r19,Z\r
+ 2439                  .LSM211:\r
+ 2440 0142 832F                mov r24,r19\r
+ 2441 0144 8054                subi r24,lo8(-(-64))\r
+ 2442 0146 8F33                cpi r24,lo8(63)\r
+ 2443 0148 00F0                brlo .L133\r
+ 2444 014a 8054                subi r24,lo8(-(-64))\r
+ 2445 014c 8D37                cpi r24,lo8(125)\r
+ 2446 014e 00F0                brlo .+2\r
+ 2447 0150 00C0                rjmp .L128\r
+ 2448                  .L133:\r
+ 2449 0152 C701                movw r24,r14\r
+ 2450 0154 0197                sbiw r24,1\r
+ 2451 0156 4817                cp r20,r24\r
+ 2452 0158 5907                cpc r21,r25\r
+ 2453 015a 04F0                brlt .+2\r
+ 2454 015c 00C0                rjmp .L128\r
+ 2455                  .LSM212:\r
+ 2456 015e 0894                sec\r
+ 2457 0160 A11C                adc r10,__zero_reg__\r
+ 2458 0162 B11C                adc r11,__zero_reg__\r
+ 2459                  .LSM213:\r
+ 2460 0164 FD01                movw r30,r26\r
+ 2461 0166 E40F                add r30,r20\r
+ 2462 0168 F51F                adc r31,r21\r
+ 2463 016a 2083                st Z,r18\r
+ 2464 016c CA01                movw r24,r20\r
+ 2465 016e 0196                adiw r24,1\r
+ 2466                  .LVL237:\r
+ 2467                  .LSM214:\r
+ 2468 0170 FD01                movw r30,r26\r
+ 2469 0172 E80F                add r30,r24\r
+ 2470 0174 F91F                adc r31,r25\r
+ 2471 0176 3083                st Z,r19\r
+ 2472 0178 AC01                movw r20,r24\r
+ 2473 017a 00C0                rjmp .L164\r
+ 2474                  .LVL238:\r
+ 2475                  .L132:\r
+ 2476                  .LSM215:\r
+ 2477 017c 622F                mov r22,r18\r
+ 2478 017e 70E0                ldi r23,lo8(0)\r
+ 2479 0180 E0E0                ldi r30,lo8(.LC0)\r
+ 2480 0182 F0E0                ldi r31,hi8(.LC0)\r
+ 2481                  .LVL239:\r
+ 2482 0184 00C0                rjmp .L134\r
+ 2483                  .LVL240:\r
+ 2484                  .L136:\r
+ 2485                  .LBB25:\r
+ 2486                  .LBB26:\r
+ 2487                  .LSM216:\r
+ 2488 0186 3196                adiw r30,1\r
+ 2489                  .LVL241:\r
+ 2490                  .L134:\r
+ 2491 0188 8081                ld r24,Z\r
+ 2492 018a 8823                tst r24\r
+ 2493 018c 01F0                breq .L135\r
+ 2494 018e 90E0                ldi r25,lo8(0)\r
+ 2495                  .LVL242:\r
+ 2496 0190 8617                cp r24,r22\r
+ 2497 0192 9707                cpc r25,r23\r
+ 2498 0194 01F4                brne .L136\r
+ 2499 0196 00C0                rjmp .L128\r
+ 2500                  .LVL243:\r
+ 2501                  .L135:\r
+ 2502                  .LBE26:\r
+ 2503                  .LBE25:\r
+ 2504                  .LSM217:\r
+ 2505 0198 822F                mov r24,r18\r
+ 2506 019a 8154                subi r24,lo8(-(-65))\r
+ 2507 019c 8A31                cpi r24,lo8(26)\r
+ 2508 019e 00F4                brsh .L137\r
+ 2509                  .LSM218:\r
+ 2510 01a0 1260                ori r17,lo8(2)\r
+ 2511 01a2 00C0                rjmp .L138\r
+ 2512                  .L137:\r
+ 2513                  .LSM219:\r
+ 2514 01a4 822F                mov r24,r18\r
+ 2515 01a6 8156                subi r24,lo8(-(-97))\r
+ 2516 01a8 8A31                cpi r24,lo8(26)\r
+ 2517 01aa 00F4                brsh .L138\r
+ 2518                  .LSM220:\r
+ 2519 01ac 1160                ori r17,lo8(1)\r
+ 2520 01ae 2052                subi r18,lo8(-(-32))\r
+ 2521                  .L138:\r
+ 2522                  .LSM221:\r
+ 2523 01b0 FD01                movw r30,r26\r
+ 2524                  .LVL244:\r
+ 2525 01b2 E40F                add r30,r20\r
+ 2526 01b4 F51F                adc r31,r21\r
+ 2527 01b6 2083                st Z,r18\r
+ 2528                  .LVL245:\r
+ 2529                  .L164:\r
+ 2530 01b8 4F5F                subi r20,lo8(-(1))\r
+ 2531 01ba 5F4F                sbci r21,hi8(-(1))\r
+ 2532 01bc 00C0                rjmp .L161\r
+ 2533                  .LVL246:\r
+ 2534                  .L124:\r
+ 2535 01be 912F                mov r25,r17\r
+ 2536                  .LVL247:\r
+ 2537 01c0 64E0                ldi r22,lo8(4)\r
+ 2538                  .LVL248:\r
+ 2539                  .L158:\r
+ 2540                  .LSM222:\r
+ 2541 01c2 452B                or r20,r21\r
+ 2542 01c4 01F4                brne .+2\r
+ 2543 01c6 00C0                rjmp .L128\r
+ 2544                  .LSM223:\r
+ 2545 01c8 8C91                ld r24,X\r
+ 2546                  .LVL249:\r
+ 2547 01ca 853E                cpi r24,lo8(-27)\r
+ 2548 01cc 01F4                brne .L139\r
+ 2549 01ce 3C92                st X,r3\r
+ 2550                  .L139:\r
+ 2551                  .LSM224:\r
+ 2552 01d0 E8E0                ldi r30,lo8(8)\r
+ 2553 01d2 EE16                cp r14,r30\r
+ 2554 01d4 F104                cpc r15,__zero_reg__\r
+ 2555 01d6 01F4                brne .L140\r
+ 2556 01d8 912F                mov r25,r17\r
+ 2557 01da 990F                lsl r25\r
+ 2558 01dc 990F                lsl r25\r
+ 2559                  .LVL250:\r
+ 2560                  .L140:\r
+ 2561                  .LSM225:\r
+ 2562 01de 292F                mov r18,r25\r
+ 2563 01e0 30E0                ldi r19,lo8(0)\r
+ 2564                  .LVL251:\r
+ 2565 01e2 C901                movw r24,r18\r
+ 2566 01e4 8370                andi r24,lo8(3)\r
+ 2567 01e6 9070                andi r25,hi8(3)\r
+ 2568 01e8 0197                sbiw r24,1\r
+ 2569 01ea 01F4                brne .L141\r
+ 2570 01ec 6061                ori r22,lo8(16)\r
+ 2571                  .L141:\r
+ 2572                  .LSM226:\r
+ 2573 01ee 2C70                andi r18,lo8(12)\r
+ 2574 01f0 3070                andi r19,hi8(12)\r
+ 2575 01f2 2430                cpi r18,4\r
+ 2576 01f4 3105                cpc r19,__zero_reg__\r
+ 2577 01f6 01F4                brne .L142\r
+ 2578 01f8 6860                ori r22,lo8(8)\r
+ 2579                  .L142:\r
+ 2580                  .LSM227:\r
+ 2581 01fa 1B96                adiw r26,11\r
+ 2582 01fc 6C93                st X,r22\r
+ 2583                  .LBE23:\r
+ 2584                  .LBE41:\r
+ 2585                  .LBB42:\r
+ 2586                  .LSM228:\r
+ 2587 01fe C201                movw r24,r4\r
+ 2588 0200 60E0                ldi r22,lo8(0)\r
+ 2589 0202 70E0                ldi r23,hi8(0)\r
+ 2590                  .LVL252:\r
+ 2591 0204 0E94 0000           call dir_seek\r
+ 2592                  .LVL253:\r
+ 2593 0208 482F                mov r20,r24\r
+ 2594                  .LVL254:\r
+ 2595                  .LBB33:\r
+ 2596                  .LSM229:\r
+ 2597 020a 8823                tst r24\r
+ 2598 020c 01F0                breq .+2\r
+ 2599 020e 00C0                rjmp .L143\r
+ 2600                  .LVL255:\r
+ 2601                  .L162:\r
+ 2602                  .LBE33:\r
+ 2603                  .LSM230:\r
+ 2604 0210 4B8D                ldd r20,Y+27\r
+ 2605 0212 5C8D                ldd r21,Y+28\r
+ 2606 0214 6D8D                ldd r22,Y+29\r
+ 2607 0216 7E8D                ldd r23,Y+30\r
+ 2608                  .LVL256:\r
+ 2609 0218 8D85                ldd r24,Y+13\r
+ 2610 021a 9E85                ldd r25,Y+14\r
+ 2611                  .LVL257:\r
+ 2612 021c 0E94 0000           call move_window\r
+ 2613                  .LVL258:\r
+ 2614 0220 482F                mov r20,r24\r
+ 2615                  .LVL259:\r
+ 2616                  .LBB40:\r
+ 2617                  .LSM231:\r
+ 2618 0222 8823                tst r24\r
+ 2619 0224 01F0                breq .+2\r
+ 2620 0226 00C0                rjmp .L143\r
+ 2621                  .LVL260:\r
+ 2622                  .LSM232:\r
+ 2623 0228 EF8D                ldd r30,Y+31\r
+ 2624 022a F8A1                ldd r31,Y+32\r
+ 2625                  .LVL261:\r
+ 2626                  .LSM233:\r
+ 2627 022c 8081                ld r24,Z\r
+ 2628                  .LVL262:\r
+ 2629 022e 8823                tst r24\r
+ 2630 0230 01F4                brne .+2\r
+ 2631 0232 00C0                rjmp .L147\r
+ 2632                  .L144:\r
+ 2633                  .LSM234:\r
+ 2634 0234 8385                ldd r24,Z+11\r
+ 2635 0236 83FD                sbrc r24,3\r
+ 2636 0238 00C0                rjmp .L145\r
+ 2637 023a 89A1                ldd r24,Y+33\r
+ 2638                  .LVL263:\r
+ 2639 023c 9AA1                ldd r25,Y+34\r
+ 2640                  .LVL264:\r
+ 2641 023e 9C01                movw r18,r24\r
+ 2642                  .LVL265:\r
+ 2643 0240 D901                movw r26,r18\r
+ 2644                  .LVL266:\r
+ 2645 0242 2BE0                ldi r18,lo8(11)\r
+ 2646 0244 30E0                ldi r19,hi8(11)\r
+ 2647                  .LVL267:\r
+ 2648                  .L146:\r
+ 2649                  .LBB34:\r
+ 2650                  .LBB35:\r
+ 2651                  .LSM235:\r
+ 2652 0246 2150                subi r18,lo8(-(-1))\r
+ 2653 0248 3040                sbci r19,hi8(-(-1))\r
+ 2654 024a 8FEF                ldi r24,hi8(-1)\r
+ 2655 024c 2F3F                cpi r18,lo8(-1)\r
+ 2656 024e 3807                cpc r19,r24\r
+ 2657 0250 01F4                brne .+2\r
+ 2658 0252 00C0                rjmp .L143\r
+ 2659 0254 9081                ld r25,Z\r
+ 2660                  .LVL268:\r
+ 2661 0256 8C91                ld r24,X\r
+ 2662 0258 9817                cp r25,r24\r
+ 2663 025a 01F4                brne .L145\r
+ 2664 025c 3196                adiw r30,1\r
+ 2665                  .LVL269:\r
+ 2666 025e 1196                adiw r26,1\r
+ 2667 0260 00C0                rjmp .L146\r
+ 2668                  .LVL270:\r
+ 2669                  .L145:\r
+ 2670                  .LBE35:\r
+ 2671                  .LBE34:\r
+ 2672                  .LBB36:\r
+ 2673                  .LBB37:\r
+ 2674                  .LSM236:\r
+ 2675 0262 0989                ldd r16,Y+17\r
+ 2676 0264 1A89                ldd r17,Y+18\r
+ 2677 0266 0F5F                subi r16,lo8(-(1))\r
+ 2678 0268 1F4F                sbci r17,hi8(-(1))\r
+ 2679                  .LSM237:\r
+ 2680 026a 01F4                brne .+2\r
+ 2681 026c 00C0                rjmp .L147\r
+ 2682 026e 8B8D                ldd r24,Y+27\r
+ 2683 0270 9C8D                ldd r25,Y+28\r
+ 2684 0272 AD8D                ldd r26,Y+29\r
+ 2685 0274 BE8D                ldd r27,Y+30\r
+ 2686 0276 0097                sbiw r24,0\r
+ 2687 0278 A105                cpc r26,__zero_reg__\r
+ 2688 027a B105                cpc r27,__zero_reg__\r
+ 2689 027c 01F4                brne .+2\r
+ 2690 027e 00C0                rjmp .L147\r
+ 2691                  .LSM238:\r
+ 2692 0280 2FE0                ldi r18,lo8(15)\r
+ 2693 0282 E22E                mov r14,r18\r
+ 2694 0284 F12C                mov r15,__zero_reg__\r
+ 2695                  .LVL271:\r
+ 2696 0286 E022                and r14,r16\r
+ 2697 0288 F122                and r15,r17\r
+ 2698 028a E114                cp r14,__zero_reg__\r
+ 2699 028c F104                cpc r15,__zero_reg__\r
+ 2700 028e 01F0                breq .+2\r
+ 2701 0290 00C0                rjmp .L148\r
+ 2702                  .LSM239:\r
+ 2703 0292 0196                adiw r24,1\r
+ 2704 0294 A11D                adc r26,__zero_reg__\r
+ 2705 0296 B11D                adc r27,__zero_reg__\r
+ 2706 0298 8B8F                std Y+27,r24\r
+ 2707 029a 9C8F                std Y+28,r25\r
+ 2708 029c AD8F                std Y+29,r26\r
+ 2709 029e BE8F                std Y+30,r27\r
+ 2710                  .LSM240:\r
+ 2711 02a0 4F89                ldd r20,Y+23\r
+ 2712 02a2 588D                ldd r21,Y+24\r
+ 2713 02a4 698D                ldd r22,Y+25\r
+ 2714 02a6 7A8D                ldd r23,Y+26\r
+ 2715                  .LVL272:\r
+ 2716 02a8 ED85                ldd r30,Y+13\r
+ 2717 02aa FE85                ldd r31,Y+14\r
+ 2718                  .LVL273:\r
+ 2719 02ac 4115                cp r20,__zero_reg__\r
+ 2720 02ae 5105                cpc r21,__zero_reg__\r
+ 2721 02b0 6105                cpc r22,__zero_reg__\r
+ 2722 02b2 7105                cpc r23,__zero_reg__\r
+ 2723 02b4 01F4                brne .L149\r
+ 2724                  .LSM241:\r
+ 2725 02b6 8085                ldd r24,Z+8\r
+ 2726 02b8 9185                ldd r25,Z+9\r
+ 2727 02ba 0817                cp r16,r24\r
+ 2728 02bc 1907                cpc r17,r25\r
+ 2729 02be 00F0                brlo .L148\r
+ 2730 02c0 00C0                rjmp .L147\r
+ 2731                  .L149:\r
+ 2732                  .LSM242:\r
+ 2733 02c2 8281                ldd r24,Z+2\r
+ 2734 02c4 90E0                ldi r25,lo8(0)\r
+ 2735 02c6 0197                sbiw r24,1\r
+ 2736 02c8 9801                movw r18,r16\r
+ 2737 02ca A4E0                ldi r26,4\r
+ 2738 02cc 3695        1:      lsr r19\r
+ 2739 02ce 2795                ror r18\r
+ 2740 02d0 AA95                dec r26\r
+ 2741 02d2 01F4                brne 1b\r
+ 2742                  .LVL274:\r
+ 2743 02d4 8223                and r24,r18\r
+ 2744 02d6 9323                and r25,r19\r
+ 2745 02d8 892B                or r24,r25\r
+ 2746 02da 01F4                brne .L148\r
+ 2747                  .LBE37:\r
+ 2748                  .LSM243:\r
+ 2749 02dc CF01                movw r24,r30\r
+ 2750 02de 0E94 0000           call get_fat\r
+ 2751 02e2 AB01                movw r20,r22\r
+ 2752 02e4 BC01                movw r22,r24\r
+ 2753                  .LVL275:\r
+ 2754                  .LBB38:\r
+ 2755                  .LSM244:\r
+ 2756 02e6 4230                cpi r20,lo8(2)\r
+ 2757 02e8 5105                cpc r21,__zero_reg__\r
+ 2758 02ea 6105                cpc r22,__zero_reg__\r
+ 2759 02ec 7105                cpc r23,__zero_reg__\r
+ 2760 02ee 00F4                brsh .L150\r
+ 2761 02f0 42E0                ldi r20,lo8(2)\r
+ 2762                  .LVL276:\r
+ 2763 02f2 00C0                rjmp .L143\r
+ 2764                  .LVL277:\r
+ 2765                  .L150:\r
+ 2766                  .LSM245:\r
+ 2767 02f4 4F3F                cpi r20,lo8(-1)\r
+ 2768 02f6 9FEF                ldi r25,hi8(-1)\r
+ 2769 02f8 5907                cpc r21,r25\r
+ 2770 02fa 9FEF                ldi r25,hlo8(-1)\r
+ 2771 02fc 6907                cpc r22,r25\r
+ 2772 02fe 9FEF                ldi r25,hhi8(-1)\r
+ 2773 0300 7907                cpc r23,r25\r
+ 2774 0302 01F4                brne .L151\r
+ 2775 0304 41E0                ldi r20,lo8(1)\r
+ 2776                  .LVL278:\r
+ 2777 0306 00C0                rjmp .L143\r
+ 2778                  .LVL279:\r
+ 2779                  .L151:\r
+ 2780                  .LSM246:\r
+ 2781 0308 ED85                ldd r30,Y+13\r
+ 2782 030a FE85                ldd r31,Y+14\r
+ 2783 030c 8685                ldd r24,Z+14\r
+ 2784 030e 9785                ldd r25,Z+15\r
+ 2785 0310 A089                ldd r26,Z+16\r
+ 2786 0312 B189                ldd r27,Z+17\r
+ 2787 0314 4817                cp r20,r24\r
+ 2788 0316 5907                cpc r21,r25\r
+ 2789 0318 6A07                cpc r22,r26\r
+ 2790 031a 7B07                cpc r23,r27\r
+ 2791 031c 00F4                brsh .L147\r
+ 2792                  .LSM247:\r
+ 2793 031e 4F8B                std Y+23,r20\r
+ 2794 0320 588F                std Y+24,r21\r
+ 2795 0322 698F                std Y+25,r22\r
+ 2796 0324 7A8F                std Y+26,r23\r
+ 2797                  .LBE38:\r
+ 2798                  .LSM248:\r
+ 2799 0326 CF01                movw r24,r30\r
+ 2800 0328 0E94 0000           call clust2sect\r
+ 2801                  .LVL280:\r
+ 2802                  .LBB39:\r
+ 2803 032c 6B8F                std Y+27,r22\r
+ 2804 032e 7C8F                std Y+28,r23\r
+ 2805 0330 8D8F                std Y+29,r24\r
+ 2806 0332 9E8F                std Y+30,r25\r
+ 2807                  .LVL281:\r
+ 2808                  .L148:\r
+ 2809                  .LSM249:\r
+ 2810 0334 1A8B                std Y+18,r17\r
+ 2811 0336 098B                std Y+17,r16\r
+ 2812                  .LSM250:\r
+ 2813 0338 75E0                ldi r23,5\r
+ 2814 033a EE0C        1:      lsl r14\r
+ 2815 033c FF1C                rol r15\r
+ 2816 033e 7A95                dec r23\r
+ 2817 0340 01F4                brne 1b\r
+ 2818 0342 A2E2                ldi r26,lo8(34)\r
+ 2819 0344 B0E0                ldi r27,hi8(34)\r
+ 2820                  .LVL282:\r
+ 2821 0346 EA0E                add r14,r26\r
+ 2822 0348 FB1E                adc r15,r27\r
+ 2823 034a 8D85                ldd r24,Y+13\r
+ 2824 034c 9E85                ldd r25,Y+14\r
+ 2825 034e 8E0D                add r24,r14\r
+ 2826 0350 9F1D                adc r25,r15\r
+ 2827 0352 98A3                std Y+32,r25\r
+ 2828 0354 8F8F                std Y+31,r24\r
+ 2829 0356 00C0                rjmp .L162\r
+ 2830                  .LVL283:\r
+ 2831                  .L147:\r
+ 2832 0358 44E0                ldi r20,lo8(4)\r
+ 2833                  .LVL284:\r
+ 2834                  .L143:\r
+ 2835                  .LBE39:\r
+ 2836                  .LBE36:\r
+ 2837                  .LBE40:\r
+ 2838                  .LBE42:\r
+ 2839                  .LSM251:\r
+ 2840 035a E9A1                ldd r30,Y+33\r
+ 2841 035c FAA1                ldd r31,Y+34\r
+ 2842                  .LVL285:\r
+ 2843 035e 9385                ldd r25,Z+11\r
+ 2844                  .LVL286:\r
+ 2845 0360 9470                andi r25,lo8(4)\r
+ 2846                  .LSM252:\r
+ 2847 0362 4423                tst r20\r
+ 2848 0364 01F0                breq .L153\r
+ 2849 0366 842F                mov r24,r20\r
+ 2850                  .LSM253:\r
+ 2851 0368 4430                cpi r20,lo8(4)\r
+ 2852 036a 01F0                breq .+2\r
+ 2853 036c 00C0                rjmp .L115\r
+ 2854 036e 9923                tst r25\r
+ 2855 0370 01F4                brne .+2\r
+ 2856 0372 00C0                rjmp .L155\r
+ 2857 0374 00C0                rjmp .L115\r
+ 2858                  .L153:\r
+ 2859                  .LSM254:\r
+ 2860 0376 9923                tst r25\r
+ 2861 0378 01F4                brne .L156\r
+ 2862                  .LSM255:\r
+ 2863 037a EF8D                ldd r30,Y+31\r
+ 2864 037c F8A1                ldd r31,Y+32\r
+ 2865                  .LVL287:\r
+ 2866                  .LSM256:\r
+ 2867 037e 8385                ldd r24,Z+11\r
+ 2868 0380 84FF                sbrs r24,4\r
+ 2869 0382 00C0                rjmp .L155\r
+ 2870                  .LBB43:\r
+ 2871                  .LBB31:\r
+ 2872                  .LSM257:\r
+ 2873 0384 CA0C                add r12,r10\r
+ 2874 0386 DB1C                adc r13,r11\r
+ 2875                  .LBE31:\r
+ 2876                  .LBE43:\r
+ 2877                  .LSM258:\r
+ 2878 0388 8489                ldd r24,Z+20\r
+ 2879 038a 9589                ldd r25,Z+21\r
+ 2880 038c A0E0                ldi r26,lo8(0)\r
+ 2881 038e B0E0                ldi r27,hi8(0)\r
+ 2882                  .LVL288:\r
+ 2883 0390 DC01                movw r26,r24\r
+ 2884 0392 9927                clr r25\r
+ 2885 0394 8827                clr r24\r
+ 2886 0396 228D                ldd r18,Z+26\r
+ 2887 0398 338D                ldd r19,Z+27\r
+ 2888                  .LVL289:\r
+ 2889 039a 40E0                ldi r20,lo8(0)\r
+ 2890 039c 50E0                ldi r21,hi8(0)\r
+ 2891                  .LVL290:\r
+ 2892 039e 822B                or r24,r18\r
+ 2893 03a0 932B                or r25,r19\r
+ 2894 03a2 A42B                or r26,r20\r
+ 2895 03a4 B52B                or r27,r21\r
+ 2896 03a6 8B8B                std Y+19,r24\r
+ 2897 03a8 9C8B                std Y+20,r25\r
+ 2898 03aa AD8B                std Y+21,r26\r
+ 2899 03ac BE8B                std Y+22,r27\r
+ 2900 03ae 00C0                rjmp .L163\r
+ 2901                  .LVL291:\r
+ 2902                  .L160:\r
+ 2903                  .LSM259:\r
+ 2904 03b0 18A2                std Y+32,__zero_reg__\r
+ 2905 03b2 1F8E                std Y+31,__zero_reg__\r
+ 2906                  .LVL292:\r
+ 2907                  .L156:\r
+ 2908                  .LBE44:\r
+ 2909                  .LBE45:\r
+ 2910                  .LSM260:\r
+ 2911 03b4 EF8D                ldd r30,Y+31\r
+ 2912 03b6 F8A1                ldd r31,Y+32\r
+ 2913                  .LVL293:\r
+ 2914                  .LSM261:\r
+ 2915 03b8 3097                sbiw r30,0\r
+ 2916 03ba 01F4                brne .+2\r
+ 2917 03bc 00C0                rjmp .L157\r
+ 2918 03be 8385                ldd r24,Z+11\r
+ 2919                  .LVL294:\r
+ 2920 03c0 84FD                sbrc r24,4\r
+ 2921 03c2 00C0                rjmp .L157\r
+ 2922                  .LSM262:\r
+ 2923 03c4 B1E0                ldi r27,lo8(1)\r
+ 2924 03c6 7B22                and r7,r27\r
+ 2925 03c8 D401                movw r26,r8\r
+ 2926                  .LVL295:\r
+ 2927 03ca 1496                adiw r26,4\r
+ 2928 03cc 7C92                st X,r7\r
+ 2929                  .LSM263:\r
+ 2930 03ce 8489                ldd r24,Z+20\r
+ 2931 03d0 9589                ldd r25,Z+21\r
+ 2932 03d2 A0E0                ldi r26,lo8(0)\r
+ 2933 03d4 B0E0                ldi r27,hi8(0)\r
+ 2934 03d6 8C01                movw r16,r24\r
+ 2935 03d8 FF24                clr r15\r
+ 2936 03da EE24                clr r14\r
+ 2937                  .LVL296:\r
+ 2938 03dc 228D                ldd r18,Z+26\r
+ 2939 03de 338D                ldd r19,Z+27\r
+ 2940                  .LVL297:\r
+ 2941 03e0 40E0                ldi r20,lo8(0)\r
+ 2942 03e2 50E0                ldi r21,hi8(0)\r
+ 2943                  .LVL298:\r
+ 2944 03e4 E22A                or r14,r18\r
+ 2945 03e6 F32A                or r15,r19\r
+ 2946 03e8 042B                or r16,r20\r
+ 2947 03ea 152B                or r17,r21\r
+ 2948 03ec D401                movw r26,r8\r
+ 2949 03ee 1E96                adiw r26,14\r
+ 2950 03f0 ED92                st X+,r14\r
+ 2951 03f2 FD92                st X+,r15\r
+ 2952 03f4 0D93                st X+,r16\r
+ 2953 03f6 1C93                st X,r17\r
+ 2954 03f8 5197                sbiw r26,14+3\r
+ 2955                  .LSM264:\r
+ 2956 03fa 848D                ldd r24,Z+28\r
+ 2957 03fc 958D                ldd r25,Z+29\r
+ 2958 03fe A68D                ldd r26,Z+30\r
+ 2959 0400 B78D                ldd r27,Z+31\r
+ 2960 0402 F401                movw r30,r8\r
+ 2961                  .LVL299:\r
+ 2962 0404 8287                std Z+10,r24\r
+ 2963 0406 9387                std Z+11,r25\r
+ 2964 0408 A487                std Z+12,r26\r
+ 2965 040a B587                std Z+13,r27\r
+ 2966                  .LSM265:\r
+ 2967 040c D401                movw r26,r8\r
+ 2968 040e 1696                adiw r26,6\r
+ 2969 0410 1D92                st X+,__zero_reg__\r
+ 2970 0412 1D92                st X+,__zero_reg__\r
+ 2971 0414 1D92                st X+,__zero_reg__\r
+ 2972 0416 1C92                st X,__zero_reg__\r
+ 2973 0418 1997                sbiw r26,6+3\r
+ 2974 041a 8FEF                ldi r24,lo8(-1)\r
+ 2975 041c 1596                adiw r26,5\r
+ 2976 041e 8C93                st X,r24\r
+ 2977 0420 1597                sbiw r26,5\r
+ 2978                  .LSM266:\r
+ 2979 0422 168A                std Z+22,__zero_reg__\r
+ 2980 0424 178A                std Z+23,__zero_reg__\r
+ 2981 0426 108E                std Z+24,__zero_reg__\r
+ 2982 0428 118E                std Z+25,__zero_reg__\r
+ 2983                  .LSM267:\r
+ 2984 042a ED85                ldd r30,Y+13\r
+ 2985 042c FE85                ldd r31,Y+14\r
+ 2986 042e 1196                adiw r26,1\r
+ 2987 0430 FC93                st X,r31\r
+ 2988 0432 EE93                st -X,r30\r
+ 2989 0434 8681                ldd r24,Z+6\r
+ 2990 0436 9781                ldd r25,Z+7\r
+ 2991 0438 1396                adiw r26,2+1\r
+ 2992 043a 9C93                st X,r25\r
+ 2993 043c 8E93                st -X,r24\r
+ 2994 043e 1297                sbiw r26,2\r
+ 2995 0440 80E0                ldi r24,lo8(0)\r
+ 2996                  .LVL300:\r
+ 2997 0442 00C0                rjmp .L115\r
+ 2998                  .LVL301:\r
+ 2999                  .L157:\r
+ 3000                  .LSM268:\r
+ 3001 0444 84E0                ldi r24,lo8(4)\r
+ 3002                  .LVL302:\r
+ 3003                  .L115:\r
+ 3004                  .LVL303:\r
+ 3005                  /* epilogue start */\r
+ 3006                  .LSM269:\r
+ 3007 0446 A496                adiw r28,36\r
+ 3008 0448 0FB6                in __tmp_reg__,__SREG__\r
+ 3009 044a F894                cli\r
+ 3010 044c DEBF                out __SP_H__,r29\r
+ 3011 044e 0FBE                out __SREG__,__tmp_reg__\r
+ 3012 0450 CDBF                out __SP_L__,r28\r
+ 3013 0452 CF91                pop r28\r
+ 3014 0454 DF91                pop r29\r
+ 3015 0456 1F91                pop r17\r
+ 3016                  .LVL304:\r
+ 3017 0458 0F91                pop r16\r
+ 3018                  .LVL305:\r
+ 3019 045a FF90                pop r15\r
+ 3020 045c EF90                pop r14\r
+ 3021                  .LVL306:\r
+ 3022 045e DF90                pop r13\r
+ 3023 0460 CF90                pop r12\r
+ 3024                  .LVL307:\r
+ 3025 0462 BF90                pop r11\r
+ 3026 0464 AF90                pop r10\r
+ 3027                  .LVL308:\r
+ 3028 0466 9F90                pop r9\r
+ 3029 0468 8F90                pop r8\r
+ 3030                  .LVL309:\r
+ 3031 046a 7F90                pop r7\r
+ 3032                  .LVL310:\r
+ 3033 046c 6F90                pop r6\r
+ 3034 046e 5F90                pop r5\r
+ 3035 0470 4F90                pop r4\r
+ 3036 0472 3F90                pop r3\r
+ 3037 0474 0895                ret\r
+ 3038                  .LVL311:\r
+ 3039                  .L155:\r
+ 3040                  .LSM270:\r
+ 3041 0476 85E0                ldi r24,lo8(5)\r
+ 3042                  .LVL312:\r
+ 3043 0478 00C0                rjmp .L115\r
+ 3044                  .LVL313:\r
+ 3045                  .L128:\r
+ 3046 047a 86E0                ldi r24,lo8(6)\r
+ 3047                  .LVL314:\r
+ 3048 047c 00C0                rjmp .L115\r
+ 3049                  .LVL315:\r
+ 3050                  .L125:\r
+ 3051 047e 912F                mov r25,r17\r
+ 3052                  .LVL316:\r
+ 3053 0480 60E0                ldi r22,lo8(0)\r
+ 3054                  .LVL317:\r
+ 3055 0482 00C0                rjmp .L158\r
+ 3056                  .LFE70:\r
+ 3058                          .lcomm FatFs,2\r
+ 3059                          .lcomm Fsid,2\r
+ 3172                  .Letext0:\r
+DEFINED SYMBOLS\r
+                            *ABS*:00000000 ff.c\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:2      *ABS*:0000003f __SREG__\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:3      *ABS*:0000003e __SP_H__\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:4      *ABS*:0000003d __SP_L__\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:5      *ABS*:00000034 __CCP__\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:6      *ABS*:00000000 __tmp_reg__\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:7      *ABS*:00000001 __zero_reg__\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:19     .text.clust2sect:00000000 clust2sect\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:101    .text.f_mount:00000000 f_mount\r
+                             .bss:00000000 FatFs\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:144    .text.validate:00000000 validate\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:184    .text.f_close:00000000 f_close\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:218    .text.move_window:00000000 move_window\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:292    .text.get_fat:00000000 get_fat\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:545    .text.f_lseek:00000000 f_lseek\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:1021   .text.dir_seek:00000000 dir_seek\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:1270   .text.f_read:00000000 f_read\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:1694   .text.check_fs:00000000 check_fs\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:1779   .text.chk_mounted:00000000 chk_mounted\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:3058   .bss:00000002 Fsid\r
+C:\Users\Dean\AppData\Local\Temp/cchqutwM.s:2194   .text.f_open:00000000 f_open\r
+\r
+UNDEFINED SYMBOLS\r
+__mulsi3\r
+disk_status\r
+disk_read\r
+__udivmodsi4\r
+disk_initialize\r
+__do_copy_data\r
+__do_clear_bss\r
diff --git a/Projects/Webserver/Lib/FATFs/ffconf.h b/Projects/Webserver/Lib/FATFs/ffconf.h
new file mode 100644 (file)
index 0000000..4b19f13
--- /dev/null
@@ -0,0 +1,166 @@
+/*---------------------------------------------------------------------------/\r
+/  FatFs - FAT file system module configuration file  R0.07e  (C)ChaN, 2010\r
+/----------------------------------------------------------------------------/\r
+/\r
+/ CAUTION! Do not forget to make clean the project after any changes to\r
+/ the configuration options.\r
+/\r
+/----------------------------------------------------------------------------*/\r
+#ifndef _FFCONFIG\r
+#define _FFCONFIG 0x007E\r
+\r
+\r
+/*---------------------------------------------------------------------------/\r
+/ Function and Buffer Configurations\r
+/----------------------------------------------------------------------------*/\r
+\r
+#define        _FS_TINY        1               /* 0 or 1 */\r
+/* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system\r
+/  object instead of the sector buffer in the individual file object for file\r
+/  data transfer. This reduces memory consumption 512 bytes each file object. */\r
+\r
+\r
+#define _FS_READONLY   1       /* 0 or 1 */\r
+/* Setting _FS_READONLY to 1 defines read only configuration. This removes\r
+/  writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,\r
+/  f_truncate and useless f_getfree. */\r
+\r
+\r
+#define _FS_MINIMIZE   2       /* 0, 1, 2 or 3 */\r
+/* The _FS_MINIMIZE option defines minimization level to remove some functions.\r
+/\r
+/   0: Full function.\r
+/   1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename\r
+/      are removed.\r
+/   2: f_opendir and f_readdir are removed in addition to level 1.\r
+/   3: f_lseek is removed in addition to level 2. */\r
+\r
+\r
+#define        _USE_STRFUNC    0       /* 0, 1 or 2 */\r
+/* To enable string functions, set _USE_STRFUNC to 1 or 2. */\r
+\r
+\r
+#define        _USE_MKFS       0               /* 0 or 1 */\r
+/* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */\r
+\r
+\r
+#define        _USE_FORWARD    0       /* 0 or 1 */\r
+/* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */\r
+\r
+\r
+\r
+/*---------------------------------------------------------------------------/\r
+/ Locale and Namespace Configurations\r
+/----------------------------------------------------------------------------*/\r
+\r
+#define _CODE_PAGE     932\r
+/* The _CODE_PAGE specifies the OEM code page to be used on the target system.\r
+/  Incorrect setting of the code page can cause a file open failure.\r
+/\r
+/   932  - Japanese Shift-JIS (DBCS, OEM, Windows)\r
+/   936  - Simplified Chinese GBK (DBCS, OEM, Windows)\r
+/   949  - Korean (DBCS, OEM, Windows)\r
+/   950  - Traditional Chinese Big5 (DBCS, OEM, Windows)\r
+/   1250 - Central Europe (Windows)\r
+/   1251 - Cyrillic (Windows)\r
+/   1252 - Latin 1 (Windows)\r
+/   1253 - Greek (Windows)\r
+/   1254 - Turkish (Windows)\r
+/   1255 - Hebrew (Windows)\r
+/   1256 - Arabic (Windows)\r
+/   1257 - Baltic (Windows)\r
+/   1258 - Vietnam (OEM, Windows)\r
+/   437  - U.S. (OEM)\r
+/   720  - Arabic (OEM)\r
+/   737  - Greek (OEM)\r
+/   775  - Baltic (OEM)\r
+/   850  - Multilingual Latin 1 (OEM)\r
+/   858  - Multilingual Latin 1 + Euro (OEM)\r
+/   852  - Latin 2 (OEM)\r
+/   855  - Cyrillic (OEM)\r
+/   866  - Russian (OEM)\r
+/   857  - Turkish (OEM)\r
+/   862  - Hebrew (OEM)\r
+/   874  - Thai (OEM, Windows)\r
+/      1    - ASCII only (Valid for non LFN cfg.)\r
+*/\r
+\r
+\r
+#define        _USE_LFN        0               /* 0, 1 or 2 */\r
+#define        _MAX_LFN        255             /* Maximum LFN length to handle (12 to 255) */\r
+/* The _USE_LFN option switches the LFN support.\r
+/\r
+/   0: Disable LFN. _MAX_LFN and _LFN_UNICODE have no effect.\r
+/   1: Enable LFN with static working buffer on the bss. NOT REENTRANT.\r
+/   2: Enable LFN with dynamic working buffer on the STACK.\r
+/\r
+/  The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. When enable LFN,\r
+/  two Unicode handling functions ff_convert() and ff_wtoupper() must be added\r
+/  to the project. */\r
+\r
+\r
+#define        _LFN_UNICODE    0       /* 0 or 1 */\r
+/* To switch the character code set on FatFs API to Unicode,\r
+/  enable LFN feature and set _LFN_UNICODE to 1.\r
+*/\r
+\r
+\r
+#define _FS_RPATH      0               /* 0 or 1 */\r
+/* When _FS_RPATH is set to 1, relative path feature is enabled and f_chdir,\r
+/  f_chdrive function are available.\r
+/  Note that output of the f_readdir fnction is affected by this option. */\r
+\r
+\r
+\r
+/*---------------------------------------------------------------------------/\r
+/ Physical Drive Configurations\r
+/----------------------------------------------------------------------------*/\r
+\r
+#define _DRIVES                1\r
+/* Number of volumes (logical drives) to be used. */\r
+\r
+\r
+#define        _MAX_SS         512             /* 512, 1024, 2048 or 4096 */\r
+/* Maximum sector size to be handled.\r
+/  Always set 512 for memory card and hard disk but a larger value may be\r
+/  required for floppy disk (512/1024) and optical disk (512/2048).\r
+/  When _MAX_SS is larger than 512, GET_SECTOR_SIZE command must be implememted\r
+/  to the disk_ioctl function. */\r
+\r
+\r
+#define        _MULTI_PARTITION        0       /* 0 or 1 */\r
+/* When _MULTI_PARTITION is set to 0, each volume is bound to the same physical\r
+/ drive number and can mount only first primaly partition. When it is set to 1,\r
+/ each volume is tied to the partitions listed in Drives[]. */\r
+\r
+\r
+\r
+/*---------------------------------------------------------------------------/\r
+/ System Configurations\r
+/----------------------------------------------------------------------------*/\r
+\r
+#define _WORD_ACCESS   1       /* 0 or 1 */\r
+/* The _WORD_ACCESS option defines which access method is used to the word\r
+/  data on the FAT volume.\r
+/\r
+/   0: Byte-by-byte access. Always compatible with all platforms.\r
+/   1: Word access. Do not choose this unless following condition is met.\r
+/\r
+/  When the byte order on the memory is big-endian or address miss-aligned\r
+/  word access results incorrect behavior, the _WORD_ACCESS must be set to 0.\r
+/  If it is not the case, the value can also be set to 1 to improve the\r
+/  performance and code size. */\r
+\r
+\r
+#define _FS_REENTRANT  0               /* 0 or 1 */\r
+#define _FS_TIMEOUT            1000    /* Timeout period in unit of time ticks */\r
+#define        _SYNC_t                 HANDLE  /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */\r
+/* The _FS_REENTRANT option switches the reentrancy of the FatFs module.\r
+/\r
+/   0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.\r
+/   1: Enable reentrancy. Also user provided synchronization handlers,\r
+/      ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj\r
+/      function must be added to the project. */\r
+\r
+\r
+#endif /* _FFCONFIG */\r
diff --git a/Projects/Webserver/Lib/FATFs/integer.h b/Projects/Webserver/Lib/FATFs/integer.h
new file mode 100644 (file)
index 0000000..1d6bac3
--- /dev/null
@@ -0,0 +1,37 @@
+/*-------------------------------------------*/\r
+/* Integer type definitions for FatFs module */\r
+/*-------------------------------------------*/\r
+\r
+#ifndef _INTEGER\r
+\r
+#if 0\r
+#include <windows.h>\r
+#else\r
+\r
+/* These types must be 16-bit, 32-bit or larger integer */\r
+typedef int                            INT;\r
+typedef unsigned int   UINT;\r
+\r
+/* These types must be 8-bit integer */\r
+typedef signed char            CHAR;\r
+typedef unsigned char  UCHAR;\r
+typedef unsigned char  BYTE;\r
+\r
+/* These types must be 16-bit integer */\r
+typedef short                  SHORT;\r
+typedef unsigned short USHORT;\r
+typedef unsigned short WORD;\r
+typedef unsigned short WCHAR;\r
+\r
+/* These types must be 32-bit integer */\r
+typedef long                   LONG;\r
+typedef unsigned long  ULONG;\r
+typedef unsigned long  DWORD;\r
+\r
+/* Boolean type */\r
+typedef enum { FALSE = 0, TRUE } BOOL;\r
+\r
+#endif\r
+\r
+#define _INTEGER\r
+#endif\r
diff --git a/Projects/Webserver/Lib/HTTPServerApp.c b/Projects/Webserver/Lib/HTTPServerApp.c
new file mode 100644 (file)
index 0000000..01aab76
--- /dev/null
@@ -0,0 +1,177 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Simple HTTP Webserver Application. When connected to the uIP stack,\r
+ *  this will serve out files to HTTP clients.\r
+ */\r
\r
+#include "HTTPServerApp.h"\r
+\r
+/** HTTP server response header, for transmission before the page contents. This indicates to the host that a page exists at the\r
+ *  given location, and gives extra connection information.\r
+ */\r
+char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n"\r
+                               "Server: LUFA RNDIS\r\n"\r
+                               "Content-type: text/html\r\n"\r
+                               "Connection: close\r\n\r\n";\r
+\r
+/** HTTP server response header, for transmission before a resource not found error. This indicates to the host that the given\r
+ *  given URL is invalid, and gives extra error information.\r
+ */\r
+char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"\r
+                               "Server: LUFA RNDIS\r\n"\r
+                               "Connection: close\r\n\r\n"\r
+                                                          "The requested file was not found.";\r
+\r
+/** FAT Fs structure to hold the internal state of the FAT driver for the dataflash contents. */\r
+FATFS DiskFATState;\r
+\r
+/** Initialization function for the simple HTTP webserver. */\r
+void WebserverApp_Init(void)\r
+{\r
+       /* Listen on port 80 for HTTP connections from hosts */\r
+       uip_listen(HTONS(HTTP_SERVER_PORT));\r
+       \r
+       /* Mount the dataflash disk via FatFS */\r
+       f_mount(0, &DiskFATState);\r
+}\r
+\r
+/** uIP stack application callback for the simple HTTP webserver. This function must be called each time the\r
+ *  TCP/IP stack needs a TCP packet to be processed.\r
+ */\r
+void WebserverApp_Callback(void)\r
+{\r
+       uip_tcp_appstate_t* const AppState    = &uip_conn->appstate;\r
+       char*                     AppData     = (char*)uip_appdata;\r
+       uint16_t                  AppDataSize = 0;\r
+\r
+       if (uip_aborted() || uip_timedout())\r
+       {\r
+               /* Close the file before terminating, if it is open */\r
+               f_close(&AppState->FileToSend);\r
+\r
+               AppState->CurrentState = WEBSERVER_STATE_Closed;\r
+\r
+               return;\r
+       }\r
+       else if (uip_closed())\r
+       {\r
+               /* Completed connection, just return */\r
+               return;\r
+       }\r
+       else if (uip_connected())\r
+       {\r
+               /* New connection - initialize connection state and data pointer to the appropriate HTTP header */\r
+               AppState->CurrentState = WEBSERVER_STATE_OpenRequestedFile;\r
+       }\r
+       \r
+       switch (AppState->CurrentState)\r
+       {\r
+               case WEBSERVER_STATE_OpenRequestedFile:\r
+                       /* Wait for the packet containing the request header */\r
+                       if (uip_datalen())\r
+                       {\r
+                               /* Must be a GET request, abort otherwise */\r
+                               if (strncmp(AppData, "GET ", (sizeof("GET ") - 1)) != 0)\r
+                               {\r
+                                       uip_abort();\r
+                                       break;\r
+                               }\r
+               \r
+                               char FileName[13];\r
+\r
+                               /* Copy over the requested filename from the GET request */\r
+                               for (uint8_t i = 0; i < (sizeof(FileName) - 1); i++)\r
+                               {\r
+                                       FileName[i] = AppData[sizeof("GET ") + i];\r
+                                       \r
+                                       if (FileName[i] == ' ')\r
+                                       {\r
+                                               FileName[i] = 0x00;\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               \r
+                               /* Ensure requested filename is null-terminated */\r
+                               FileName[(sizeof(FileName) - 1)] = 0x00;\r
+                               \r
+                               /* If no filename specified, assume the default of INDEX.HTM */\r
+                               if (FileName[0] == 0x00)\r
+                                 strcpy(FileName, "INDEX.HTM");\r
+                               \r
+                               /* Try to open the file from the Dataflash disk */\r
+                               AppState->FileOpen = (f_open(&AppState->FileToSend, FileName, FA_OPEN_EXISTING | FA_READ) == FR_OK);\r
+\r
+                               AppState->CurrentState = WEBSERVER_STATE_SendHeaders;\r
+                       }\r
+\r
+                       break;\r
+               case WEBSERVER_STATE_SendHeaders:\r
+                       /* Determine what HTTP header should be sent to the client */\r
+                       if (AppState->FileOpen)\r
+                       {\r
+                               AppDataSize = strlen_P(HTTP200Header);\r
+                               strncpy_P(AppData, HTTP200Header, AppDataSize);                         \r
+                       }\r
+                       else\r
+                       {\r
+                               AppDataSize = strlen_P(HTTP404Header);\r
+                               strncpy_P(AppData, HTTP404Header, AppDataSize);                         \r
+                       }\r
+                       \r
+                       uip_send(AppData, AppDataSize);\r
+                       \r
+                       AppState->CurrentState = WEBSERVER_STATE_SendData;\r
+                       break;\r
+               case WEBSERVER_STATE_SendData:\r
+                       /* If end of file/file not open, progress to the close state */\r
+                       if (!(AppState->FileOpen))\r
+                       {\r
+                               f_close(&AppState->FileToSend);\r
+                               uip_close();\r
+                               AppState->CurrentState = WEBSERVER_STATE_Closed;\r
+                               break;\r
+                       }\r
+\r
+                       uint16_t MaxSegSize = uip_mss();\r
+                       \r
+                       /* Read the next chunk of data from the open file */\r
+                       f_read(&AppState->FileToSend, AppData, MaxSegSize, &AppDataSize);\r
+                       AppState->FileOpen = (MaxSegSize == AppDataSize);\r
+\r
+                       /* If data was read, send it to the client */\r
+                       if (AppDataSize)\r
+                         uip_send(AppData, AppDataSize);\r
+                                       \r
+                       break;\r
+       }\r
+}\r
diff --git a/Projects/Webserver/Lib/HTTPServerApp.h b/Projects/Webserver/Lib/HTTPServerApp.h
new file mode 100644 (file)
index 0000000..b96e2e3
--- /dev/null
@@ -0,0 +1,66 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Header file for HTTPServerApp.c.\r
+ */\r
+\r
+#ifndef _HTTPSERVER_APP_H_\r
+#define _HTTPSERVER_APP_H_\r
+\r
+       /* Includes: */\r
+               #include <avr/pgmspace.h>\r
+               #include <string.h>\r
+               \r
+               #include <LUFA/Version.h>\r
+               \r
+               #include <uip.h>\r
+               #include <ff.h>\r
+               \r
+       /* Enums: */\r
+               /** States for each HTTP connection to the webserver. */\r
+               enum Webserver_States_t\r
+               {\r
+                       WEBSERVER_STATE_OpenRequestedFile, /** Currently opening requested file */\r
+                       WEBSERVER_STATE_SendHeaders, /**< Currently sending HTTP headers to the client */\r
+                       WEBSERVER_STATE_SendData,    /**< Currently sending HTTP page data to the client */\r
+                       WEBSERVER_STATE_Closed,      /**< Connection closed after all data sent */\r
+               };\r
+       \r
+       /* Macros: */\r
+               /** TCP listen port for incomming HTTP traffic */\r
+               #define HTTP_SERVER_PORT  80\r
+\r
+       /* Function Prototypes: */\r
+               void WebserverApp_Init(void);\r
+               void WebserverApp_Callback(void);\r
+               \r
+#endif\r
diff --git a/Projects/Webserver/Lib/SCSI.c b/Projects/Webserver/Lib/SCSI.c
new file mode 100644 (file)
index 0000000..933253b
--- /dev/null
@@ -0,0 +1,281 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  SCSI command processing routines, for SCSI commands issued by the host. Mass Storage\r
+ *  devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,\r
+ *  which wrap around standard SCSI device commands for controlling the actual storage medium.\r
+ */\r
\r
+#define  INCLUDE_FROM_SCSI_C\r
+#include "SCSI.h"\r
+\r
+/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's\r
+ *  features and capabilities.\r
+ */\r
+SCSI_Inquiry_Response_t InquiryData = \r
+       {\r
+               .DeviceType          = DEVICE_TYPE_BLOCK,\r
+               .PeripheralQualifier = 0,\r
+                       \r
+               .Removable           = true,\r
+                       \r
+               .Version             = 0,\r
+                       \r
+               .ResponseDataFormat  = 2,\r
+               .NormACA             = false,\r
+               .TrmTsk              = false,\r
+               .AERC                = false,\r
+\r
+               .AdditionalLength    = 0x1F,\r
+                       \r
+               .SoftReset           = false,\r
+               .CmdQue              = false,\r
+               .Linked              = false,\r
+               .Sync                = false,\r
+               .WideBus16Bit        = false,\r
+               .WideBus32Bit        = false,\r
+               .RelAddr             = false,\r
+               \r
+               .VendorID            = "LUFA",\r
+               .ProductID           = "Dataflash Disk",\r
+               .RevisionID          = {'0','.','0','0'},\r
+       };\r
+\r
+/** Structure to hold the sense data for the last issued SCSI command, which is returned to the host after a SCSI REQUEST SENSE\r
+ *  command is issued. This gives information on exactly why the last command failed to complete.\r
+ */\r
+SCSI_Request_Sense_Response_t SenseData =\r
+       {\r
+               .ResponseCode        = 0x70,\r
+               .AdditionalLength    = 0x0A,\r
+       };\r
+\r
+\r
+/** Main routine to process the SCSI command located in the Command Block Wrapper read from the host. This dispatches\r
+ *  to the appropriate SCSI command handling routine if the issued command is supported by the device, else it returns\r
+ *  a command failure due to a ILLEGAL REQUEST.\r
+ *\r
+ *  \param[in] MSInterfaceInfo  Pointer to the Mass Storage class interface structure that the command is associated with\r
+ */\r
+bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* MSInterfaceInfo)\r
+{\r
+       /* Set initial sense data, before the requested command is processed */\r
+       SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,\r
+                      SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,\r
+                      SCSI_ASENSEQ_NO_QUALIFIER);\r
+                                          \r
+       /* Run the appropriate SCSI command hander function based on the passed command */\r
+       switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])\r
+       {\r
+               case SCSI_CMD_INQUIRY:\r
+                       SCSI_Command_Inquiry(MSInterfaceInfo);                  \r
+                       break;\r
+               case SCSI_CMD_REQUEST_SENSE:\r
+                       SCSI_Command_Request_Sense(MSInterfaceInfo);\r
+                       break;\r
+               case SCSI_CMD_READ_CAPACITY_10:\r
+                       SCSI_Command_Read_Capacity_10(MSInterfaceInfo);                 \r
+                       break;\r
+               case SCSI_CMD_SEND_DIAGNOSTIC:\r
+                       SCSI_Command_Send_Diagnostic(MSInterfaceInfo);\r
+                       break;\r
+               case SCSI_CMD_WRITE_10:\r
+                       SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_WRITE);\r
+                       break;\r
+               case SCSI_CMD_READ_10:\r
+                       SCSI_Command_ReadWrite_10(MSInterfaceInfo, DATA_READ);\r
+                       break;\r
+               case SCSI_CMD_TEST_UNIT_READY:\r
+               case SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL:\r
+               case SCSI_CMD_VERIFY_10:\r
+                       /* These commands should just succeed, no handling required */\r
+                       MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;\r
+                       break;\r
+               default:\r
+                       /* Update the SENSE key to reflect the invalid command */\r
+                       SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,\r
+                                  SCSI_ASENSE_INVALID_COMMAND,\r
+                                  SCSI_ASENSEQ_NO_QUALIFIER);\r
+                       break;\r
+       }\r
+\r
+       return (SenseData.SenseKey == SCSI_SENSE_KEY_GOOD);\r
+}\r
+\r
+/** Command processing for an issued SCSI INQUIRY command. This command returns information about the device's features\r
+ *  and capabilities to the host.\r
+ *\r
+ *  \param[in] MSInterfaceInfo  Pointer to the Mass Storage class interface structure that the command is associated with\r
+ */\r
+static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* MSInterfaceInfo)\r
+{\r
+       uint16_t AllocationLength  = (((uint16_t)MSInterfaceInfo->State.CommandBlock.SCSICommandData[3] << 8) |\r
+                                                MSInterfaceInfo->State.CommandBlock.SCSICommandData[4]);\r
+       uint16_t BytesTransferred  = (AllocationLength < sizeof(InquiryData))? AllocationLength :\r
+                                                                              sizeof(InquiryData);\r
+\r
+       /* Only the standard INQUIRY data is supported, check if any optional INQUIRY bits set */\r
+       if ((MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||\r
+            MSInterfaceInfo->State.CommandBlock.SCSICommandData[2])\r
+       {\r
+               /* Optional but unsupported bits set - update the SENSE key and fail the request */\r
+               SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,\r
+                              SCSI_ASENSE_INVALID_FIELD_IN_CDB,\r
+                              SCSI_ASENSEQ_NO_QUALIFIER);\r
+\r
+               return;\r
+       }\r
+       \r
+       Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);\r
+\r
+       uint8_t PadBytes[AllocationLength - BytesTransferred];\r
+       \r
+       /* Pad out remaining bytes with 0x00 */\r
+       Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);\r
+\r
+       /* Finalize the stream transfer to send the last packet */\r
+       Endpoint_ClearIN();\r
+\r
+       /* Succeed the command and update the bytes transferred counter */\r
+       MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;\r
+}\r
+\r
+/** Command processing for an issued SCSI REQUEST SENSE command. This command returns information about the last issued command,\r
+ *  including the error code and additional error information so that the host can determine why a command failed to complete.\r
+ *\r
+ *  \param[in] MSInterfaceInfo  Pointer to the Mass Storage class interface structure that the command is associated with\r
+ */\r
+static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* MSInterfaceInfo)\r
+{\r
+       uint8_t  AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];\r
+       uint8_t  BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);\r
+       \r
+       uint8_t PadBytes[AllocationLength - BytesTransferred];\r
+\r
+       Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);\r
+       Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);\r
+       Endpoint_ClearIN();\r
+\r
+       /* Succeed the command and update the bytes transferred counter */\r
+       MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;\r
+}\r
+\r
+/** Command processing for an issued SCSI READ CAPACITY (10) command. This command returns information about the device's capacity\r
+ *  on the selected Logical Unit (drive), as a number of OS-sized blocks.\r
+ *\r
+ *  \param[in] MSInterfaceInfo  Pointer to the Mass Storage class interface structure that the command is associated with\r
+ */\r
+static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* MSInterfaceInfo)\r
+{\r
+       uint32_t LastBlockAddressInLUN = (VIRTUAL_MEMORY_BLOCKS - 1);\r
+       uint32_t MediaBlockSize        = VIRTUAL_MEMORY_BLOCK_SIZE;\r
+\r
+       Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);\r
+       Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);\r
+       Endpoint_ClearIN();\r
+       \r
+       /* Succeed the command and update the bytes transferred counter */\r
+       MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;\r
+}\r
+\r
+/** Command processing for an issued SCSI SEND DIAGNOSTIC command. This command performs a quick check of the Dataflash ICs on the\r
+ *  board, and indicates if they are present and functioning correctly. Only the Self-Test portion of the diagnostic command is\r
+ *  supported.\r
+ *\r
+ *  \param[in] MSInterfaceInfo  Pointer to the Mass Storage class interface structure that the command is associated with\r
+ */\r
+static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* MSInterfaceInfo)\r
+{\r
+       /* Check to see if the SELF TEST bit is not set */\r
+       if (!(MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & (1 << 2)))\r
+       {\r
+               /* Only self-test supported - update SENSE key and fail the command */\r
+               SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,\r
+                              SCSI_ASENSE_INVALID_FIELD_IN_CDB,\r
+                              SCSI_ASENSEQ_NO_QUALIFIER);\r
+\r
+               return;\r
+       }\r
+       \r
+       /* Check to see if all attached Dataflash ICs are functional */\r
+       if (!(DataflashManager_CheckDataflashOperation()))\r
+       {\r
+               /* Update SENSE key with a hardware error condition and return command fail */\r
+               SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,\r
+                              SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,\r
+                              SCSI_ASENSEQ_NO_QUALIFIER);      \r
+       \r
+               return;\r
+       }\r
+       \r
+       /* Succeed the command and update the bytes transferred counter */\r
+       MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;\r
+}\r
+\r
+/** Command processing for an issued SCSI READ (10) or WRITE (10) command. This command reads in the block start address\r
+ *  and total number of blocks to process, then calls the appropriate low-level dataflash routine to handle the actual\r
+ *  reading and writing of the data.\r
+ *\r
+ *  \param[in] MSInterfaceInfo  Pointer to the Mass Storage class interface structure that the command is associated with\r
+ *  \param[in] IsDataRead  Indicates if the command is a READ (10) command or WRITE (10) command (DATA_READ or DATA_WRITE)\r
+ */\r
+static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, const bool IsDataRead)\r
+{\r
+       uint32_t BlockAddress;\r
+       uint16_t TotalBlocks;\r
+       \r
+       /* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */\r
+       BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);\r
+\r
+       /* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */\r
+       TotalBlocks  = SwapEndian_16(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);\r
+       \r
+       /* Check if the block address is outside the maximum allowable value for the LUN */\r
+       if (BlockAddress >= VIRTUAL_MEMORY_BLOCKS)\r
+       {\r
+               /* Block address is invalid, update SENSE key and return command fail */\r
+               SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,\r
+                              SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE,\r
+                              SCSI_ASENSEQ_NO_QUALIFIER);\r
+\r
+               return;\r
+       }\r
+       \r
+       /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */\r
+       if (IsDataRead == DATA_READ)\r
+         DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);\r
+       else\r
+         DataflashManager_WriteBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);\r
+\r
+       /* Update the bytes transferred counter and succeed the command */\r
+       MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);\r
+}\r
diff --git a/Projects/Webserver/Lib/SCSI.h b/Projects/Webserver/Lib/SCSI.h
new file mode 100644 (file)
index 0000000..aa7d932
--- /dev/null
@@ -0,0 +1,85 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Header file for SCSI.c.\r
+ */\r
\r
+#ifndef _SCSI_H_\r
+#define _SCSI_H_\r
+\r
+       /* Includes: */\r
+               #include <avr/io.h>\r
+               #include <avr/pgmspace.h>\r
+\r
+               #include <LUFA/Drivers/USB/USB.h>\r
+               #include <LUFA/Drivers/USB/Class/MassStorage.h>\r
+
+               #include "../Descriptors.h"\r
+               #include "DataflashManager.h"\r
+       \r
+       /* Macros: */\r
+               /** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This\r
+                *  is for convenience, as it allows for all three sense values (returned upon request to the host to give information about\r
+                *  the last command failure) in a quick and easy manner.\r
+                *\r
+                *  \param[in] key    New SCSI sense key to set the sense code to\r
+                *  \param[in] acode  New SCSI additional sense key to set the additional sense code to\r
+                *  \param[in] aqual  New SCSI additional sense key qualifier to set the additional sense qualifier code to\r
+                */\r
+               #define SCSI_SET_SENSE(key, acode, aqual)  MACROS{ SenseData.SenseKey = (key);                   \\r
+                                                                  SenseData.AdditionalSenseCode = (acode);      \\r
+                                                                  SenseData.AdditionalSenseQualifier = (aqual); }MACROE\r
+\r
+               /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be read from the storage medium. */\r
+               #define DATA_READ           true\r
+\r
+               /** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be written to the storage medium. */\r
+               #define DATA_WRITE          false\r
+\r
+               /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */\r
+               #define DEVICE_TYPE_BLOCK   0x00\r
+               \r
+               /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */\r
+               #define DEVICE_TYPE_CDROM   0x05\r
+               \r
+       /* Function Prototypes: */\r
+               bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);\r
+               \r
+               #if defined(INCLUDE_FROM_SCSI_C)\r
+                       static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);\r
+                       static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);\r
+                       static void SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);\r
+                       static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);\r
+                       static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, const bool IsDataRead);\r
+               #endif\r
+               \r
+#endif\r
diff --git a/Projects/Webserver/Lib/WebserverApp.c b/Projects/Webserver/Lib/WebserverApp.c
deleted file mode 100644 (file)
index 02f38be..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*\r
-             LUFA Library\r
-     Copyright (C) Dean Camera, 2010.\r
-              \r
-  dean [at] fourwalledcubicle [dot] com\r
-      www.fourwalledcubicle.com\r
-*/\r
-\r
-/*\r
-  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
-  Permission to use, copy, modify, distribute, and sell this \r
-  software and its documentation for any purpose is hereby granted\r
-  without fee, provided that the above copyright notice appear in \r
-  all copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting \r
-  documentation, and that the name of the author not be used in \r
-  advertising or publicity pertaining to distribution of the \r
-  software without specific, written prior permission.\r
-\r
-  The author disclaim all warranties with regard to this\r
-  software, including all implied warranties of merchantability\r
-  and fitness.  In no event shall the author be liable for any\r
-  special, indirect or consequential damages or any damages\r
-  whatsoever resulting from loss of use, data or profits, whether\r
-  in an action of contract, negligence or other tortious action,\r
-  arising out of or in connection with the use or performance of\r
-  this software.\r
-*/\r
-\r
-/** \file\r
- *\r
- *  Simple HTTP Webserver Application. When connected to the uIP stack,\r
- *  this will serve out files to HTTP clients.\r
- */\r
\r
-#include "WebserverApp.h"\r
-\r
-/** HTTP server response header, for transmission before the page contents. This indicates to the host that a page exists at the\r
- *  given location, and gives extra connection information.\r
- */\r
-char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n"\r
-                               "Server: LUFA RNDIS\r\n"\r
-                               "Content-type: text/html\r\n"\r
-                               "Connection: close\r\n\r\n";\r
-\r
-/** HTTP server response header, for transmission before a resource not found error. This indicates to the host that the given\r
- *  given URL is invalid, and gives extra error information.\r
- */\r
-char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"\r
-                               "Server: LUFA RNDIS\r\n"\r
-                               "Connection: close\r\n\r\n";\r
-\r
-/** Static HTTP page to serve to the host when a HTTP request is made from a host. */\r
-char PROGMEM HTTPPage[]   = \r
-               "<html>"\r
-               "       <head>"\r
-               "               <title>"\r
-               "                       LUFA Webserver Demo"\r
-               "               </title>"\r
-               "       </head>"\r
-               "       <body>"\r
-               "               <h1>Hello from your USB AVR!</h1>"\r
-               "               <p>"\r
-               "                       Hello! Welcome to the LUFA RNDIS Demo Webserver test page, running on your USB AVR via the LUFA library and uIP TCP/IP network stack. This"\r
-               "           demonstrates a simple HTTP webserver serving out pages to HTTP clients."\r
-               "                       <br /><br />"\r
-               "                       <small>Project Information: <a href=\"http://www.fourwalledcubicle.com/LUFA.php\">http://www.fourwalledcubicle.com/LUFA.php</a>.</small>"\r
-               "                       <hr />"\r
-               "                       <i>LUFA Version: </i>" LUFA_VERSION_STRING\r
-               "               </p>"\r
-               "       </body>"\r
-               "</html>";\r
-\r
-/** Initialization function for the simple HTTP webserver. */\r
-void WebserverApp_Init(void)\r
-{\r
-       /* Listen on port 80 for HTTP connections from hosts */\r
-       uip_listen(HTONS(HTTP_SERVER_PORT));\r
-}\r
-\r
-/** uIP stack application callback for the simple HTTP webserver. This function must be called each time the\r
- *  TCP/IP stack needs a TCP packet to be processed.\r
- */\r
-void WebserverApp_Callback(void)\r
-{\r
-       uip_tcp_appstate_t* const AppState    = &uip_conn->appstate;\r
-       char*                     AppData     = (char*)uip_appdata;\r
-       uint16_t                  AppDataSize = 0;\r
-\r
-       if (uip_closed() || uip_aborted() || uip_timedout())\r
-       {\r
-               /* Terminated or completed connection - don't send any new data */\r
-               return;\r
-       }\r
-       else if (uip_connected())\r
-       {\r
-               /* New connection - initialize connection state and data pointer to the appropriate HTTP header */\r
-               AppState->SendPos      = HTTP200Header;\r
-               AppState->CurrentState = WEBSERVER_STATE_SendHeaders;\r
-       }\r
-\r
-       /* Calculate the maximum segment size and remaining data size */\r
-       uint16_t BytesRemaining = strlen_P(AppState->SendPos);\r
-       uint16_t MaxSegSize     = uip_mss();\r
-\r
-       /* No more bytes remaining in the current data being sent - progress to next data chunk or\r
-        * terminate the connection once all chunks are sent */\r
-       if (!(BytesRemaining))\r
-       {\r
-               /* Check which data chunk we are currently sending (header or data) */\r
-               if (AppState->CurrentState == WEBSERVER_STATE_SendHeaders)\r
-               {\r
-                       AppState->SendPos = HTTPPage;\r
-                       AppState->CurrentState = WEBSERVER_STATE_SendData;                      \r
-               }\r
-               else if (AppState->CurrentState == WEBSERVER_STATE_SendData)\r
-               {\r
-                       uip_close();\r
-                       AppState->CurrentState = WEBSERVER_STATE_Closed;\r
-               }\r
-                 \r
-               return;\r
-       }\r
-       else if (BytesRemaining > MaxSegSize)\r
-       {\r
-               /* More bytes remaining to send than the maximum segment size, send next chunk */\r
-               AppDataSize = MaxSegSize;\r
-       }\r
-       else\r
-       {\r
-               /* Less bytes than the segment size remaining, send all remaining bytes in the one packet */\r
-               AppDataSize = BytesRemaining;\r
-       }\r
-\r
-       /* Copy over the next data segment to the application buffer, advance send position pointer */\r
-       strncpy_P(AppData, AppState->SendPos, AppDataSize);\r
-       AppState->SendPos += AppDataSize;\r
-\r
-       /* Send the data to the requesting host */\r
-       uip_send(AppData, AppDataSize);\r
-}\r
diff --git a/Projects/Webserver/Lib/WebserverApp.h b/Projects/Webserver/Lib/WebserverApp.h
deleted file mode 100644 (file)
index c788bdb..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*\r
-             LUFA Library\r
-     Copyright (C) Dean Camera, 2010.\r
-              \r
-  dean [at] fourwalledcubicle [dot] com\r
-      www.fourwalledcubicle.com\r
-*/\r
-\r
-/*\r
-  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
-  Permission to use, copy, modify, distribute, and sell this \r
-  software and its documentation for any purpose is hereby granted\r
-  without fee, provided that the above copyright notice appear in \r
-  all copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting \r
-  documentation, and that the name of the author not be used in \r
-  advertising or publicity pertaining to distribution of the \r
-  software without specific, written prior permission.\r
-\r
-  The author disclaim all warranties with regard to this\r
-  software, including all implied warranties of merchantability\r
-  and fitness.  In no event shall the author be liable for any\r
-  special, indirect or consequential damages or any damages\r
-  whatsoever resulting from loss of use, data or profits, whether\r
-  in an action of contract, negligence or other tortious action,\r
-  arising out of or in connection with the use or performance of\r
-  this software.\r
-*/\r
-\r
-/** \file\r
- *\r
- *  Header file for WebserverApp.c.\r
- */\r
-\r
-#ifndef _WEBSERVER_APP_H_\r
-#define _WEBSERVER_APP_H_\r
-\r
-       /* Includes: */\r
-               #include <stdio.h>\r
-               #include <avr/pgmspace.h>\r
-               \r
-               #include <LUFA/Version.h>\r
-               \r
-               #include <uip.h>\r
-               \r
-       /* Enums: */\r
-               /** States for each HTTP connection to the webserver. */\r
-               enum Webserver_States_t\r
-               {\r
-                       WEBSERVER_STATE_SendHeaders, /**< Currently sending HTTP headers to the client */\r
-                       WEBSERVER_STATE_SendData,    /**< Currently sending HTTP page data to the client */\r
-                       WEBSERVER_STATE_Closed,      /**< Connection closed after all data sent */\r
-               };\r
-       \r
-       /* Macros: */\r
-               /** TCP listen port for incomming HTTP traffic */\r
-               #define HTTP_SERVER_PORT  80\r
-\r
-       /* Function Prototypes: */\r
-               void WebserverApp_Init(void);\r
-               void WebserverApp_Callback(void);\r
-               \r
-#endif\r
diff --git a/Projects/Webserver/Lib/uIPManagement.c b/Projects/Webserver/Lib/uIPManagement.c
new file mode 100644 (file)
index 0000000..dd9f15f
--- /dev/null
@@ -0,0 +1,189 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  uIP Managament functions. This file contains the functions and globals needed to maintain the uIP\r
+ *  stack once an RNDIS device has been attached to the system.\r
+ */\r
+\r
+#define  INCLUDE_FROM_UIPMANAGEMENT_C\r
+#include "uIPManagement.h"\r
+\r
+/** Connection timer, to retain the time elapsed since the last time the uIP connections were managed. */\r
+struct timer ConnectionTimer;\r
+\r
+/** ARP timer, to retain the time elapsed since the ARP cache was last updated. */\r
+struct timer ARPTimer;\r
+\r
+/** MAC address of the RNDIS device, when enumerated */\r
+struct uip_eth_addr MACAddress;\r
+\r
+\r
+/** Configures the uIP stack ready for network traffic. */\r
+void uIPManagement_Init(void)\r
+{\r
+       /* uIP Timing Initialization */\r
+       clock_init();\r
+       timer_set(&ConnectionTimer, CLOCK_SECOND / 2);\r
+       timer_set(&ARPTimer, CLOCK_SECOND * 10);        \r
+\r
+       /* uIP Stack Initialization */\r
+       uip_init();\r
+\r
+       /* DHCP/Server IP Settings Initialization */\r
+       #if defined(ENABLE_DHCP)\r
+       DHCPApp_Init();\r
+       #else\r
+       uip_ipaddr_t IPAddress, Netmask, GatewayIPAddress;\r
+       uip_ipaddr(&IPAddress,        DEVICE_IP_ADDRESS[0], DEVICE_IP_ADDRESS[1], DEVICE_IP_ADDRESS[2], DEVICE_IP_ADDRESS[3]);\r
+       uip_ipaddr(&Netmask,          DEVICE_NETMASK[0],    DEVICE_NETMASK[1],    DEVICE_NETMASK[2],    DEVICE_NETMASK[3]);\r
+       uip_ipaddr(&GatewayIPAddress, DEVICE_GATEWAY[0],    DEVICE_GATEWAY[1],    DEVICE_GATEWAY[2],    DEVICE_GATEWAY[3]);\r
+       uip_sethostaddr(&IPAddress);\r
+       uip_setnetmask(&Netmask);\r
+       uip_setdraddr(&GatewayIPAddress);\r
+       #endif\r
+\r
+       uip_setethaddr(MACAddress);\r
+       \r
+       /* HTTP Webserver Initialization */\r
+       WebserverApp_Init();\r
+}\r
+\r
+/** uIP Management function. This function manages the uIP stack when called while an RNDIS device has been\r
+ *  attached to the system.\r
+ */\r
+void uIPManagement_ManageNetwork(void)\r
+{\r
+       if ((USB_CurrentMode == USB_MODE_HOST) && (USB_HostState == HOST_STATE_Configured))\r
+       {\r
+               uIPManagement_ProcessIncommingPacket();\r
+               uIPManagement_ManageConnections();\r
+       }\r
+}\r
+\r
+/** Processes incomming packets to the server from the connected RNDIS device, creating responses as needed. */\r
+static void uIPManagement_ProcessIncommingPacket(void)\r
+{\r
+       if (RNDIS_Host_IsPacketReceived(&Ethernet_RNDIS_Interface))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_BUSY);\r
+\r
+               /* Read the incomming packet straight into the UIP packet buffer */\r
+               RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, &uip_buf[0], &uip_len);\r
+\r
+               if (uip_len > 0)\r
+               {\r
+                       bool PacketHandled = true;\r
+\r
+                       struct uip_eth_hdr* EthernetHeader = (struct uip_eth_hdr*)&uip_buf[0];\r
+                       if (EthernetHeader->type == HTONS(UIP_ETHTYPE_IP))\r
+                       {\r
+                               /* Filter packet by MAC destination */\r
+                               uip_arp_ipin();\r
+\r
+                               /* Process incomming packet */\r
+                               uip_input();\r
+\r
+                               /* Add destination MAC to outgoing packet */\r
+                               if (uip_len > 0)\r
+                                 uip_arp_out();\r
+                       }\r
+                       else if (EthernetHeader->type == HTONS(UIP_ETHTYPE_ARP))\r
+                       {\r
+                               /* Process ARP packet */\r
+                               uip_arp_arpin();\r
+                       }\r
+                       else\r
+                       {\r
+                               PacketHandled = false;\r
+                       }\r
+\r
+                       /* If a response was generated, send it */\r
+                       if ((uip_len > 0) && PacketHandled)\r
+                         RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, &uip_buf[0], uip_len);\r
+               }\r
+\r
+               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+       }\r
+}\r
+\r
+/** Manages the currently open network connections, including TCP and (if enabled) UDP. */\r
+static void uIPManagement_ManageConnections(void)\r
+{\r
+       /* Manage open connections */\r
+       if (timer_expired(&ConnectionTimer))\r
+       {\r
+               timer_reset(&ConnectionTimer);\r
+\r
+               LEDs_SetAllLEDs(LEDMASK_USB_BUSY);\r
+               \r
+               for (uint8_t i = 0; i < UIP_CONNS; i++)\r
+               {\r
+                       /* Run periodic connection management for each TCP connection */\r
+                       uip_periodic(i);\r
+\r
+                       /* If a response was generated, send it */\r
+                       if (uip_len > 0)\r
+                       {\r
+                               /* Add destination MAC to outgoing packet */\r
+                               uip_arp_out();\r
+\r
+                               RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, &uip_buf[0], uip_len);\r
+                       }\r
+               }\r
+               \r
+               #if defined(ENABLE_DHCP)\r
+               for (uint8_t i = 0; i < UIP_UDP_CONNS; i++)\r
+               {\r
+                       /* Run periodic connection management for each UDP connection */\r
+                       uip_udp_periodic(i);\r
+\r
+                       /* If a response was generated, send it */\r
+                       if (uip_len > 0)\r
+                       {\r
+                               /* Add destination MAC to outgoing packet */\r
+                               uip_arp_out();\r
+\r
+                               RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, &uip_buf[0], uip_len);\r
+                       }\r
+               }\r
+               #endif\r
+\r
+               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+       }\r
+\r
+       /* Manage ARP cache refreshing */\r
+       if (timer_expired(&ARPTimer))\r
+       {\r
+               timer_reset(&ARPTimer);\r
+               uip_arp_timer();\r
+       }\r
+}\r
diff --git a/Projects/Webserver/Lib/uIPManagement.h b/Projects/Webserver/Lib/uIPManagement.h
new file mode 100644 (file)
index 0000000..2488155
--- /dev/null
@@ -0,0 +1,73 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Header file for uIPManagement.c.\r
+ */\r
+\r
+#ifndef _UIPMANAGEMENT_H_\r
+#define _UIPMANAGEMENT_H_\r
+\r
+       /* Includes: */\r
+               #include <LUFA/Drivers/USB/Class/RNDIS.h>\r
+\r
+               #include <uip.h>\r
+               #include <uip_arp.h>\r
+               #include <timer.h>\r
+               \r
+               #include "Lib/DHCPApp.h"\r
+               #include "Lib/HTTPServerApp.h"\r
+               \r
+       /* Macros: */\r
+               /** IP address that the webserver should use once connected to a RNDIS device (when DHCP is disabled). */\r
+               #define DEVICE_IP_ADDRESS         (uint8_t[]){192, 168, 1, 10}\r
+               \r
+               /** Netmask that the webserver should once connected to a RNDIS device (when DHCP is disabled). */\r
+               #define DEVICE_NETMASK            (uint8_t[]){255, 255, 255, 0}\r
+               \r
+               /** IP address of the default gateway the webserver should use when routing outside the local subnet\r
+                *  (when DHCP is disabled).\r
+                */\r
+               #define DEVICE_GATEWAY            (uint8_t[]){192, 168, 1, 1}\r
+\r
+       /* External Variables: */\r
+               extern struct uip_eth_addr MACAddress;\r
+               \r
+       /* Function Prototypes: */\r
+               void uIPManagement_Init(void);\r
+               void uIPManagement_ManageNetwork(void);\r
+               \r
+               #if defined(INCLUDE_FROM_UIPMANAGEMENT_C)\r
+                       static void uIPManagement_ProcessIncommingPacket(void);\r
+                       static void uIPManagement_ManageConnections(void);\r
+               #endif\r
+               \r
+#endif\r
index fc9727d..76cd937 100644 (file)
@@ -1,10 +1,13 @@
 #ifndef __APPS_CONF_H__\r
 #define __APPS_CONF_H__\r
 \r
 #ifndef __APPS_CONF_H__\r
 #define __APPS_CONF_H__\r
 \r
+       #include <ff.h>\r
+\r
        typedef struct\r
        {\r
                uint8_t CurrentState;\r
        typedef struct\r
        {\r
                uint8_t CurrentState;\r
-               char*   SendPos;\r
+               FIL     FileToSend;\r
+               bool    FileOpen;\r
        } uip_tcp_appstate_t;\r
 \r
        typedef struct\r
        } uip_tcp_appstate_t;\r
 \r
        typedef struct\r
diff --git a/Projects/Webserver/USBDeviceMode.c b/Projects/Webserver/USBDeviceMode.c
new file mode 100644 (file)
index 0000000..c93ba46
--- /dev/null
@@ -0,0 +1,113 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  USB Device Mode management functions and variables. This file contains the LUFA code required to\r
+ *  manage the USB Mass Storage device mode.\r
+ */\r
\r
+#include "USBDeviceMode.h"\r
+\r
+/** LUFA Mass Storage Class driver interface configuration and state information. This structure is\r
+ *  passed to all Mass Storage Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
+USB_ClassInfo_MS_Device_t Disk_MS_Interface =\r
+       {\r
+               .Config =\r
+                       {\r
+                               .InterfaceNumber           = 0,\r
+\r
+                               .DataINEndpointNumber      = MASS_STORAGE_IN_EPNUM,\r
+                               .DataINEndpointSize        = MASS_STORAGE_IO_EPSIZE,\r
+                               .DataINEndpointDoubleBank  = false,\r
+\r
+                               .DataOUTEndpointNumber     = MASS_STORAGE_OUT_EPNUM,\r
+                               .DataOUTEndpointSize       = MASS_STORAGE_IO_EPSIZE,\r
+                               .DataOUTEndpointDoubleBank = false,\r
+\r
+                               .TotalLUNs                 = 1,\r
+                       },\r
+       };\r
+\r
+\r
+/** USB device mode management task. This function manages the Mass Storage Device class driver when the device is\r
+ *  initialized in USB device mode.\r
+ */\r
+void USBDeviceMode_USBTask(void)\r
+{\r
+       if (USB_CurrentMode != USB_MODE_DEVICE)\r
+         return;\r
+\r
+       MS_Device_USBTask(&Disk_MS_Interface);\r
+}\r
+\r
+/** Event handler for the library USB Connection event. */\r
+void EVENT_USB_Device_Connect(void)\r
+{\r
+       LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
+}\r
+\r
+/** Event handler for the library USB Disconnection event. */\r
+void EVENT_USB_Device_Disconnect(void)\r
+{\r
+       LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+}\r
+\r
+/** Event handler for the library USB Configuration Changed event. */\r
+void EVENT_USB_Device_ConfigurationChanged(void)\r
+{\r
+       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+\r
+       if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface)))\r
+         LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+}\r
+\r
+/** Event handler for the library USB Unhandled Control Request event. */\r
+void EVENT_USB_Device_UnhandledControlRequest(void)\r
+{\r
+       MS_Device_ProcessControlRequest(&Disk_MS_Interface);\r
+}\r
+\r
+/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.\r
+ *\r
+ *  \param[in] MSInterfaceInfo  Pointer to the Mass Storage class interface configuration structure being referenced\r
+ */\r
+bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo)\r
+{\r
+       bool CommandSuccess;\r
+       \r
+       LEDs_SetAllLEDs(LEDMASK_USB_BUSY);\r
+       CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);\r
+       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+       \r
+       return CommandSuccess;\r
+}\r
diff --git a/Projects/Webserver/USBDeviceMode.h b/Projects/Webserver/USBDeviceMode.h
new file mode 100644 (file)
index 0000000..d76c667
--- /dev/null
@@ -0,0 +1,56 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Header file for USBDeviceMode.c.\r
+ */\r
+\r
+#ifndef _USBDEVICEMODE_H_\r
+#define _USBDEVICEMODE_H_\r
+\r
+       /* Includes: */\r
+               #include <LUFA/Drivers/USB/Class/MassStorage.h>\r
+               \r
+               #include "Webserver.h"\r
+               #include "Descriptors.h"\r
+               #include "Lib/SCSI.h"\r
+\r
+       /* Function Prototypes: */\r
+               void USBDeviceMode_USBTask(void);\r
+\r
+               void EVENT_USB_Device_Connect(void);\r
+               void EVENT_USB_Device_Disconnect(void);\r
+               void EVENT_USB_Device_ConfigurationChanged(void);\r
+               void EVENT_USB_Device_UnhandledControlRequest(void);\r
+\r
+               bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);\r
+               \r
+#endif\r
diff --git a/Projects/Webserver/USBHostMode.c b/Projects/Webserver/USBHostMode.c
new file mode 100644 (file)
index 0000000..14f33e0
--- /dev/null
@@ -0,0 +1,178 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  USB Host Mode management functions and variables. This file contains the LUFA code required to\r
+ *  manage the USB RNDIS host mode.\r
+ */\r
\r
+#include "USBHostMode.h"\r
+\r
+/** LUFA RNDIS Class driver interface configuration and state information. This structure is\r
+ *  passed to all RNDIS Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
+USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface =\r
+       {\r
+               .Config =\r
+                       {\r
+                               .DataINPipeNumber           = 1,\r
+                               .DataINPipeDoubleBank       = false,\r
+\r
+                               .DataOUTPipeNumber          = 2,\r
+                               .DataOUTPipeDoubleBank      = false,\r
+\r
+                               .NotificationPipeNumber     = 3,\r
+                               .NotificationPipeDoubleBank = false,\r
+                               \r
+                               .HostMaxPacketSize          = UIP_CONF_BUFFER_SIZE,\r
+                       },\r
+       };\r
+\r
+\r
+/** USB host mode management task. This function manages the RNDIS Host class driver and uIP stack when the device is\r
+ *  initialized in USB host mode.\r
+ */\r
+void USBHostMode_USBTask(void)\r
+{\r
+       if (USB_CurrentMode != USB_MODE_HOST)\r
+         return;\r
+\r
+       switch (USB_HostState)\r
+       {\r
+               case HOST_STATE_Addressed:\r
+                       LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
+               \r
+                       uint16_t ConfigDescriptorSize;\r
+                       uint8_t  ConfigDescriptorData[512];\r
+\r
+                       if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
+                                                                                                  sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
+                       {\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+                               USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+                               break;\r
+                       }\r
+\r
+                       if (RNDIS_Host_ConfigurePipes(&Ethernet_RNDIS_Interface,\r
+                                                                                 ConfigDescriptorSize, ConfigDescriptorData) != RNDIS_ENUMERROR_NoError)\r
+                       {\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+                               USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+                               break;\r
+                       }\r
+                       \r
+                       if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
+                       {\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+                               USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+                               break;\r
+                       }\r
+                       \r
+                       if (RNDIS_Host_InitializeDevice(&Ethernet_RNDIS_Interface) != HOST_SENDCONTROL_Successful)\r
+                       {\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+                               USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+                               break;                  \r
+                       }\r
+                       \r
+                       uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST);\r
+                       if (RNDIS_Host_SetRNDISProperty(&Ethernet_RNDIS_Interface, OID_GEN_CURRENT_PACKET_FILTER,\r
+                                                                                       &PacketFilter, sizeof(PacketFilter)) != HOST_SENDCONTROL_Successful)\r
+                       {\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+                               USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+                               break;\r
+                       }\r
+                       \r
+                       if (RNDIS_Host_QueryRNDISProperty(&Ethernet_RNDIS_Interface, OID_802_3_CURRENT_ADDRESS,\r
+                                                                                         &MACAddress, sizeof(MACAddress)) != HOST_SENDCONTROL_Successful)\r
+                       {\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+                               USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+                               break;\r
+                       }\r
+                       \r
+                       /* Initialize uIP stack */\r
+                       uIPManagement_Init();\r
+                       \r
+                       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+                       USB_HostState = HOST_STATE_Configured;\r
+                       break;\r
+               case HOST_STATE_Configured:\r
+                       uIPManagement_ManageNetwork();\r
+               \r
+                       break;\r
+       }\r
+\r
+       RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface);\r
+}\r
+\r
+/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and\r
+ *  starts the library USB task to begin the enumeration and USB management process.\r
+ */\r
+void EVENT_USB_Host_DeviceAttached(void)\r
+{\r
+       LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
+}\r
+\r
+/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and\r
+ *  stops the library USB task management process.\r
+ */\r
+void EVENT_USB_Host_DeviceUnattached(void)\r
+{\r
+       LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+}\r
+\r
+/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully\r
+ *  enumerated by the host and is now ready to be used by the application.\r
+ */\r
+void EVENT_USB_Host_DeviceEnumerationComplete(void)\r
+{\r
+       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+}\r
+\r
+/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */\r
+void EVENT_USB_Host_HostError(const uint8_t ErrorCode)\r
+{\r
+       USB_ShutDown();\r
+\r
+       LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       for(;;);\r
+}\r
+\r
+/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while\r
+ *  enumerating an attached USB device.\r
+ */\r
+void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
+{\r
+       LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+}\r
diff --git a/Projects/Webserver/USBHostMode.h b/Projects/Webserver/USBHostMode.h
new file mode 100644 (file)
index 0000000..03387ed
--- /dev/null
@@ -0,0 +1,57 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Header file for USBHostMode.c.\r
+ */\r
+\r
+#ifndef _USBHOSTMODE_H_\r
+#define _USBHOSTMODE_H_\r
+\r
+       /* Includes: */\r
+               #include <LUFA/Drivers/USB/Class/RNDIS.h>\r
+               \r
+               #include "Webserver.h"\r
+               #include "Lib/uIPManagement.h"\r
+               \r
+       /* External Variables: */\r
+               extern USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface;\r
+\r
+       /* Function Prototypes: */\r
+               void USBHostMode_USBTask(void);\r
+       \r
+               void EVENT_USB_Host_HostError(const uint8_t ErrorCode);\r
+               void EVENT_USB_Host_DeviceAttached(void);\r
+               void EVENT_USB_Host_DeviceUnattached(void);\r
+               void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
+               void EVENT_USB_Host_DeviceEnumerationComplete(void);\r
+               \r
+#endif\r
index ec1dabf..47fd9c7 100644 (file)
  \r
 #include "Webserver.h"\r
 \r
  \r
 #include "Webserver.h"\r
 \r
-/** LUFA RNDIS Class driver interface configuration and state information. This structure is\r
- *  passed to all RNDIS Class driver functions, so that multiple instances of the same class\r
- *  within a device can be differentiated from one another.\r
- */\r
-USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface =\r
-       {\r
-               .Config =\r
-                       {\r
-                               .DataINPipeNumber           = 1,\r
-                               .DataINPipeDoubleBank       = false,\r
-\r
-                               .DataOUTPipeNumber          = 2,\r
-                               .DataOUTPipeDoubleBank      = false,\r
-\r
-                               .NotificationPipeNumber     = 3,\r
-                               .NotificationPipeDoubleBank = false,\r
-                               \r
-                               .HostMaxPacketSize          = UIP_CONF_BUFFER_SIZE,\r
-                       },\r
-       };\r
-\r
-/** Connection timer, to retain the time elapsed since the last time the uIP connections were managed. */\r
-struct timer ConnectionTimer;\r
-\r
-/** ARP timer, to retain the time elapsed since the ARP cache was last updated. */\r
-struct timer ARPTimer;\r
-\r
-/** MAC address of the RNDIS device, when enumerated */\r
-struct uip_eth_addr MACAddress;\r
-\r
 /** Main program entry point. This routine configures the hardware required by the application, then\r
  *  enters a loop to run the application tasks in sequence.\r
  */\r
 /** Main program entry point. This routine configures the hardware required by the application, then\r
  *  enters a loop to run the application tasks in sequence.\r
  */\r
@@ -77,177 +47,13 @@ int main(void)
 \r
        for (;;)\r
        {\r
 \r
        for (;;)\r
        {\r
-               switch (USB_HostState)\r
-               {\r
-                       case HOST_STATE_Addressed:\r
-                               LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
-                       \r
-                               uint16_t ConfigDescriptorSize;\r
-                               uint8_t  ConfigDescriptorData[512];\r
+               USBDeviceMode_USBTask();\r
+               USBHostMode_USBTask();\r
 \r
 \r
-                               if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
-                                                                      sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
-                               {\r
-                                       LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
-                                       USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
-                                       break;\r
-                               }\r
-\r
-                               if (RNDIS_Host_ConfigurePipes(&Ethernet_RNDIS_Interface,\r
-                                                             ConfigDescriptorSize, ConfigDescriptorData) != RNDIS_ENUMERROR_NoError)\r
-                               {\r
-                                       LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
-                                       USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
-                                       break;\r
-                               }\r
-                               \r
-                               if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
-                               {\r
-                                       LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
-                                       USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
-                                       break;\r
-                               }\r
-                               \r
-                               if (RNDIS_Host_InitializeDevice(&Ethernet_RNDIS_Interface) != HOST_SENDCONTROL_Successful)\r
-                               {\r
-                                       LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
-                                       USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
-                                       break;                  \r
-                               }\r
-                               \r
-                               uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST);\r
-                               if (RNDIS_Host_SetRNDISProperty(&Ethernet_RNDIS_Interface, OID_GEN_CURRENT_PACKET_FILTER,\r
-                                                               &PacketFilter, sizeof(PacketFilter)) != HOST_SENDCONTROL_Successful)\r
-                               {\r
-                                       LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
-                                       USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
-                                       break;\r
-                               }\r
-                               \r
-                               if (RNDIS_Host_QueryRNDISProperty(&Ethernet_RNDIS_Interface, OID_802_3_CURRENT_ADDRESS,\r
-                                                                 &MACAddress, sizeof(MACAddress)) != HOST_SENDCONTROL_Successful)\r
-                               {\r
-                                       LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
-                                       USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
-                                       break;\r
-                               }\r
-\r
-                               uip_setethaddr(MACAddress);\r
-                               \r
-                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
-                               USB_HostState = HOST_STATE_Configured;\r
-                               break;\r
-                       case HOST_STATE_Configured:\r
-                               ProcessIncommingPacket();\r
-                               ManageConnections();\r
-                       \r
-                               break;\r
-               }\r
-       \r
-               RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface);\r
                USB_USBTask();\r
        }\r
 }\r
 \r
                USB_USBTask();\r
        }\r
 }\r
 \r
-/** Processes incomming packets to the server from the connected RNDIS device, creating responses as needed. */\r
-void ProcessIncommingPacket(void)\r
-{\r
-       if (RNDIS_Host_IsPacketReceived(&Ethernet_RNDIS_Interface))\r
-       {\r
-               LEDs_SetAllLEDs(LEDMASK_USB_BUSY);\r
-\r
-               /* Read the incomming packet straight into the UIP packet buffer */\r
-               RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, &uip_buf[0], &uip_len);\r
-\r
-               if (uip_len > 0)\r
-               {\r
-                       bool PacketHandled = true;\r
-\r
-                       struct uip_eth_hdr* EthernetHeader = (struct uip_eth_hdr*)&uip_buf[0];\r
-                       if (EthernetHeader->type == HTONS(UIP_ETHTYPE_IP))\r
-                       {\r
-                               /* Filter packet by MAC destination */\r
-                               uip_arp_ipin();\r
-\r
-                               /* Process incomming packet */\r
-                               uip_input();\r
-\r
-                               /* Add destination MAC to outgoing packet */\r
-                               if (uip_len > 0)\r
-                                 uip_arp_out();\r
-                       }\r
-                       else if (EthernetHeader->type == HTONS(UIP_ETHTYPE_ARP))\r
-                       {\r
-                               /* Process ARP packet */\r
-                               uip_arp_arpin();\r
-                       }\r
-                       else\r
-                       {\r
-                               PacketHandled = false;\r
-                       }\r
-\r
-                       /* If a response was generated, send it */\r
-                       if ((uip_len > 0) && PacketHandled)\r
-                         RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, &uip_buf[0], uip_len);\r
-               }\r
-\r
-               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
-       }\r
-}\r
-\r
-/** Manages the currently open network connections, including TCP and (if enabled) UDP. */\r
-void ManageConnections(void)\r
-{\r
-       /* Manage open connections */\r
-       if (timer_expired(&ConnectionTimer))\r
-       {\r
-               timer_reset(&ConnectionTimer);\r
-\r
-               LEDs_SetAllLEDs(LEDMASK_USB_BUSY);\r
-               \r
-               for (uint8_t i = 0; i < UIP_CONNS; i++)\r
-               {\r
-                       /* Run periodic connection management for each TCP connection */\r
-                       uip_periodic(i);\r
-\r
-                       /* If a response was generated, send it */\r
-                       if (uip_len > 0)\r
-                       {\r
-                               /* Add destination MAC to outgoing packet */\r
-                               uip_arp_out();\r
-\r
-                               RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, &uip_buf[0], uip_len);\r
-                       }\r
-               }\r
-               \r
-               #if defined(ENABLE_DHCP)\r
-               for (uint8_t i = 0; i < UIP_UDP_CONNS; i++)\r
-               {\r
-                       /* Run periodic connection management for each UDP connection */\r
-                       uip_udp_periodic(i);\r
-\r
-                       /* If a response was generated, send it */\r
-                       if (uip_len > 0)\r
-                       {\r
-                               /* Add destination MAC to outgoing packet */\r
-                               uip_arp_out();\r
-\r
-                               RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, &uip_buf[0], uip_len);\r
-                       }\r
-               }\r
-               #endif\r
-\r
-               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
-       }\r
-\r
-       /* Manage ARP cache refreshing */\r
-       if (timer_expired(&ARPTimer))\r
-       {\r
-               timer_reset(&ARPTimer);\r
-               uip_arp_timer();\r
-       }\r
-}\r
-\r
 /** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
 /** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
@@ -259,71 +65,8 @@ void SetupHardware(void)
        clock_prescale_set(clock_div_1);\r
 \r
        /* Hardware Initialization */\r
        clock_prescale_set(clock_div_1);\r
 \r
        /* Hardware Initialization */\r
+       SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);\r
+       Dataflash_Init();\r
        LEDs_Init();\r
        LEDs_Init();\r
-       USB_Init();\r
-\r
-       /* uIP Timing Initialization */\r
-       clock_init();\r
-       timer_set(&ConnectionTimer, CLOCK_SECOND / 2);\r
-       timer_set(&ARPTimer, CLOCK_SECOND * 10);        \r
-\r
-       /* uIP Stack Initialization */\r
-       uip_init();\r
-\r
-       /* DHCP/Server IP Settings Initialization */\r
-       #if defined(ENABLE_DHCP)\r
-       DHCPApp_Init();\r
-       #else\r
-       uip_ipaddr_t IPAddress, Netmask, GatewayIPAddress;\r
-       uip_ipaddr(&IPAddress,        DEVICE_IP_ADDRESS[0], DEVICE_IP_ADDRESS[1], DEVICE_IP_ADDRESS[2], DEVICE_IP_ADDRESS[3]);\r
-       uip_ipaddr(&Netmask,          DEVICE_NETMASK[0],    DEVICE_NETMASK[1],    DEVICE_NETMASK[2],    DEVICE_NETMASK[3]);\r
-       uip_ipaddr(&GatewayIPAddress, DEVICE_GATEWAY[0],    DEVICE_GATEWAY[1],    DEVICE_GATEWAY[2],    DEVICE_GATEWAY[3]);\r
-       uip_sethostaddr(&IPAddress);\r
-       uip_setnetmask(&Netmask);\r
-       uip_setdraddr(&GatewayIPAddress);\r
-       #endif\r
-       \r
-       /* HTTP Webserver Initialization */\r
-       WebserverApp_Init();\r
-}\r
-\r
-/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and\r
- *  starts the library USB task to begin the enumeration and USB management process.\r
- */\r
-void EVENT_USB_Host_DeviceAttached(void)\r
-{\r
-       LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
-}\r
-\r
-/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and\r
- *  stops the library USB task management process.\r
- */\r
-void EVENT_USB_Host_DeviceUnattached(void)\r
-{\r
-       LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
-}\r
-\r
-/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully\r
- *  enumerated by the host and is now ready to be used by the application.\r
- */\r
-void EVENT_USB_Host_DeviceEnumerationComplete(void)\r
-{\r
-       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
-}\r
-\r
-/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */\r
-void EVENT_USB_Host_HostError(const uint8_t ErrorCode)\r
-{\r
-       USB_ShutDown();\r
-\r
-       LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
-       for(;;);\r
-}\r
-\r
-/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while\r
- *  enumerating an attached USB device.\r
- */\r
-void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
-{\r
-       LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       USB_Init(USB_MODE_UID);\r
 }\r
 }\r
index 13462a2..a9621e3 100644 (file)
 \r
                #include <LUFA/Version.h>\r
                #include <LUFA/Drivers/Board/LEDs.h>\r
 \r
                #include <LUFA/Version.h>\r
                #include <LUFA/Drivers/Board/LEDs.h>\r
+               #include <LUFA/Drivers/Board/Dataflash.h>\r
+               #include <LUFA/Drivers/Peripheral/SPI.h>\r
                #include <LUFA/Drivers/USB/USB.h>\r
                #include <LUFA/Drivers/USB/USB.h>\r
-               #include <LUFA/Drivers/USB/Class/RNDIS.h>\r
                \r
                \r
-               #include <uip.h>\r
-               #include <uip_arp.h>\r
-               #include <timer.h>\r
-               \r
-               #include "Lib/WebserverApp.h"\r
-               #include "Lib/DHCPApp.h"\r
+               #include "USBDeviceMode.h"\r
+               #include "USBHostMode.h"\r
                \r
        /* Macros: */\r
                \r
        /* Macros: */\r
-               /** IP address that the webserver should use once connected to a RNDIS device (when DHCP is disabled). */\r
-               #define DEVICE_IP_ADDRESS         (uint8_t[]){192, 168, 1, 10}\r
-               \r
-               /** Netmask that the webserver should once connected to a RNDIS device (when DHCP is disabled). */\r
-               #define DEVICE_NETMASK            (uint8_t[]){255, 255, 255, 0}\r
-               \r
-               /** IP address of the default gateway the webserver should use when routing outside the local subnet\r
-                *  (when DHCP is disabled).\r
-                */\r
-               #define DEVICE_GATEWAY            (uint8_t[]){192, 168, 1, 1}\r
-\r
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
 \r
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
 \r
                \r
                /** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
                #define LEDMASK_USB_BUSY          LEDS_LED2\r
                \r
                /** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
                #define LEDMASK_USB_BUSY          LEDS_LED2\r
-       \r
-       /* External Variables: */\r
-               extern struct uip_eth_addr MACAddress;\r
-               \r
+\r
        /* Function Prototypes: */\r
                void SetupHardware(void);\r
        /* Function Prototypes: */\r
                void SetupHardware(void);\r
-               void ProcessIncommingPacket(void);\r
-               void ManageConnections(void);\r
-       \r
-               void EVENT_USB_Host_HostError(const uint8_t ErrorCode);\r
-               void EVENT_USB_Host_DeviceAttached(void);\r
-               void EVENT_USB_Host_DeviceUnattached(void);\r
-               void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
-               void EVENT_USB_Host_DeviceEnumerationComplete(void);\r
                \r
 #endif\r
                \r
 #endif\r
index e1d2985..e78cf5e 100644 (file)
  *\r
  *  \section SSec_Description Project Description: \r
  *\r
  *\r
  *  \section SSec_Description Project Description: \r
  *\r
- *  Simple HTTP webserver project. This project combines the LUFA library with the uIP TCP/IP full network stack, to create a\r
- *  RNDIS host capable of serving out HTTP webpages to up to 10 hosts simultaneously. This project demonstrates how the two\r
- *  libraries can be combined into a robust network enabled application, with the addition of a RNDIS network device.\r
+ *  Simple HTTP webserver project. This project combines the LUFA library with the uIP TCP/IP full network stack and FatFS\r
+ *  library to create a RNDIS host capable of serving out HTTP webpages to multiple hosts simultaneously. This project\r
+ *  demonstrates how the libraries can be combined into a robust network enabled application, with the addition of a RNDIS\r
+ *  network device.\r
  *\r
  *\r
- *  To use this project, plug the USB AVR into a RNDIS class device, such as a USB (desktop) modem. If compatible, the project\r
- *  will enumerate the device, set the appropriate parameters needed for connectivity and begin listening for new HTTP connections\r
- *  on port 80. The device IP, netmask and default gateway IP must be set to values appropriate for the RNDIS device being used\r
- *  for this project to work.\r
+ *  To use this project, plug the USB AVR into a computer, so that it enumerates as a standard Mass Storage device. Load\r
+ *  HTML files onto the disk, so that they can be served out to clients -- the default file to serve should be called\r
+ *  <i>index.htm<i>. Filenames must be in 8.3 format for them to be retrieved correctly by the webserver.\r
\r
+ *  When attached to a RNDIS class device, such as a USB (desktop) modem. If compatible, the system will enumerate the\r
+ *  device, set the appropriate parameters needed for connectivity and begin listening for new HTTP connections on port 80.\r
+ *  The device IP, netmask and default gateway IP must be set to values appropriate for the RNDIS device being used for this\r
+ *  project to work, if the DHCP client is disabled (see \ref SSec_Options).\r
  *\r
  *\r
- *  When properly configured, the webserver can be accessed from any HTTP webrowser by typing in the device's IP address.\r
+ *  When properly configured, the webserver can be accessed from any HTTP webrowser by typing in the device's static or\r
+ *  dynamically allocated IP address.\r
  *\r
  *  \section SSec_Options Project Options\r
  *\r
  *\r
  *  \section SSec_Options Project Options\r
  *\r
  *   </tr>\r
  *   <tr>\r
  *    <td>DEVICE_IP_ADDRESS</td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td>DEVICE_IP_ADDRESS</td>\r
- *    <td>Webserver.h</td>\r
+ *    <td>Lib/uIPManagement.h</td>\r
  *    <td>IP address that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP is not defined).</td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td>DEVICE_NETMASK</td>\r
  *    <td>IP address that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP is not defined).</td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td>DEVICE_NETMASK</td>\r
- *    <td>Webserver.h</td>\r
+ *    <td>Lib/uIPManagement.h</td>\r
  *    <td>Netmask that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP is not defined).</td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td>DEVICE_GATEWAY</td>\r
  *    <td>Netmask that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP is not defined).</td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td>DEVICE_GATEWAY</td>\r
- *    <td>Webserver.h</td>\r
+ *    <td>Lib/uIPManagement.h</td>\r
  *    <td>Default routing gateway that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP\r
  *        is not defined).</td>\r
  *   </tr>\r
  *    <td>Default routing gateway that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP\r
  *        is not defined).</td>\r
  *   </tr>\r
index 4a1b85b..3c72ad8 100644 (file)
@@ -116,14 +116,31 @@ LUFA_PATH = ../../
 \r
 \r
 # LUFA library compile-time options\r
 \r
 \r
 # LUFA library compile-time options\r
-LUFA_OPTS += -D USB_HOST_ONLY\r
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+LUFA_OPTS  = -D FIXED_CONTROL_ENDPOINT_SIZE=8\r
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1\r
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS\r
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # List C source files here. (C dependencies are automatically generated.)\r
 SRC = $(TARGET).c                                                 \\r
 \r
 \r
 # List C source files here. (C dependencies are automatically generated.)\r
 SRC = $(TARGET).c                                                 \\r
+         Descriptors.c                                               \\r
+         USBDeviceMode.c                                             \\r
+         USBHostMode.c                                               \\r
+         Lib/SCSI.c                                                  \\r
+         Lib/uIPManagement.c                                         \\r
          Lib/DHCPApp.c                                               \\r
          Lib/DHCPApp.c                                               \\r
-         Lib/WebserverApp.c                                          \\r
+         Lib/HTTPServerApp.c                                         \\r
+         Lib/DataflashManager.c                                      \\r
+         Lib/uip/uip.c                                               \\r
+         Lib/uip/uip_arp.c                                           \\r
+         Lib/uip/uiplib.c                                            \\r
+         Lib/uip/psock.c                                             \\r
+         Lib/uip/timer.c                                             \\r
+         Lib/uip/uip-neighbor.c                                      \\r
+         Lib/uip/conf/clock-arch.c                                   \\r
+         Lib/FatFS/diskio.c                                          \\r
+         Lib/FatFS/ff.c                                              \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c        \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c           \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c               \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c        \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c           \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c               \\r
@@ -134,17 +151,11 @@ SRC = $(TARGET).c                                                 \
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c      \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c           \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c  \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c      \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c           \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c  \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MassStorage.c    \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MassStorage.c      \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/RNDIS.c          \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/RNDIS.c            \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/RNDIS.c          \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/RNDIS.c            \\r
-         Lib/uip/uip.c                                               \\r
-         Lib/uip/uip_arp.c                                           \\r
-         Lib/uip/uiplib.c                                            \\r
-         Lib/uip/psock.c                                             \\r
-         Lib/uip/timer.c                                             \\r
-         Lib/uip/uip-neighbor.c                                      \\r
-         Lib/uip/conf/clock-arch.c                                   \\r
-         \r
-         \r
+\r
 # List C++ source files here. (C dependencies are automatically generated.)\r
 CPPSRC = \r
 \r
 # List C++ source files here. (C dependencies are automatically generated.)\r
 CPPSRC = \r
 \r
@@ -176,7 +187,7 @@ DEBUG = dwarf-2
 #     Each directory must be seperated by a space.\r
 #     Use forward slashes for directory separators.\r
 #     For a directory that has spaces, enclose it in quotes.\r
 #     Each directory must be seperated by a space.\r
 #     Use forward slashes for directory separators.\r
 #     For a directory that has spaces, enclose it in quotes.\r
-EXTRAINCDIRS = $(LUFA_PATH)/ Lib/uip/ Lib/uip/conf/\r
+EXTRAINCDIRS = $(LUFA_PATH)/ Lib/uip/ Lib/uip/conf/ Lib/FatFS/\r
 \r
 \r
 # Compiler flag to set the C Standard level.\r
 \r
 \r
 # Compiler flag to set the C Standard level.\r